Adding resources
Resources are additional files that are required when executing instructions in an instruction XML file. Resources are downloaded from the Tachyon content URL by the Tachyon client, when they are accessed.
TIMS embeds resources directly into the instruction XML file, so that when this is loaded into Tachyon, the embedded resources are automatically extracted and copied to the Tachyon content URL.
To add a resource, click the Import Resource toolbar in the TIMS menu. Browse to the file and select it.
TIMS will automatically determine the resource type and compute its SHA-256 hash and size as shown in the dialog below
The options 'update this resource from a file' and 'save this resource to a file' will be discussed shortly. They are mainly useful when managing already-embedded resources.
Press OK to insert the resource. The code block below shows how the instruction XML file looks after the resource has been embedded. Note that the base-64 encoding of the resource has been truncated for clarity.
<Resources> <Resource Name="setperm"> <Content Type="PowerShell" FileName="setperm.ps1" Size="269" Platform="Windows" Hash="8943cb3a1e6a848bbe52014bd1c082e4841060791b7ce8c1f9f3b349c3bd8b64"> <![CDATA[JGFjbD1nZXQ.................]]> </Content> </Resource> </Resources>
Managing embedded resources
Once a resource has been embedded, TIMS shows it in the script pane footer, like this
Click on the resource dropdown to see the available resource management options
Insert Snippet to Download
The Insert Snippet to Download option inserts code to download the resource programmatically. For example, for the PowerShell resource we embedded, the snippet will look like this
@resource1 = HttpGetFile(URL:"setperm.ps1", Size:269, Hash:"8943cb3a1e6a848bbe52014bd1c082e4841060791b7ce8c1f9f3b349c3bd8b64");
Resource downloading in the TIMS environment
When your instruction is deployed in the Tachyon environment, the above HttpGetFile request will download the resource file from the Tachyon server content endpoint URL.
However while you are developing your instruction in TIMS, when the HttpGetFile is executed, TIMS will instead retrieve the embedded resource from its internal memory and populate the result variable, just as if the file had actually been downloaded.
Edit
The Edit option will display the resource dialog we saw previously. You can amend any resource property from this dialog.
You can also select the two options which were mentioned previously.
Update this resource from a file
When this option is selected, you will be prompted to select a file. The file contents completely replace the current resource.
Save this resource to a file
When this option is selected, you will be prompted to enter a file name. A copy of the resource is saved to the file you specify
Remove
The resource is removed from the instruction XML file.
Tip
See Instruction Definition Reference (Resources) for more detail about resources.