Provider API

Contents

/providers or /providers/{id} (GET)

Description

Gets a list of all providers or a single provider.

URL structure

https://smart.cloud.com/v0/providers?access_token=<valid access token>

URL example

https://smart.cloud.com/v0/providers?access_token=yVWQ5Gdus43Gm7XOh34AHgPhp

Method

GET

Sample response:

[  
   {  
      "provider_id":"529",
      "costing_enabled":"Y",
      "provider_code":"ec2",
      "provider_name":"Amazon"
   },
   {  
      "provider_id":"549",
      "costing_enabled":"Y",
      "provider_code":"ec2",
      "provider_name":"ec2..."
   },
   {  
      "provider_id":"1530",
      "costing_enabled":"Y",
      "provider_code":"ec2",
      "provider_name":"Ecee"
   },
   {  
      "provider_id":"1590",
      "costing_enabled":"N",
      "provider_code":"ec2",
      "provider_name":"My EC2 Account"
   },
   {  
      "provider_id":"1818",
      "costing_enabled":"N",
      "provider_code":"ec2",
      "provider_name":"RESTEC2"
   }
]        

Back to top

/providers or /providers/{id} (POST)

Description

Creates or updates a provider.

URLstructure

https://smart.cloud.com/v0/providers?access_token=<valid access token>

URL example

https://smart.cloud.com/v0/providers?access_token=TWkUt0YM116MKUsH3o0FOcc7o' -d "name=xen-test&providercode=xenserver&server=http://10.22.22.22&username=root&password=xspass&agentId=11495

Method

POST

Parameters

Parameter Name Required or Optional Description Applicable Providers
name Required The name of the provider account. Example: SmartToolsEC2 All supported providers
providerCode Required The provider code for the cloud provider you want to create or update. Valid values:
  • Amazon EC2: ec2
  • Rackspace: rackspace
  • OpenStack: openstack
  • Bluelock: bluelock
  • vCloud: vcloud
  • CloudStack: cloudstack
  • Dell Cloud: dellcloud
  • Terremark Cloud: trmkecloud
  • Savvis Cloud: savvis
  • The Cloud NZ: thecloud
  • HP Cloud: hpcloud
All supported providers
keyID Required The access key ID for the cloud provider account you want to use with Smart Tools.
  • Amazon EC2
  • Rackspace
accessKey Required The secret access key for the cloud provider account you want to use with Smart Tools.
  • Amazon EC2
  • Rackspace
region Required The region in which the cloud provider will provision machines when deploying blueprints.
  • Amazon EC2
  • Rackspace
username Required The user name for the cloud provider account you want to use with Smart Tools.
  • CloudStack
  • Citrix XenServer
password Required The password for the cloud provider account you want to use with Smart Tools.
  • CloudStack
  • Citrix XenServer
server Required  
  • CloudStack
  • Citrix XenServer
agentId Optional The ID of the agent installed on the machine acting as a connector. Citrix XenServer

 

Example: Create an Amazon EC2 provider

curl  -d "name=RESTEC2&providercode=ec2&keyId=AKIAIH6EK3Z3MQYHOQ3Q&accessKey=QNdzpUuGBe/OHEiGWzZzzRA1hTaVK2b0qmnMeMQA&region=someregion" -k 'https://smart.cloud.com/v0/providers?access_token=<valid access token>' 

curl -v 'https://smart.cloud.com/v0/providers?access_token=TWkUt0YM116MKUsH3o0FOcc7o' -d "name=xen-test&providercode=xenserver&server=http://10.22.22.22&username=root&password=xspass&agentId=11495" 

Response

JSON payload

Sample response:

{
   "id":"1818",
   "provider":"ec2"
}

Back to top

/providers/{id} 

Description

Deletes a provider.

URL structure

https://smart.cloud.com/v0/providers/<id>?access_token=<valid access token>

URL example

https://smart.cloud.com/v0/providers/1818?access_token=yVWQ5Gdus43Gm7XOh34AHgPhp

Method

DELETE

Response

JSON string

Sample response:

{  
   "id":"1818"
}

Back to top

/providers/{id}/servers 

Description

Gets a list of all servers for a single provider.

URL structure

https://smart.cloud.com/v0/providers/<id>/servers?access_token=<valid access token>

URL example

https://smart.cloud.com/v0/providers/463/servers?access_token=yVWQ5Gdus43Gm7XOh34AHgPhp

Method

GET

Sample Response:

[
   {
      "tags":{
         "Name":"RPM Cooker - 32 bit",
         "type":"rpm cooker 32 bit"
      },
      "regionCode":"ec2.us-east-1.amazonaws.com",
      "platform":"",
      "privateKey":"private_key_8d0c87ccd4f7f0ca82c6b8a5b8e851da",
      "statusName":"running",
      "regionName":"US East (Virginia)",
      "flavor":"t1.micro",
      "dnsName":"ec2-50-17-202-152.compute-1.amazonaws.com",
      "userRole":null,
      "normalized_name":"i-3680ea59",
      "ip":"50.17.202.152",
      "orgId":null,
      "statusCode":"16",
      "id":"i-3680ea59",
      "disableApiTermination":1,
      "imageId":"ami-78b04c11",
      "keyName":"karthik_EC2",
      "launchTime":"2012-08-20T19:58:19.000Z",
      "monitoringState":"",
      "userId":null,
      "name":"i-3680ea59",
      "spotInstanceRequestId":""
   },
   {
      "tags":{
         "Name":"debian cooker - 32 bit"
      },
      "regionCode":"ec2.us-east-1.amazonaws.com",
      "platform":"",
      "privateKey":"private_key_8d0c87ccd4f7f0ca82c6b8a5b8e851da",
      "statusName":"running",
      "regionName":"US East (Virginia)",
      "flavor":"t1.micro",
      "dnsName":"ec2-54-242-43-228.compute-1.amazonaws.com",
      "userRole":null,
      "normalized_name":"i-9d68d8f3",
      "ip":"54.242.43.228",
      "orgId":null,
      "statusCode":"16",
      "id":"i-9d68d8f3",
      "disableApiTermination":1,
      "imageId":"ami-0ce41865",
      "keyName":"karthik_EC2",
      "launchTime":"2012-08-20T19:58:19.000Z",
      "monitoringState":"",
      "userId":null,
      "name":"i-9d68d8f3",
      "spotInstanceRequestId":""
   },
]

Back to top

/providers/{id}/servers/{serverid} 

Description

Performs an action on a server. 

URL structure

https://smart.cloud.com/v0/providers/<id>/servers/<serverid>?access_token=<valid access token>

URL example

https://smart.cloud.com/v0/providers/463/servers/i-9800f9e6?access_token=yVWQ5Gdus43Gm7XOh34AHgPhp

Method

POST

Parameters

Name Required or Optional Description
action Required Supported values:
  • poweron
  • poweroff
  • reboot
  • delete
regioncode Required The cloud provider endpoint that you want to use. For example, to specify a machine in the US East (N. Virginia) region of Amazon EC2, you specify the endpoint ec2.us-east-1.amazonaws.com. For a list of Amazon EC2 regions and endpoints, see http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region.

 Example: Power off a machine on Amazon EC2

 curl -d "action=poweroff&regioncode=ec2.us-east-1.amazonaws.com" -k  'https://smart.cloud.com/v0/providers/463/servers/i-9800f9e6?access_token=<valid access token>

Response

JSON Payload

Sample response:

{
   "result":"OK"
}

Back to top

0 Comments