Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > RightScale API 1.5 > Examples > Server Array > List Server Arrays

List Server Arrays

List all Server Arrays owned by the current account.

icon_curl_v1.png    icon_rs_api_client_v1.png

Table of Contents

Curl

Prerequisite:  Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.

Example Call

#!/bin/sh -e
curl -i -H X_API_VERSION:1.5 -b mycookie -X GET https://my.rightscale.com/api/server_arrays.xml

Sample Output

Note

  • Truncated XML output without headers included (to save space). 
  • Only one server array is listed in this example (also to save space).
<?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>

Supplemental

Show only Server Arrays in a Specific Deployment

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
Filter by the Server Array Name

The following example locates a specific Server Array by name.

#!/bin/sh -e
curl -i -H X_API_VERSION:1.5 -b mycookie -d filter[]="name==Base ServerTemplate for Linux" -X GET https://my.rightscale.com/api/server_arrays.xml

right_api_client

Example Call

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'

 

 

Sample Output

[#<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)">]

 

 

You must to post a comment.
Last modified
08:36, 14 Oct 2013

Tags

This page has no custom tags.

Classifications

This page has no classifications.

Announcements

None


© 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.