Merge "Tested samples against Trystack; added more samples"

This commit is contained in:
Jenkins
2015-01-13 14:13:30 +00:00
committed by Gerrit Code Review
6 changed files with 376 additions and 110 deletions

View File

@@ -42,14 +42,14 @@
</thead>
<tbody>
<tr>
<td>username (Optional)</td>
<td>username (required)</td>
<td>xsd:string</td>
<td>The user name. If you do not provide a
user name and password, you must provide a
token.</td>
</tr>
<tr>
<td>password (Optional)</td>
<td>password (required)</td>
<td>xsd:string</td>
<td>The password for the user.</td>
</tr>
@@ -70,12 +70,14 @@
<td>capi:UUID</td>
<td>The tenant ID. Both the
<parameter>tenantId</parameter> and
<parameter>tenantName</parameter> are
optional, but should not be specified
together. If both attributes are
specified, the server responds with a
<parameter>tenantName</parameter> are optional,
but should not be specified together. If both
attributes are specified, the server responds with a
<errorcode>400</errorcode>
<errorname>Bad Request</errorname>.</td>
<errorname>Bad Request</errorname>. If you do not
know the tenantId, you can send a request with ""
for the tenantId and get the ID returned to you in
the response.</td>
</tr>
<tr>
<td>token (Optional)</td>
@@ -116,7 +118,11 @@
<para>For a typical OpenStack deployment that runs
Identity, use a cURL command like the following
command to request a token:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -i 'http://127.0.0.1:5000/v2.0/tokens' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "secretsecret"}}}'</userinput></screen>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -s -X POST http://8.21.28.222:5000/v2.0/tokens \
-H "Content-Type: application/json" \
-d '{"auth": {"tenantName": "$OS_TENANT_NAME", "passwordCredentials":
{"username": "$OS_USERNAME", "password": "$OS_PASSWORD"}}}' \
| python -m json.tool</userinput></screen>
<para>If the request succeeds, you receive a <returnvalue>200
OK</returnvalue> response followed by a response body
that contains a token in the form
@@ -125,39 +131,37 @@
<code>"expires":"<replaceable>datetime</replaceable>"</code>.</para>
<para>The following example shows a successful
response:</para>
<screen><?db-font-size 75%?><computeroutput>HTTP/1.1 200 OK
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 5858
Date: Wed, 06 Nov 2013 20:06:24 GMT</computeroutput></screen>
<programlisting language="json"><?db-font-size 60%?><xi:include href="get_credentials_resp.json" parse="text"/></programlisting>
<note>
<para>If you do not know your tenant name or ID, you can
send an authentication request with an empty tenant,
send an authentication request with an empty tenantName,
as follows:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -i 'http://127.0.0.1:5000/v2.0/tokens' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"auth": {"tenantName": "", "passwordCredentials": {"username": "admin", "password": "secretsecret"}}}'</userinput></screen>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -s -X POST http://8.21.28.222:5000/v2.0/tokens \
-H "Content-Type: application/json" \
-d '{"auth": {"tenantName": "", "passwordCredentials":
{"username": "$OS_USERNAME", "password": "$OS_PASSWORD"}}}' \
| python -m json.tool</userinput></screen>
</note>
</section>
<section xml:id="send-api-requests">
<title>Send API requests</title>
<para>This section shows how to make some Identity API and
Compute API calls. For a complete list of Identity
API calls, see <link
xlink:href="http://developer.openstack.org/api-ref-identity-v3.html"
>Identity APIs</link>. For a complete list of
<para>This section shows how to make some basic
Compute API calls. For a complete list of
Compute API calls, see <link
xlink:href="http://developer.openstack.org/api-ref-compute-v2.html"
>Compute APIs and Extensions</link>.</para>
<para>Use the Identity API to request a list of
tenants, as follows:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -i -X GET http://166.78.21.23:35357/v2.0/tenants -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: <replaceable>token</replaceable>"</userinput></screen>
<programlisting language="json"><?db-font-size 60%?><xi:include href="tenants_list_resp.json" parse="text"/></programlisting>
<para>Use the Identity API to request a list of
endpoints, as follows:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -i -X GET http://166.78.21.23:35357/v2.0/endpoints -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: <replaceable>token</replaceable>"</userinput></screen>
<programlisting language="json"><?db-font-size 60%?><xi:include href="endpoints-list-resp.json" parse="text"/></programlisting>
<para>Use the Compute API to list flavors, as follows:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -i -H
"X-Auth-Token:<replaceable>token</replaceable>"
http://8.21.28.222:8774/v2/<replaceable>tenant_id</replaceable>/flavors</userinput></screen>
<programlisting><?db-font-size 60%?><xi:include href="flavors-post-resp.json" parse="text"/></programlisting>
<para>Use the Compute API to list images, as follows:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -i -H
"X-Auth-Token:<replaceable>token</replaceable>"
http://8.21.28.222:8774/v2/<replaceable>tenant_id</replaceable>/images</userinput></screen>
<programlisting><?db-font-size 60%?><xi:include href="images-post-resp.json" parse="text"/></programlisting>
<para>Use the Compute API to list servers, as follows:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -v -H "X-Auth-Token:<replaceable>token</replaceable>" http://208.123.85.197:8774/v2/<replaceable>tenant_id</replaceable>/servers</userinput></screen>
<programlisting><?db-font-size 60%?><xi:include href="server-post-resp.json" parse="text"/></programlisting>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>curl -i -H "X-Auth-Token:<replaceable>token</replaceable>" http://8.21.28.222:8774/v2/<replaceable>tenant_id</replaceable>/servers</userinput></screen>
<programlisting><?db-font-size 60%?><xi:include href="servers-post-resp.json" parse="text"/></programlisting>
</section>
</section>

