Chaining Datasources
resources "clouds", type: "rs_cm.clouds"
resources "instances", type: "rs_cm.instances" do
iterate @clouds# iterate through the data retrieved by the
# "clouds" resource definition.
cloud_href href(iter_item) # iter_item returns the cloud data currently
# being iterated on.
end
Note:iterate may appear only once in a given datasource definition.
As shown in the example above references are typically used together with the iterate reserved word to iterate over the elements of the data. If the data is not an array then iterate takes care of wrapping it with a single element array.
References may also be used directly as argument of other functions such as val, href, size or select.
Finally, references can be used when defining the parameters given to run_script:
datasource "permissions" do
run_script "get_permissions", @instances, @security_groups
end