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 > Clouds > List Clouds

List Clouds

List all Clouds known by the current account.

icon_curl_v1.png    icon_rs_api_client_v1.png   icon_powershell_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/clouds.xml

Sample Output

  • Note: The sample output below does not include XML headers, and is truncated for readability sake.
<?xml version="1.0" encoding="UTF-8"?>
<clouds>
  <cloud>
    <links>
      <link href="/api/clouds/232" rel="self"/>
      <link href="/api/clouds/232/instance_types" rel="instance_types"/>
      <link href="/api/clouds/232/instances" rel="instances"/>
      <link href="/api/clouds/232/images" rel="images"/>
    </links>
    <cloud_type>rackspace</cloud_type>
    <description>Rackspace cloud</description>
    <name>Rackspace</name>
  </cloud>

<cloud>
    <links>
      <link href="/api/clouds/2175" rel="self"/>
      <link href="/api/clouds/2175/datacenters" rel="datacenters"/>
      <link href="/api/clouds/2175/instance_types" rel="instance_types"/>
      <link href="/api/clouds/2175/security_groups" rel="security_groups"/>
      <link href="/api/clouds/2175/instances" rel="instances"/>
      <link href="/api/clouds/2175/images" rel="images"/>
      <link href="/api/clouds/2175/volume_attachments" rel="volume_attachments"/>
      <link href="/api/clouds/2175/recurring_volume_attachments" rel="recurring_volume_attachments"/>
      <link href="/api/clouds/2175/volumes" rel="volumes"/>
    </links>
    <cloud_type>google</cloud_type>
    <description>Google Cloud, including Google Compute Engine, Google Cloud Storage, etc.</description>
    <name>Google</name>
  </cloud>
<cloud>
    <links>
      <link href="/api/clouds/2178" rel="self"/>
      <link href="/api/clouds/2178/instance_types" rel="instance_types"/>
      <link href="/api/clouds/2178/instances" rel="instances"/>
      <link href="/api/clouds/2178/images" rel="images"/>
      <link href="/api/clouds/2178/volume_attachments" rel="volume_attachments"/>
      <link href="/api/clouds/2178/recurring_volume_attachments" rel="recurring_volume_attachments"/>
      <link href="/api/clouds/2178/volume_snapshots" rel="volume_snapshots"/>
      <link href="/api/clouds/2178/volumes" rel="volumes"/>
    </links>
    <cloud_type>azure</cloud_type>
    <description>Azure West US</description>
    <name>Azure West US</name>
  </cloud>
. . .
</clouds>

Additional Notes:

  • Several clouds/cloud ID's are included.  RackSpace (232), CloudStack (1537), Google Compute Engine (2175), and Windows Azure (2178)
  • Tip:  To determine the Cloud ID from within the Dash:
    • Click on Clouds > CloudName
    • Click on or hover over any of the cloud's supported resources.  Note the number after the ".../clouds/<CloudID>/..." for the goto URL (typically displayed in the lower left of a browser if you hover over the resource).
    • Important!  Although you can obtain the Cloud ID from the Dashboard, you cannot obtain any of the cloud resources from the UI.  You must query for them using the API.

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.clouds.index

Sample Output

