The addresses collection represents IP addresses and allows IP address management.
This collection is currently implemented for Amazon EC2 and Fujitsu GCP drivers. For EC2, IP address management corresponds to Amazon's 'Elastic IP' feature.
The addresses collection supports these operations:
To retrieve a list of all addresses use call GET /api/addresses.
Example request:
GET /api/addresses?format=xml HTTP/1.1 Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa== User-Agent: curl/7.20.1 (i386-redhat-linux-gnu) Host: localhost:3001 Accept: */*
Server response:
HTTP/1.1 200 OK Content-Type: application/xml Date: Wed, 27 Jul 2011 12:55:16 GMT Content-Length: 817 <?xml version='1.0' encoding='utf-8' ?> <addresses> <address href='http://localhost:3001/api/addresses/107.20.232.251' id='107.20.232.251'> <ip>107.20.232.251</ip> <actions> <link href='http://localhost:3001/api/addresses/107.20.232.251' method='delete' rel='destroy' /> <link href='http://localhost:3001/api/addresses/107.20.232.251/associate' method='post' rel='associate' /> </actions> </address> <address href='http://localhost:3001/api/addresses/107.20.234.161' id='107.20.234.161'> <ip>107.20.234.161</ip> <actions> <link href='http://localhost:3001/api/addresses/107.20.234.161' method='delete' rel='destroy' /> <link href='http://localhost:3001/api/addresses/107.20.234.161/associate' method='post' rel='associate' /> </actions> </address> </addresses>
To retrieve details for a specific address use call GET /api/addresses/:id.
Example request:
GET /api/addresses/107.20.232.251?format=xml HTTP/1.1 Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa== User-Agent: curl/7.20.1 (i386-redhat-linux-gnu) Host: localhost:3001 Accept: */*
Server response:
HTTP/1.1 200 OK Content-Type: application/xml Date: Wed, 27 Jul 2011 12:57:27 GMT Content-Length: 402 <?xml version='1.0' encoding='utf-8' ?> <address href='http://localhost:3001/api/addresses/107.20.232.251' id='107.20.232.251'> <ip>107.20.232.251</ip> <actions> <link href='http://localhost:3001/api/addresses/107.20.232.251' method='delete' rel='destroy' /> <link href='http://localhost:3001/api/addresses/107.20.232.251/associate' method='post' rel='associate' /> </actions> </address>
To create a new address use call POST /api/addresses. The Deltacloud server will respond with HTTP 201 Created and provide the details of the new address after a succesful operation:
Example request:
POST /api/addresses?format=xml HTTP/1.1 Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa== User-Agent: curl/7.20.1 (i386-redhat-linux-gnu) Host: localhost:3001 Accept: */*
Server response:
HTTP/1.1 201 Created Content-Type: application/xml Content-Length: 388 <?xml version='1.0' encoding='utf-8' ?> <address href='http://localhost:3001/api/addresses/107.20.232.251' id='107.20.232.251'> <ip>107.20.232.251</ip> <actions> <link href='http://localhost:3001/api/addresses/107.20.232.251' method='delete' rel='destroy' /> <link href='http://localhost:3001/api/addresses/107.20.232.251/associate' method='post' rel='associate' /> </actions> </address>
To delete a specified address use call DELETE /api/addresses/:id. The Deltacloud server responds with a HTTP 204 No Content after a succesful operation.
Example request:
DELETE /api/addresses/107.20.232.251?format=xml HTTP/1.1 Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa== User-Agent: curl/7.20.1 (i386-redhat-linux-gnu) Host: localhost:3001 Accept: */*
Server response:
HTTP/1.1 204 No Content Date: Wed, 27 Jul 2011 13:29:00 GMT
To associate a given address with a running instance use call POST /api/addresses/:id/associate. The client must specify the instance_id as a parameter to this call. For Amazon EC2, the specified address will replace the currently assigned public_address of the instance, while for the Fujitsu GCP it is added. A succesful operation results in a HTTP 202 Accepted response. The example client request below specifies the required instance_id parameter using the application/x-www-form-urlencoded content-type, however client can also use multipart/form-data.
Example request:
POST /api/addresses/107.20.232.251/associate?format=xml HTTP/1.1 Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa== User-Agent: curl/7.20.1 (i386-redhat-linux-gnu) Host: localhost:3001 Accept: */* Content-Length: 22 Content-Type: application/x-www-form-urlencoded instance_id=i-9d8a3dfc
Server response:
HTTP/1.1 202 Accepted Content-Type: application/xml Date: Wed, 27 Jul 2011 13:01:11 GMT Content-Length: 0
To disassociate a given address from the instance to which it is currently assigned use call POST /api/addresses/:id/disassociate.
Example request:
POST /api/addresses/107.20.232.251/disassociate?format=xml HTTP/1.1 Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa== User-Agent: curl/7.20.1 (i386-redhat-linux-gnu) Host: localhost:3001 Accept: */*
Server response:
HTTP/1.1 202 Accepted Content-Type: application/xml Date: Wed, 27 Jul 2011 13:05:38 GMT Content-Length: 0