Listing Applications, Clouds, Roles and Instances

Applications

You can get a list of all the applications in your account by requesting /api/applications, we'll leave out the standard headers (token and accept type) for brevity and assume they were assigned to a local variable called headers, see Fundamentals and Authentication on how to specify them

RestClient.get("https://manage.scalarium.com/api/applications', headers)

Clouds

You can get a list of all the clouds in your account by requesting /api/clouds

RestClient.get("https://manage.scalarium.com/api/clouds', headers)

To get the details for a specific cloud, pick its 'id' attribute from the list returned by the call above and request:

RestClient.get("https://manage.scalarium.com/api/clouds/58241eff9ef684d91b459adf7deb7899", headers)

The resulting JSON looks like this:

{
  "id":"58241eff9ef684d91b459adf7deb7899",
  "name":"Photopoll",
  "region":"eu-west-1",
  "nickname_theme":"Clouds",
  "created_at":"2010/03/25 19:49:44 +0000",
  "updated_at":"2011/01/07 12:28:41 +0000",
  "custom_json":"",
  "use_custom_cookbooks":true,
  "scm_user":"",
  "scm_password":"",
  "scm_type":"git",
  "scm_url":"git://github.com/scalarium/example-cookbooks.git",
  "scm_ssh_key":"",
  "scm_revision":""
  "account_id":"c438a7a26d931577ed676e8670694de5",
  "user_id":"2d13d7d55ea6b0959cf408c8738604d3",
  "ssh_key_id":"712438707f6da1f5579d9c6abf118bfa",
  "credential_id":"8b033cb62355e9f82040f0cb5bdb4277",
}

Roles

To list all roles, request /api/clouds/<cloud_id>/roles:

RestClient.get("https://manage.scalarium.com/api/clouds/58241eff9ef684d91b459adf7deb7899/roles", headers)

The resulting JSON is a list of all the roles in the specified cloud:

[
  {
    "id":"0721a85e9ac99c43f8c9cc355fe82340",
    "name": "Database Master",
    "shortname": "db-master",
    "role_type": "db-master",
    "disable_auto_healing": null,
    "cluster_id": "58241eff9ef684d91b459adf7deb7899",
    "custom_recipes_setup": [],
    "packages": [],
    "ebs_volumes": {
      "/vol/mysql": {
        "size": 10,
        "number_of_disks": 1,
        "raid_level": null
      }
    },
    "gems": {},
    "created_at": "2010/03/25 19:50:48 +0000",
    "updated_at": "2011/01/06 12:22:49 +0000",
    "mysql_debian_sys_maint_password": null,
    "haproxy_stats_user": "scalarium",
    "haproxy_health_check_url": "/",
    "instance_view_preference": "box",
    "ganglia_url": "/ganglia",
    "ganglia_user": "scalarium",
    "ganglia_password": "l7buot5s5p",
    "needs_memcached_memory": null,
    "memcached_memory": 512,
    "auto_assign_elastic_ips": false,
    "enable_haproxy_stats": null,
    "haproxy_stats_url": "/haproxy?stats",
    "needs_haproxy_stats_password": null,
    "haproxy_stats_password": "kwbwji9mpn",
    "haproxy_health_check_method": "OPTIONS",
    "mysql_root_password": "xgi2mm6186",
    "mysql_engine": "mysql",
    "custom_recipes_undeploy": []
    "custom_recipes_configure": [],
    "custom_recipes_deploy": [],
  }
]

There's a bit of noise in there, because we keep a lot of attributes on a role, but the gist of the important attributes should be easy to grasp.

Instances of a cloud

Moving on to instances, here\'s how to list all the instances of a cloud, just request /api/clouds/<cloud_id>/instances:

RestClient.get("https://manage.scalarium.com/api/clouds/58241eff9ef684d91b459adf7deb7899/instances",
               headers)

This is an example of what you\'ll get:

[
  {
    "id": "fcadba9b3002d2b3700dd0c70404b843",
    "availability_zone": "eu-west-1a",
    "reservation_id": "r-f0f1c687",
    "dns_name": "ec2-46-137-9-227.eu-west-1.compute.amazonaws.com",
    "instance_type": "c1.medium",
    "private_dns_name": "ip-10-228-213-139.eu-west-1.compute.internal",
    "ami_id": "ami-bb416bcf",
    "status": "online",
    "role_ids": [
      "bbbadba9b3002d2b3700dd0c70404bbbb", 
      "aaadba9b3002d2b3700dd0c70404b111"
    ],
    "security_groups": [
      "Scalarium-Rails-App-Server",
      "Scalarium-DB-Master-Server"
    ]
    "last_command": "start",
    "elastic_ip_id": null,
    "cluster_id": "58241eff9ef684d91b459adf7deb7899",
    "auto_deploy_on_boot": true,
    "created_at": "2010/12/22 11:21:26 +0000",
    "updated_at": "2011/01/11 15:46:14 +0000",
    "running_since": "2011/01/11 15:46:14 +0000",
    "auto_scaling_type": null,
    "nickname": "perlucidus",
    "instance_id": "i-9aeff8ed",
    "status_before_offline": null,
    "freeze_configuration": null,
    "ssh_key_id": "712438707f6da1f5579d9c6abf118bfa",
  }
]

You can also ask for the details of just one instance, just specify the ID for the request in the form of /api/clouds/<cloud_id>/instances/<instance_id>.

RestClient.get("https://manage.scalarium.com/api/clouds/58241eff9ef684d91b459adf7deb7899/instances/fcadba9b3002d2b3700dd0c70404b843",
               headers)

Result includes just a single hash of the instance\'s data.

Instances of a role

You can also just request the instances of a specific role: request /api/clouds/<cloud_id>/roles/<role_id>/instances:

RestClient.get("https://manage.scalarium.com/api/clouds/58241eff9ef684d91b459adf7deb7899/roles/bbbadba9b3002d2b3700dd0c70404bbbb/instances",
               headers)

This is an example of what you\'ll get:

[
  {
    "id": "fcadba9b3002d2b3700dd0c70404b843",
    "availability_zone": "eu-west-1a",
    "reservation_id": "r-f0f1c687",
    "dns_name": "ec2-46-137-9-227.eu-west-1.compute.amazonaws.com",
    "instance_type": "c1.medium",
    "private_dns_name": "ip-10-228-213-139.eu-west-1.compute.internal",
    "ami_id": "ami-bb416bcf",
    "status": "online",
    "role_ids": [
      "bbbadba9b3002d2b3700dd0c70404bbbb", 
      "aaadba9b3002d2b3700dd0c70404b111"
    ],
    "security_groups": [
      "Scalarium-Rails-App-Server",
      "Scalarium-DB-Master-Server"
    ]
    "last_command": "start",
    "elastic_ip_id": null,
    "cluster_id": "58241eff9ef684d91b459adf7deb7899",
    "auto_deploy_on_boot": true,
    "created_at": "2010/12/22 11:21:26 +0000",
    "updated_at": "2011/01/11 15:46:14 +0000",
    "running_since": "2011/01/11 15:46:14 +0000",
    "auto_scaling_type": null,
    "nickname": "perlucidus",
    "instance_id": "i-9aeff8ed",
    "status_before_offline": null,
    "freeze_configuration": null,
    "ssh_key_id": "712438707f6da1f5579d9c6abf118bfa",
  }
]

The data is the same as if asking for all instances of a cloud, just limited to the instances of this specific role.