[#<RightApi::ResourceDetail resource_type="cloud", name="Rackspace">,

 #<RightApi::ResourceDetail resource_type="cloud", name="Rackspace UK">,

 #<RightApi::ResourceDetail resource_type="cloud", name="IDC Frontier - Tokyo">,
 #<RightApi::ResourceDetail resource_type="cloud", name="CS 2.2.14 Eng - XenServer">,
 #<RightApi::ResourceDetail resource_type="cloud", name="CS 2.2.14 Eng - VMware">,
 #<RightApi::ResourceDetail resource_type="cloud", name="CS 2.2.14 Eng - KVM">,
 #<RightApi::ResourceDetail resource_type="cloud", name="SoftLayer">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Rackspace Managed">,
 #<RightApi::ResourceDetail resource_type="cloud", name="CS 3.0.2 Eng - KVM">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Google">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Azure West US">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Azure East US">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Azure East Asia">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Azure Southeast Asia">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Azure West Europe">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Azure North Europe">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Rackspace Open Cloud - Chicago">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Openstack Folsom">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Rackspace Private">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Rackspace Open Cloud - London">,
 #<RightApi::ResourceDetail resource_type="cloud", name="Rackspace Open Cloud - Dallas">]

 

PowerShell

Prerequisite:  Example assumes you have previously authenticated and your session cookie for subsequent requests is in 'cookieContainer'.

Example Call

#get cookie container from authentication $cookieContainer
$listCloudsRequest = [System.Net.WebRequest]::Create("https://my.rightscale.com/api/clouds.xml")
$listCloudsRequest.Method = "GET"
$listCloudsRequest.CookieContainer = $cookieContainer
$listCloudsRequest.Headers.Add("X_API_VERSION", "1.5");
[System.Net.WebResponse] $listCloudsResponse = $listCloudsRequest.GetResponse()
$listCloudsResponseStream = $listCloudsResponse.GetResponseStream()
$listCloudsResponseStreamReader = New-Object System.IO.StreamReader -argumentList $listCloudsResponseStream
[string]$listCloudsResponseString = $listCloudsResponseStreamReader.ReadToEnd()
write-host $listCloudsResponseString

Sample Output

<?xml version="1.0" encoding="UTF-8"?>
<clouds>
  <cloud>
    <links>
      <link href="/api/clouds/232" rel="self"/>
      <link href="/api/clouds/232/instance_types" rel="instance_types"/>
      <link href="/api/clouds/232/instances" rel="instances"/>
      <link href="/api/clouds/232/images" rel="images"/>
    </links>
    <cloud_type>rackspace</cloud_type>
    <description>Rackspace cloud</description>
    <name>Rackspace</name>
  </cloud>
  
  . . .   more clouds (truncated output) . . .
  <cloud>
    <links>
      <link href="/api/clouds/2371" rel="self"/>
      <link href="/api/clouds/2371/datacenters" rel="datacenters"/>
      <link href="/api/clouds/2371/instance_types" rel="instance_types"/>
      <link href="/api/clouds/2371/security_groups" rel="security_groups"/>
      <link href="/api/clouds/2371/instances" rel="instances"/>
      <link href="/api/clouds/2371/images" rel="images"/>
      <link href="/api/clouds/2371/ip_addresses" rel="ip_addresses"/>
      <link href="/api/clouds/2371/ip_address_bindings" rel="ip_address_bindings"/>
      <link href="/api/clouds/2371/volume_attachments" rel="volume_attachments"/>
      <link href="/api/clouds/2371/recurring_volume_attachments" rel="recurring_volume_attachments"/>
      <link href="/api/clouds/2371/volume_snapshots" rel="volume_snapshots"/>
      <link href="/api/clouds/2371/volume_types" rel="volume_types"/>
      <link href="/api/clouds/2371/volumes" rel="volumes"/>
    </links>
    <cloud_type>cloud_stack</cloud_type>
    <description></description>
    <name>CS 3.0.6 - XenServer</name>
  </cloud>
  <cloud>
    <links>
      <link href="/api/clouds/2372" rel="self"/>
      <link href="/api/clouds/2372/datacenters" rel="datacenters"/>
      <link href="/api/clouds/2372/instance_types" rel="instance_types"/>
      <link href="/api/clouds/2372/security_groups" rel="security_groups"/>
      <link href="/api/clouds/2372/instances" rel="instances"/>
      <link href="/api/clouds/2372/images" rel="images"/>
      <link href="/api/clouds/2372/ip_addresses" rel="ip_addresses"/>
      <link href="/api/clouds/2372/ip_address_bindings" rel="ip_address_bindings"/>
      <link href="/api/clouds/2372/volume_attachments" rel="volume_attachments"/>
      <link href="/api/clouds/2372/recurring_volume_attachments" rel="recurring_volume_attachments"/>
      <link href="/api/clouds/2372/volume_snapshots" rel="volume_snapshots"/>
      <link href="/api/clouds/2372/volume_types" rel="volume_types"/>
      <link href="/api/clouds/2372/volumes" rel="volumes"/>
    </links>
    <cloud_type>cloud_stack</cloud_type>
    <description></description>
    <name>CS 3.0.6 - KVM</name>
  </cloud>
</clouds>

 

Postman

See the List and Show Assets examples (RightScale API 1.6 Guide:  Appendix A - APEye Tools > Google Chrome Postman Plugin)

You must to post a comment.
Last modified
12:46, 17 Dec 2013

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.