|Table of Contents||Sections|
The RightScale API reference documentation lists all the available resource types in the rs namespace and corresponding media types. This section describes how to use that documentation to use the corresponding resources in a cloud workflow.
Resource actions are listed in the corresponding media type document under the Actions section. The required arguments are described in the resource document itself. For example, the media type for the instances resource is described in the corresponding document and the actions are:
The details on how to call the actions are described in the instances resource document, taking the launch() action as example:
Launches an instance using the parameters that this instance has been configured with.
Note that this action can only be performed in "next" instances, and not on instances that are already running.
|inputs[name]||yes||String||*||*||no||The input name.|
|inputs[value]||yes||String||*||*||no||The value of that input. Should be of the form 'text:my_value' or 'cred:MY_CRED', etc.|
Note that the engine will automatically map the Location response header to a resource collection and will make that resource collection the return value of the action. The action takes a single parameter inputs which is an array of hashes. Each hash should contain two elements: name and value. So the launch() action can be called in RCL using:
Resource fields are listed in the corresponding media type document under the Attributes section. Look at the documentation for the media type of the instances resource:
Resources links are listed in the corresponding media type document under the Relationships section. Look at the documentation for the media type of the instances resource:
Note that some links yield individual resources while others yield a collection. In the example above server_template() returns a single resource while volume_attachments() returns a collection. The possible link parameters are given by the description of the show request of the link resource if the link is for a single resource. Otherwise, they are given by the description of the index request. In the example above, the server_templates resource show request described in the resource documentation lists one potential parameter view which can be used in RCL as follows:
The resource types get() action map to a index request on the corresponding resource. The parameters are thus described in the resources index request documentation. For example, for instances:
Lists instances of a given cloud.
Using the available filters, it is possible to craft powerful queries about which instances to retrieve. For example, one can easily list:
See below for valid filter parameters.
default, extended, full
|*||no||Specifies how many attributes and/or expanded nested relationships to include.|
|no||The href of the datacenter to filter on.|
|no||The href of the deployment to filter on.|
Name of the Instance to filter on.
The OS platform to filter on.
The href of the parent to filter on.
The private dns name to filter on.
The private ip address to filter on.
The public dns name to filter on.
The public ip address to filter on.
Resource Unique IDentifier for the Instance to filter on.
The href of the ServerTemplate to filter on.
The state of Instances to filter on.
Filters are given in the filter parameter which corresponds to an array of filter expressions. A filter expression consists of a filter name (from the table above) and a comparison to a value using either == or <>. For example, to retrieve all instances in the account whose name is not master_db one could write:
Possible parameters for the resource types create() and update() actions are described by the corresponding resource request documentation. Looking at the deployments resource as an example, the corresponding documentation for the create request is:
Creates a new deployment with the given parameters.
|*||yes||The description of the deployment to be created.|
The name of the deployment to be created.
So a deployment create() action takes a single hash argument named deployment which consists of a hash with two keys: name and description. A deployment can thus be created in RCL using:
|RCL||Resources||Cloud Workflows & Definitions||Variables||Attributes & Error Handling||Branching & Looping||Processes||Functions||Operators||► Mapping|
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.