View File

@@ -0,0 +1,74 @@
{
"flavors": [
{
"id": "1",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/flavors/1",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/flavors/1",
"rel": "bookmark"
}
],
"name": "m1.tiny"
},
{
"id": "2",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/flavors/2",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/flavors/2",
"rel": "bookmark"
}
],
"name": "m1.small"
},
{
"id": "3",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/flavors/3",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/flavors/3",
"rel": "bookmark"
}
],
"name": "m1.medium"
},
{
"id": "4",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/flavors/4",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/flavors/4",
"rel": "bookmark"
}
],
"name": "m1.large"
},
{
"id": "5",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/flavors/5",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/flavors/5",
"rel": "bookmark"
}
],
"name": "m1.xlarge"
}
]
}

View File

@@ -1,118 +1,205 @@
{
"access": {
"token": {
"issued_at": "2013-11-06T20:06:24.113908",
"expires": "2013-11-07T20:06:24Z",
"id": "{token}",
"tenant": {
"description": null,
"enabled": true,
"id": "604bbe45ac7143a79e14f3158df67091",
"name": "admin"
}
"metadata": {
"is_admin": 0,
"roles": [
"9fe2ff9ee4384b1894a90878d3e92bab"
]
},
"serviceCatalog": [
{
"endpoints": [
{
"adminURL": "http://166.78.21.23:8774/v2/604bbe45ac7143a79e14f3158df67091",
"region": "RegionOne",
"internalURL": "http://166.78.21.23:8774/v2/604bbe45ac7143a79e14f3158df67091",
"id": "9851cb538ce04283b770820acc24e898",
"publicURL": "http://166.78.21.23:8774/v2/604bbe45ac7143a79e14f3158df67091"
"adminURL": "http://10.100.0.222:8774/v2/TENANT_ID",
"id": "0eb78b6d3f644438aea327d9c57b7b5a",
"internalURL": "http://10.100.0.222:8774/v2/TENANT_ID",
"publicURL": "http://8.21.28.222:8774/v2/TENANT_ID",
"region": "RegionOne"
}
],
"endpoints_links": [],
"type": "compute",
"name": "nova"
"name": "nova",
"type": "compute"
},
{
"endpoints": [
{
"adminURL": "http://166.78.21.23:3333",
"region": "RegionOne",
"internalURL": "http://166.78.21.23:3333",
"id": "0bee9a113d294dda86fc23ac22dce1e3",
"publicURL": "http://166.78.21.23:3333"
"adminURL": "http://10.100.0.222:9696/",
"id": "3f4b6015a2f9481481ca03dace8acf32",
"internalURL": "http://10.100.0.222:9696/",
"publicURL": "http://8.21.28.222:9696/",
"region": "RegionOne"
}
],
"endpoints_links": [],
"type": "s3",
"name": "s3"
"name": "neutron",
"type": "network"
},
{
"endpoints": [
{
"adminURL": "http://166.78.21.23:9292",
"region": "RegionOne",
"internalURL": "http://166.78.21.23:9292",
"id": "4b6e9ece7e25479a8f7bb07eb58845af",
"publicURL": "http://166.78.21.23:9292"
"adminURL": "http://10.100.0.222:8776/v2/TENANT_ID",
"id": "16f6416588f64946bdcdf4a431a8f252",
"internalURL": "http://10.100.0.222:8776/v2/TENANT_ID",
"publicURL": "http://8.21.28.222:8776/v2/TENANT_ID",
"region": "RegionOne"
}
],
"endpoints_links": [],
"type": "image",
"name": "glance"
"name": "cinder_v2",
"type": "volumev2"
},
{
"endpoints": [
{
"adminURL": "http://166.78.21.23:8776/v1/604bbe45ac7143a79e14f3158df67091",
"region": "RegionOne",
"internalURL": "http://166.78.21.23:8776/v1/604bbe45ac7143a79e14f3158df67091",
"id": "221a2df63537400e929c0ce7184c5d68",
"publicURL": "http://166.78.21.23:8776/v1/604bbe45ac7143a79e14f3158df67091"
"adminURL": "http://10.100.0.222:8779/v1.0/TENANT_ID",
"id": "be48765ae31e425cb06036b1ebab694a",
"internalURL": "http://10.100.0.222:8779/v1.0/TENANT_ID",
"publicURL": "http://8.21.28.222:8779/v1.0/TENANT_ID",
"region": "RegionOne"
}
],
"endpoints_links": [],
"type": "volume",
"name": "cinder"
"name": "trove",
"type": "database"
},
{
"endpoints": [
{
"adminURL": "http://166.78.21.23:8773/services/Admin",
"region": "RegionOne",
"internalURL": "http://166.78.21.23:8773/services/Cloud",
"id": "356f334fdb7045f7a35b0eebe26fca53",
"publicURL": "http://166.78.21.23:8773/services/Cloud"
"adminURL": "http://10.100.0.222:9292",
"id": "1adfcb5414304f3596fb81edb2dfb514",
"internalURL": "http://10.100.0.222:9292",
"publicURL": "http://8.21.28.222:9292",
"region": "RegionOne"
}
],
"endpoints_links": [],
"type": "ec2",
"name": "ec2"
"name": "glance",
"type": "image"
},
{
"endpoints": [
{
"adminURL": "http://166.78.21.23:35357/v2.0",
"region": "RegionOne",
"internalURL": "http://166.78.21.23:5000/v2.0",
"id": "10f3816574c14a5eb3d455b8a72dc9b0",
"publicURL": "http://166.78.21.23:5000/v2.0"
"adminURL": "http://10.100.0.222:8774/v3",
"id": "14187733d29845e5993d9b4e0f2df4fc",
"internalURL": "http://10.100.0.222:8774/v3",
"publicURL": "http://8.21.28.222:8774/v3",
"region": "RegionOne"
}
],
"endpoints_links": [],
"type": "identity",
"name": "keystone"
"name": "novav3",
"type": "computev3"
},
{
"endpoints": [
{
"adminURL": "http://10.100.0.222:8777",
"id": "350f3b91d73f4b3ab8a061c94ac31fbb",
"internalURL": "http://10.100.0.222:8777",
"publicURL": "http://8.21.28.222:8777",
"region": "RegionOne"
}
],
"endpoints_links": [],
"name": "ceilometer",
"type": "metering"
},
{
"endpoints": [
{
"adminURL": "http://10.100.0.222:8000/v1/",
"id": "2198b0d32a604e75a5cc1e13276a813d",
"internalURL": "http://10.100.0.222:8000/v1/",
"publicURL": "http://8.21.28.222:8000/v1/",
"region": "RegionOne"
}
],
"endpoints_links": [],
"name": "heat-cfn",
"type": "cloudformation"
},
{
"endpoints": [
{
"adminURL": "http://10.100.0.222:8776/v1/TENANT_ID",
"id": "7c193c4683d849ca8e8db493722a4d8c",
"internalURL": "http://10.100.0.222:8776/v1/TENANT_ID",
"publicURL": "http://8.21.28.222:8776/v1/TENANT_ID",
"region": "RegionOne"
}
],
"endpoints_links": [],
"name": "cinder",
"type": "volume"
},
{
"endpoints": [
{
"adminURL": "http://10.100.0.222:8773/services/Admin",
"id": "11fac8254be74d7d906110f0069e5748",
"internalURL": "http://10.100.0.222:8773/services/Cloud",
"publicURL": "http://8.21.28.222:8773/services/Cloud",
"region": "RegionOne"
}
],
"endpoints_links": [],
"name": "nova_ec2",
"type": "ec2"
},
{
"endpoints": [
{
"adminURL": "http://10.100.0.222:8004/v1/TENANT_ID",
"id": "38fa4f9afce34d4ca0f5e0f90fd758dd",
"internalURL": "http://10.100.0.222:8004/v1/TENANT_ID",
"publicURL": "http://8.21.28.222:8004/v1/TENANT_ID",
"region": "RegionOne"
}
],
"endpoints_links": [],
"name": "heat",
"type": "orchestration"
},
{
"endpoints": [
{
"adminURL": "http://10.100.0.222:35357/v2.0",
"id": "256cdf78ecb04051bf0f57ec11070222",
"internalURL": "http://10.100.0.222:5000/v2.0",
"publicURL": "http://8.21.28.222:5000/v2.0",
"region": "RegionOne"
}
],
"endpoints_links": [],
"name": "keystone",
"type": "identity"
}
],
"token": {
"audit_ids": [
"gsjrNoqFSQeuLUo0QeJprQ"
],
"expires": "2014-12-15T15:09:29Z",
"id": "TOKEN_ID",
"issued_at": "2014-12-15T14:09:29.794527",
"tenant": {
"description": "Auto created account",
"enabled": true,
"id": "TENANT_ID",
"name": "USERNAME"
}
},
"user": {
"username": "admin",
"roles_links": [],
"id": "3273a50d6cfb4a2ebc75e83cb86e1554",
"id": "USER_ID",
"name": "USERNAME",
"roles": [
{
"name": "admin"
"name": "_member_"
}
],
"name": "admin"
},
"metadata": {
"is_admin": 0,
"roles": [
"b0d525aa42784ee0a3df1730aabdcecd"
]
"roles_links": [],
"username": "USERNAME"
}
}
}
}

