Difference between revisions of "API Special Interest Group/Current Design/Links"
(→Current Design) |
|||
Line 82: | Line 82: | ||
} | } | ||
] | ] | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | == Nova == | ||
+ | |||
+ | [http://developer.openstack.org/api-ref-compute-v2.1.html Nova API reference] | ||
+ | |||
+ | Nova appears to use the JSON Hyper-Schema <ref name="json-hyper-schema" \> for most returned responses. | ||
+ | |||
+ | There are a few responses that use the '''url''' key to describe a link, it is not clear if these are only for external resources. | ||
+ | |||
+ | There are also a few calls which allow the values '''imageRef''' and '''flavorRef''' to accept incoming links. | ||
+ | |||
+ | === Examples === | ||
+ | |||
+ | <pre><nowiki>GET /</nowiki></pre> | ||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "versions": [ | ||
+ | { | ||
+ | "id": "v2.0", | ||
+ | "links": [ | ||
+ | { | ||
+ | "href": "http://openstack.example.com/v2/", | ||
+ | "rel": "self" | ||
+ | } | ||
+ | ], | ||
+ | "status": "SUPPORTED", | ||
+ | "version": "", | ||
+ | "min_version": "", | ||
+ | "updated": "2011-01-21T11:33:21Z" | ||
+ | }, | ||
+ | { | ||
+ | "id": "v2.1", | ||
+ | "links": [ | ||
+ | { | ||
+ | "href": "http://openstack.example.com/v2.1/", | ||
+ | "rel": "self" | ||
+ | } | ||
+ | ], | ||
+ | "status": "CURRENT", | ||
+ | "version": "2.3", | ||
+ | "min_version": "2.1", | ||
+ | "updated": "2013-07-23T11:33:21Z" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | <pre><nowiki>POST /v2.1/{tenant_id}/os-agents</nowiki></pre> | ||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "agent": { | ||
+ | "hypervisor": "hypervisor", | ||
+ | "os": "os", | ||
+ | "architecture": "x86", | ||
+ | "version": "8.0", | ||
+ | "md5hash": "add6bb58e139be103324d04d82d8f545", | ||
+ | "url": "http://example.com/path/to/resource" | ||
+ | } | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "agent": { | ||
+ | "agent_id": 1, | ||
+ | "architecture": "x86", | ||
+ | "hypervisor": "hypervisor", | ||
+ | "md5hash": "add6bb58e139be103324d04d82d8f545", | ||
+ | "os": "os", | ||
+ | "url": "http://example.com/path/to/resource", | ||
+ | "version": "8.0" | ||
+ | } | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | <pre><nowiki>POST /v2.1/{tenant_id}/servers</nowiki></pre> | ||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "server": { | ||
+ | "name": "new-server-test", | ||
+ | "imageRef": "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b", | ||
+ | "flavorRef": "http://openstack.example.com/openstack/flavors/1", | ||
+ | "metadata": { | ||
+ | "My Server Name": "Apache1" | ||
+ | }, | ||
+ | "min_count": "2", | ||
+ | "max_count": "3" | ||
+ | } | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "server": { | ||
+ | "adminPass": "wfksH3GTTseP", | ||
+ | "id": "440cf918-3ee0-4143-b289-f63e1d2000e6", | ||
+ | "links": [ | ||
+ | { | ||
+ | "href": "http://openstack.example.com/v2.1/servers/440cf918-3ee0-4143-b289-f63e1d2000e6", | ||
+ | "rel": "self" | ||
+ | }, | ||
+ | { | ||
+ | "href": "http://openstack.example.com/servers/440cf918-3ee0-4143-b289-f63e1d2000e6", | ||
+ | "rel": "bookmark" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
} | } | ||
</nowiki></pre> | </nowiki></pre> |
Revision as of 19:24, 13 October 2015
Analysis
How are links being referenced in OpenStack APIs
Current Design
Cinder
Cinder appears to use the JSON Hyper-Schema [1] for all embedded link references.
Examples
GET /
{ "versions": [ { "status": "CURRENT", "updated": "2012-01-04T11:33:21Z", "id": "v1.0", "links": [ { "href": "http://23.253.228.211:8776/v1/", "rel": "self" } ] }, { "status": "CURRENT", "updated": "2012-11-21T11:33:21Z", "id": "v2.0", "links": [ { "href": "http://23.253.228.211:8776/v2/", "rel": "self" } ] } ] }
GET /v2/{tenant_id}/volumes
{ "volumes": [ { "id": "45baf976-c20a-4894-a7c3-c94b7376bf55", "links": [ { "href": "http://localhost:8776/v2/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/45baf976-c20a-4894-a7c3-c94b7376bf55", "rel": "self" }, { "href": "http://localhost:8776/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/45baf976-c20a-4894-a7c3-c94b7376bf55", "rel": "bookmark" } ], "name": "vol-004" }, { "id": "5aa119a8-d25b-45a7-8d1b-88e127885635", "links": [ { "href": "http://localhost:8776/v2/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/5aa119a8-d25b-45a7-8d1b-88e127885635", "rel": "self" }, { "href": "http://localhost:8776/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/5aa119a8-d25b-45a7-8d1b-88e127885635", "rel": "bookmark" } ], "name": "vol-003" } ] }
Nova
Nova appears to use the JSON Hyper-Schema <ref name="json-hyper-schema" \> for most returned responses.
There are a few responses that use the url key to describe a link, it is not clear if these are only for external resources.
There are also a few calls which allow the values imageRef and flavorRef to accept incoming links.
Examples
GET /
{ "versions": [ { "id": "v2.0", "links": [ { "href": "http://openstack.example.com/v2/", "rel": "self" } ], "status": "SUPPORTED", "version": "", "min_version": "", "updated": "2011-01-21T11:33:21Z" }, { "id": "v2.1", "links": [ { "href": "http://openstack.example.com/v2.1/", "rel": "self" } ], "status": "CURRENT", "version": "2.3", "min_version": "2.1", "updated": "2013-07-23T11:33:21Z" } ] }
POST /v2.1/{tenant_id}/os-agents
{ "agent": { "hypervisor": "hypervisor", "os": "os", "architecture": "x86", "version": "8.0", "md5hash": "add6bb58e139be103324d04d82d8f545", "url": "http://example.com/path/to/resource" } }
{ "agent": { "agent_id": 1, "architecture": "x86", "hypervisor": "hypervisor", "md5hash": "add6bb58e139be103324d04d82d8f545", "os": "os", "url": "http://example.com/path/to/resource", "version": "8.0" } }
POST /v2.1/{tenant_id}/servers
{ "server": { "name": "new-server-test", "imageRef": "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b", "flavorRef": "http://openstack.example.com/openstack/flavors/1", "metadata": { "My Server Name": "Apache1" }, "min_count": "2", "max_count": "3" } }
{ "server": { "adminPass": "wfksH3GTTseP", "id": "440cf918-3ee0-4143-b289-f63e1d2000e6", "links": [ { "href": "http://openstack.example.com/v2.1/servers/440cf918-3ee0-4143-b289-f63e1d2000e6", "rel": "self" }, { "href": "http://openstack.example.com/servers/440cf918-3ee0-4143-b289-f63e1d2000e6", "rel": "bookmark" } ] } }