Fetching Deployment Details

Deployments

A deployment is a nested resource on its application or cloud.
The URI looks like this:
/api/applications/<application_id>/deployments for all deployments of an application and /api/applications/<application_id>/deployments/<deployment_id> for an individual application deployment
/api/clouds/<cloud_id>/deployments/<deployment_id> for an individual cloud deployment.

So you'd request an application deployment like that:

RestClient.get('https://manage.scalarium.com/api/applications/71676a3c76e7b599d24edef503ebf1a9/deployments/043784f0a48607d999d1178b0d40038b',
                headers)

The resulting JSON looks like this:

{   
  "id": "043784f0a48607d999d1178b0d40038b",
  "command": "deploy",
  "comment": "", 
  "completed_at": "2011/01/10 10:21:53 +0000",
  "instances": [
    "610a53e71a4baae89d42de7af866913b"
  ],  
  "created_at": "2011/01/10 10:21:22 +0000",
  "migrate": false,
  "shift_between_restarts": "0",
  "application_id": "71676a3c76e7b599d24edef503ebf1a9",
  "cluster_id": "71676a3c76e7b599d24edef503ec003a",
  "updated_at": "2011/01/10 10:21:57 +0000",
  "successful": true,
  "user_id": "2d13d7d55ea6b0959cf408c8738604d3",
  "revision": null,
  "migration_instance_id": null,
  "status": "successful"
}

To get the details on the deployment for a specific instance, add an additional nesting level to provide the instance's ID, so the URI format looks like this: /api/applications/<application_id>/deployments/<deployment_id>/instances/<instance_id>, so a request would look like this:

RestClient.get('https://manage.scalarium.com/api/applications/71676a3c76e7b599d24edef503ebf1a9/deployments/043784f0a48607d999d1178b0d40038b/instances/610a53e71a4baae',
                headers)

The resulting JSON looks like this:

{
  "completed_at": "2011/01/10 10:21:53 +0000",
  "created_at": "2011/01/10 10:21:22 +0000",
  "log_url": "https://scalarium-attachments.s3.amazonaws.com:443/instance_log_items/log/        4861e046a8969b5513075d11fe63679f?                                                                       Signature=<signature>&Expires=1294840268&AWSAccessKeyId=<key>",
  "instance_id": "610a53e71a4baae89d42de7af866913b",
  "updated_at": "2011/01/10 10:21:53 +0000",
  "deployment_id": "043784f0a48607d999d1178b0d40038b",
  "id": "043784f0a48607d999d1178b0d3ff3ef",
  "status": "successful",
  "error": null
}

Apart from the status, probably the most interesting part is the URI pointing to the Chef log. The URI is valid for five minutes, so should it expire, simply re-request the data from the API and you'll receive a fresh URI. You can request this data as soon as the deployment was accepted when created through the API for every instance involved, but the log won't be available until the deployment has finished.

Listing all Deployments

You can also list all recent deployments of an application (max 30). The URI looks like this: /api/applications/<application_id>/deployments, so you'd request it like so:

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