List all Server Arrays owned by the current account.
Table of Contents
Prerequisite: Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.
#!/bin/sh -e curl -i -H X_API_VERSION:1.5 -b mycookie -X GET https://my.rightscale.com/api/server_arrays.xml
Note:
<?xml version="1.0" encoding="UTF-8"?> <server_arrays> <server_array> <links> <link rel="self" href="/api/server_arrays/12030"/> <link rel="deployment" href="/api/deployments/80051"/> <link rel="current_instances" href="/api/server_arrays/12030/current_instances"/> <link rel="next_instance" href="/api/clouds/232/instances/6CNISESVS3MUL"/> <link rel="alert_specs" href="/api/server_arrays/12030/alert_specs"/> </links> <instances_count>0</instances_count> <actions> <action rel="launch"/> <action rel="clone"/> </actions> <description></description> <name>Windows IIS-RAX array</name> <elasticity_params> <pacing> <resize_calm_time>5</resize_calm_time> <resize_up_by>1</resize_up_by> <resize_down_by>1</resize_down_by> </pacing> <schedule_entries></schedule_entries> <alert_specific_params> <voters_tag_predicate>windows firefox template array</voters_tag_predicate> <decision_threshold>51</decision_threshold> </alert_specific_params> <bounds> <max_count>20</max_count> <min_count>0</min_count> </bounds> </elasticity_params> <array_type>alert</array_type> <state>enabled</state> </server_array>
The following supplemental example includes a "filter" so only servers arrays from the specified deployment are listed.
Important! When using a filter (or view) the computation is done on the server side. This results in a lighter response (less content) returned to the client. The server essentially fetches all content and returns it to the client.
#!/bin/sh -e DEPLOYMENT="316795001" curl -i -H X_API_VERSION:1.5 -b mycookie -d filter[]="deployment_href==/api/deployments/$DEPLOYMENT" -X GET https://my.rightscale.com/api/server_arrays.xml
require 'rubygems' require 'pp' # Require pretty print Ruby gem require 'right_api_client' # RightScale API client gem user = 'greg.doe@example.com' # Set user email address for using the Dashboard acct = '1234' # Set the account ID pass = 'SomePassword' # Set the password for the user. Create client object so you can use the API. @client = RightApi::Client.new(:email => user, :password => pass, :account_id => acct) # # Setup and authenticate above. Set and use additional variables below, display output, etc. # pp @client.server_arrays.index # Output all Server Arrays owned by account '1234'
[#<RightApi::ResourceDetail resource_type="server_array", name="DomsRackspaceArrayTest">, #<RightApi::ResourceDetail resource_type="server_array", name="Rackspace_Array">, #<RightApi::ResourceDetail resource_type="server_array", name="Moon Unit Rho">, #<RightApi::ResourceDetail resource_type="server_array", name="TS RackArray">, #<RightApi::ResourceDetail resource_type="server_array", name="Cloud.com Server Array">, . . . truncated output . . . #<RightApi::ResourceDetail resource_type="server_array", name="dano cs 306 array">, #<RightApi::ResourceDetail resource_type="server_array", name="rax oc Chicago">, #<RightApi::ResourceDetail resource_type="server_array", name="Base ServerTemplate for Linux (RSB) (v12.11.3-LTS)">]
© 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.