View File

@@ -0,0 +1,99 @@
{
"images": [
{
"id": "2dadcc7b-3690-4a1d-97ce-011c55426477",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/images/2dadcc7b-3690-4a1d-97ce-011c55426477",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/images/2dadcc7b-3690-4a1d-97ce-011c55426477",
"rel": "bookmark"
},
{
"href": "http://8.21.28.222:9292/f9828a18c6484624b571e85728780ba8/images/2dadcc7b-3690-4a1d-97ce-011c55426477",
"type": "application/vnd.openstack.image",
"rel": "alternate"
}
],
"name": "Fedora 21 x86_64"
},
{
"id": "cfba3478-8645-4bc8-97e8-707b9f41b14e",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/images/cfba3478-8645-4bc8-97e8-707b9f41b14e",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/images/cfba3478-8645-4bc8-97e8-707b9f41b14e",
"rel": "bookmark"
},
{
"href": "http://8.21.28.222:9292/f9828a18c6484624b571e85728780ba8/images/cfba3478-8645-4bc8-97e8-707b9f41b14e",
"type": "application/vnd.openstack.image",
"rel": "alternate"
}
],
"name": "Ubuntu 14.04 amd64"
},
{
"id": "2e4c08a9-0ecd-4541-8a45-838479a88552",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/images/2e4c08a9-0ecd-4541-8a45-838479a88552",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/images/2e4c08a9-0ecd-4541-8a45-838479a88552",
"rel": "bookmark"
},
{
"href": "http://8.21.28.222:9292/f9828a18c6484624b571e85728780ba8/images/2e4c08a9-0ecd-4541-8a45-838479a88552",
"type": "application/vnd.openstack.image",
"rel": "alternate"
}
],
"name": "CentOS 7 x86_64"
},
{
"id": "c8dd9096-60c1-4e23-a486-82955481df9f",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/images/c8dd9096-60c1-4e23-a486-82955481df9f",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/images/c8dd9096-60c1-4e23-a486-82955481df9f",
"rel": "bookmark"
},
{
"href": "http://8.21.28.222:9292/f9828a18c6484624b571e85728780ba8/images/c8dd9096-60c1-4e23-a486-82955481df9f",
"type": "application/vnd.openstack.image",
"rel": "alternate"
}
],
"name": "CentOS 6.5 x86_64"
},
{
"id": "f97b8d36-935e-4666-9c58-8a0afc6d3796",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f9828a18c6484624b571e85728780ba8/images/f97b8d36-935e-4666-9c58-8a0afc6d3796",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f9828a18c6484624b571e85728780ba8/images/f97b8d36-935e-4666-9c58-8a0afc6d3796",
"rel": "bookmark"
},
{
"href": "http://8.21.28.222:9292/f9828a18c6484624b571e85728780ba8/images/f97b8d36-935e-4666-9c58-8a0afc6d3796",
"type": "application/vnd.openstack.image",
"rel": "alternate"
}
],
"name": "Fedora 20 x86_64"
}
]
}

View File

@@ -1,16 +0,0 @@
{
"server": {
"adminPass": "MVk5HPrazHcG",
"id": "5bbcc3c4-1da2-4437-a48a-66f15b1b13f9",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/servers/5bbcc3c4-1da2-4437-a48a-66f15b1b13f9",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/servers/5bbcc3c4-1da2-4437-a48a-66f15b1b13f9",
"rel": "bookmark"
}
]
}
}

View File

@@ -0,0 +1,18 @@
{
"servers": [
{
"id": "41551256-abd6-402c-835b-e87e559b2249",
"links": [
{
"href": "http://8.21.28.222:8774/v2/f8828a18c6484624b571e85728780ba8/servers/41551256-abd6-402c-835b-e87e559b2249",
"rel": "self"
},
{
"href": "http://8.21.28.222:8774/f8828a18c6484624b571e85728780ba8/servers/41551256-abd6-402c-835b-e87e559b2249",
"rel": "bookmark"
}
],
"name": "test-server"
}
]
}