Get API Quick Start ready for Free Cloud

Change-Id: I217b01ede576ec01178d6b80d0bef1deed6d3631
This commit is contained in:
annegentle 2012-02-10 10:47:16 -06:00
parent 0643081970
commit 84b989e76f
3 changed files with 101 additions and 90 deletions

View File

@ -71,8 +71,8 @@
<phase>generate-sources</phase>
<configuration>
<!-- These parameters only apply to webhelp -->
<enableDisqus>0</enableDisqus>
<disqusShortname>openstackdocs</disqusShortname>
<enableDisqus>1</enableDisqus>
<disqusShortname>os-apiquickstart</disqusShortname>
<enableGoogleAnalytics>1</enableGoogleAnalytics>
<googleAnalyticsId>UA-17511903-6</googleAnalyticsId>
<generateToc>

View File

@ -9,7 +9,8 @@
separate installations but can work together depending on your
cloud needs: OpenStack Compute, OpenStack Object Storage,
OpenStack Identity Service, and OpenStack Image Store.
<!--With a standalone OpenStack installation, the OpenStack Compute, OpenStack Identity, and OpenStack Image Store projects are all working together in the background of your installation. --></para>
With The Free Cloud OpenStack installation, the OpenStack Compute, OpenStack Identity, and OpenStack Image Store projects
are all working together in the background of the installation. </para>
<section xml:id="Openstack-API-Concepts-a09234">
<title>OpenStack API Introduction</title>
@ -33,44 +34,11 @@
<orderedlist>
<listitem><para>Begin API requests by asking for an authorization token from the endpoint your cloud
administrator gave you, typically http://hostname:5000/v2.0/tokens. You send your
username, password, and what group you are with (the "tenant" in auth-speak). </para>
<para><programlisting>
curl -X 'POST' -v http://host.na.me:5000/v2.0/tokens -d '{"passwordCredentials":{"username": "joecool", "password":"coolword"}, "tenantId":"5"}' -H 'Content-type: application/json'</programlisting></para></listitem>
<listitem><para>The server returns a response in which the 24-hours token is contained :
<programlisting>
* About to connect() to host.na.me port 5000 (#0)
* Trying 55.51.11.198... connected
* Connected to host.na.me (55.51.11.198) port 5000 (#0)
&gt; POST /v2.0/tokens HTTP/1.1
&gt; User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
&gt; Host: host.na.me:5000v> Accept: */*
&gt; Content-type: application/json
&gt; Content-Length: 95
&gt;
&gt; HTTP/1.1 200 OK
&gt; Content-Type: application/json; charset=UTF-8
&gt; Content-Length: 935
&gt; Date: Thu, 06 Oct 2011 19:59:49 GMT
&gt;
* Connection #0 to host host.na.me left intact
* Closing connection #0
{"access": {"token": {"expires": "2011-10-07T14:59:49.644963",
"id": "e83abbdc-a8c8-4f81-897b-541cbcd1dbb5",
"tenant": {"id": "5", "name": "coolu"}}, "serviceCatalog":
[{"endpoints": [{"adminURL": "http://55.51.11.198:8774/v1.1/5",
"region": "RegionOne", "internalURL": "http://55.51.11.198:8774/v1.1/5",
"publicURL": "http://55.51.11.198:8774/v1.1/5"}], "type": "compute", "name": "nova"},
{"endpoints": [{"adminURL": "http://55.51.11.198:9292/v1.1/5",
"region": "RegionOne", "internalURL": "http://55.51.11.198:9292/v1.1/5",
"publicURL": "http://55.51.11.198:9292/v1.1/5"}], "type": "image", "name": "glance"},
{"endpoints": [{"adminURL": "http://55.51.11.198:35357/v2.0",
"region": "RegionOne", "internalURL": "http://55.51.11.198:5000/v2.0",
"publicURL": "http://55.51.11.198:5000/v2.0"}],
"type": "identity", "name": "keystone"}], "user": {"id": "4", "roles":
[{"tenantId": "5", "id": "2", "name": "Member"}], "name": "joecool"}}}
</programlisting>
Use that token to send API requests with the X-Auth-Token included as an header
username, password, and what group or account you are with (the "tenant" in auth-speak). </para>
<para><programlisting>curl -X 'POST' -v http://freecloud.org:5000/v2.0/tokens -d '{"passwordCredentials":{"username": "joecool", "password":"coolword"}, "tenantId":"5"}' -H 'Content-type: application/json'</programlisting></para></listitem>
<listitem><para>The server returns a response in which the 24-hours token is
contained. Use that token to send API requests
with the X-Auth-Token included as an header
field.</para></listitem>
<listitem>
@ -84,47 +52,94 @@ curl -X 'POST' -v http://host.na.me:5000/v2.0/tokens -d '{"passwordCredentials":
</listitem>
</orderedlist>
<para>For a typical OpenStack deployment running the Identity Service you can request a token
with this command in
<para>For a typical OpenStack deployment running the Identity
Service you can request a token with this command in
cURL:<programlisting>
$ curl -X 'POST' -v http://host.na.me:5000/v2.0/tokens -d '{"auth":{"passwordCredentials":{"username": "joecool", "password":"coolword"}, "tenantId":"5"}}' -H 'Content-type: application/json'
$ curl -X 'POST' -v http://freecloud.org:5000/v2.0/tokens -d '{"auth":{"passwordCredentials":{"username": "joecool", "password":"coolword"}, "tenantId":"5"}}' -H 'Content-type: application/json'
</programlisting></para>
<para>In return, you should get a 200 OK response with a token in the form of "id": "cd427a33-bb4a-4079-a6d7-0ae148bdeda9" and an expiration date 24 hours from now. Here's what it looks like:</para>
<para>
<programlisting>
* About to connect() to host.na.me port 5000 (#0)
* Trying hostname... connected
* Connected to host.na.me (hostname) port 5000 (#0)
&gt; POST /v2.0/tokens HTTP/1.1
&gt; User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
&gt; Host: host.na.me:5000
&gt; Accept: */*
&gt; Content-type: application/json
&gt; Content-Length: 85
&gt;
&gt; HTTP/1.1 200 OK
&gt; Content-Type: application/json; charset=UTF-8
&gt; Content-Length: 1213
&gt; Date: Thu, 01 Sep 2011 19:27:30 GMT
&gt;
* Connection #0 to host host.na.me left intact
* Connected to thefreecloud.org (8.21.28.251) port 5000 (#0)
> POST /v2.0/tokens HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: thefreecloud.org:5000
> Accept: */*
> Content-type: application/json
> Content-Length: 100
>
} [data not shown]
&lt; HTTP/1.1 200 OK
&lt; Content-Type: application/json; charset=UTF-8
&lt; Content-Length: 1042
&lt; Date: Wed, 08 Feb 2012 02:58:56 GMT
&lt;
{ [data not shown]
100 1142 100 1042 100 100 4772 458 --:--:-- --:--:-- --:--:-- 7834* Connection #0 to host thefreecloud.org left intact
* Closing connection #0
{"access": {"token": {"expires": "2011-10-07T14:59:49.644963",
"id": "e83abbdc-a8c8-4f81-897b-541cbcd1dbb5",
"tenant": {"id": "5", "name": "coolu"}},
"serviceCatalog":
[{"endpoints": [{"adminURL": "http://55.51.11.198:8774/v1.1/5",
"region": "RegionOne", "internalURL": "http://55.51.11.198:8774/v1.1/5",
"publicURL": "http://55.51.11.198:8774/v1.1/5"}],
"type": "compute", "name": "nova"},
{"endpoints": [{"adminURL": "http://55.51.11.198:9292/v1.1/5",
"region": "RegionOne", "internalURL": "http://55.51.11.198:9292/v1.1/5",
"publicURL": "http://55.51.11.198:9292/v1.1/5"}], "type": "image", "name": "glance"},
{"endpoints": [{"adminURL": "http://55.51.11.198:35357/v2.0",
"region": "RegionOne", "internalURL": "http://55.51.11.198:5000/v2.0",
"publicURL": "http://55.51.11.198:5000/v2.0"}],
"type": "identity", "name": "keystone"}],
"user": {"id": "4", "roles": [{"tenantId": "5", "id": "2", "name": "Member"}], "name": "joecool"}}}
{
"access": {
"serviceCatalog": [
{
"endpoints": [
{
"adminURL": "http://nova-api.thefreecloud.org:8774/v1.1/1",
"internalURL": "http://nova-api.thefreecloud.org:8774/v1.1/1",
"publicURL": "http://nova-api.thefreecloud.org:8774/v1.1/1",
"region": "RegionOne"
}
],
"name": "nova",
"type": "compute"
},
{
"endpoints": [
{
"adminURL": "http://glance.thefreecloud.org:9292/v1.1/1",
"internalURL": "http://glance.thefreecloud.org:9292/v1.1/1",
"publicURL": "http://glance.thefreecloud.org:9292/v1.1/1",
"region": "RegionOne"
}
],
"name": "glance",
"type": "image"
},
{
"endpoints": [
{
"adminURL": "http://keystone.thefreecloud.org:5001/v2.0",
"internalURL": "http://keystone.thefreecloud.org:5000/v2.0",
"publicURL": "http://keystone.thefreecloud.org:5000/v2.0",
"region": "RegionOne"
}
],
"name": "keystone",
"type": "identity"
}
],
"token": {
"expires": "2012-02-08T16:46:16",
"id": "e587ad13-3112-4077-96b9-7eaf299f7031",
"tenant": {
"id": "1",
"name": "admin"
}
},
"user": {
"id": "14",
"name": "annegentle",
"roles": [
{
"id": "2",
"name": "Member",
"tenantId": "1"
}
]
}
}
}
</programlisting></para></section>
<section xml:id="Sending-Requests-to-API-a09879">
<title>Sending Requests to the API</title>

View File

@ -11,13 +11,10 @@
Compute API interactions from the command line. You install the client, and then provide
your username and password, set as environment variables for convenience, and then you
can have the ability to send commands to your cloud on the command-line.</para>
<para>To install python-novaclient, download the tarball from
<link xlink:href="http://pypi.python.org/pypi/python-novaclient/2.6.3#downloads">http://pypi.python.org/pypi/python-novaclient/2.6.3#downloads</link> and then install it in your favorite python environment. </para>
<para>To install python-novaclient, grab the stable/nova version
like so. </para>
<programlisting>
$ curl -O http://pypi.python.org/packages/source/p/python-novaclient/python-novaclient-2.6.3.tar.gz
$ tar -zxvf python-novaclient-2.6.3.tar.gz
$ cd python-novaclient-2.6.3
$ sudo python setup.py install
$ pip install -e git+https://github.com/openstack/python-novaclient.git#egg=python-novaclient
</programlisting>
<para>Now that you have installed the python-novaclient, confirm the installation by entering:</para><programlisting>
$ nova help
@ -26,25 +23,24 @@ usage: nova [--username USERNAME] [--apikey APIKEY] [--projectid PROJECTID]
[--url URL] [--version VERSION]
&lt;subcommand&gt; ...
</programlisting>
<para>In return, you will get a listing of all the commands and parameters for the nova command line client. By setting up the required parameters as environment variables, you can fly through these commands on the command line. You can add --username on the nova command, or set them as environment variables: </para>
<para>In return, you will get a listing of all the commands and parameters for the nova command line client.
By setting up the required parameters as environment variables, you can fly through these commands on the command line.
You can add --username on the nova command, or set them as environment variables. Using the Free Cloud, you are supplied with an endpoint,
which the nova client recognizes as the NOVA_URL. </para>
<para><programlisting>
export NOVA_USERNAME=joecool
export NOVA_API_KEY=coolword
export NOVA_PROJECT_ID=coolu
</programlisting>
</para><para>Using the Identity Service, you are supplied with an authentication endpoint, which nova recognizes as the NOVA_URL. </para>
<para>
<programlisting>
export NOVA_URL=http://hostname:5000/v2.0
export NOVA_URL=http://thefreecloud.org:5000/v2.0
export NOVA_VERSION=1.1
</programlisting>
</para>
<section xml:id="Launching-Images-a09140"><title>Listing Images</title><para>Before you can go about the business of building your cloud, you want to know what images are
available to you by asking the image service what kinds of configurations are available.
The image service could be compared to iTunes for your cloud - you can view the playlist
of images before using your favorite image to create a new instance in the cloud. To get
the list of images, their names, status, and ID, use this
command:
the list of images, their names, status, and ID, use this command:
<programlisting>
$ nova image-list