Cleanup API Guide
* use code-block markup * adjust code-block indent * fix OS_TENANT_NAME environment variable name Change-Id: Ibbba18d14f81b4c39fecfcbcea9e17498d5e8fe3
This commit is contained in:
parent
d777f6ee71
commit
f887906bbe
@ -82,11 +82,11 @@ For a typical OpenStack deployment that runs Identity, use the following cURL
|
||||
command to request a token. Specify your tenant name, and user name and
|
||||
password credentials:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -s -X POST http://128.136.179.2:5000/v2.0/tokens \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"auth": {"tenantName": "'"$OS_TENANT_NAME"'", "passwordCredentials":
|
||||
-d '{"auth": {"tenantName": "'"$OS_TENANT_NAME"'", "passwordCredentials": \
|
||||
{"username": "'"$OS_USERNAME"'", "password": "'"$OS_PASSWORD"'"}}}' \
|
||||
| python -m json.tool
|
||||
|
||||
@ -95,20 +95,21 @@ response body that contains a token in the form ``"id":"token"`` and an
|
||||
expiration date and time in the form ``"expires":"datetime"``.
|
||||
|
||||
.. note::
|
||||
|
||||
If you do not know the tenant name or ID, send a request with "" for the
|
||||
tenant name or ID. The response returns the tenant name or ID.
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -s -X POST http://128.136.179.2:5000/v2.0/tokens \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"auth": {"tenantName": "", "passwordCredentials":
|
||||
-d '{"auth": {"tenantName": "", "passwordCredentials": \
|
||||
{"username": "'"$OS_USERNAME"'", "password": "'"$OS_PASSWORD"'"}}}' \
|
||||
| python -m json.tool
|
||||
|
||||
The following example shows a successful response:
|
||||
|
||||
.. code::
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"access": {
|
||||
@ -339,7 +340,7 @@ list of Compute API calls, see
|
||||
|
||||
Export the token ID to the ``TOKEN`` environment variable. For example:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
export TOKEN=4b57c7d386a7438b829d1a8922e0eaab
|
||||
|
||||
@ -347,11 +348,11 @@ The token expires every 24 hours.
|
||||
|
||||
Use the Compute API to list flavors:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -s -H "X-Auth-Token: $TOKEN" http://128.136.179.2:8774/v2/$OS_TENANT/flavors | python -m json.tool
|
||||
$ curl -s -H "X-Auth-Token: $TOKEN" http://128.136.179.2:8774/v2/$OS_TENANT_NAME/flavors | python -m json.tool
|
||||
|
||||
.. code::
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"flavors": [
|
||||
@ -430,14 +431,13 @@ Use the Compute API to list flavors:
|
||||
|
||||
Use the Compute API to list images:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -s -H \
|
||||
"X-Auth-Token:token" \
|
||||
$ curl -s -H "X-Auth-Token:token" \
|
||||
http://8.21.28.222:8774/v2/tenant_id/images \
|
||||
| python -m json.tool
|
||||
|
||||
.. code::
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"images": [
|
||||
@ -541,14 +541,13 @@ Use the Compute API to list images:
|
||||
|
||||
Use the Compute API to list servers:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -s -H \
|
||||
"X-Auth-Token:token" \
|
||||
$ curl -s -H "X-Auth-Token:token" \
|
||||
http://8.21.28.222:8774/v2/tenant_id/servers \
|
||||
| python -m json.tool
|
||||
|
||||
.. code::
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"servers": [
|
||||
@ -596,7 +595,7 @@ You must install the client for each project separately, but the
|
||||
|
||||
Install or update a client package:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ sudo pip install [--upgrade] python-PROJECTclient
|
||||
|
||||
@ -604,19 +603,19 @@ Where *PROJECT* is the project name.
|
||||
|
||||
For example, install the ``openstack`` client:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ sudo pip install python-openstackclient
|
||||
|
||||
To update the ``openstack`` client, run this command:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ sudo pip install --upgrade python-openstackclient
|
||||
|
||||
To remove the ``openstack`` client, run this command:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ sudo pip uninstall python-openstackclient
|
||||
|
||||
@ -637,11 +636,11 @@ your instance.
|
||||
To list available images, call the Compute API through the ``openstack``
|
||||
client:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ openstack image list
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
+--------------------------------------+------------------+
|
||||
| ID | Name |
|
||||
@ -651,11 +650,11 @@ client:
|
||||
|
||||
To list flavors, run this command:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ openstack flavor list
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
+----+-----------+-----------+------+-----------+------+-------+-----------+
|
||||
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | Is_Public |
|
||||
@ -674,11 +673,11 @@ To launch an instance, note the IDs of your desired image and flavor.
|
||||
To launch the ``my_instance`` instance, run the ``openstack server create``
|
||||
command with the image and flavor IDs and the server name:
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
$ openstack server create --image 949c80c8-b4ac-4315-844e-69f9bef39ed1 --flavor 1 my_instance
|
||||
|
||||
.. code::
|
||||
.. code-block:: console
|
||||
|
||||
+--------------------------------------+---------------------------------------------------------+
|
||||
| Field | Value |
|
||||
@ -714,6 +713,6 @@ command with the image and flavor IDs and the server name:
|
||||
|
||||
.. note::
|
||||
For information about the default ports that the OpenStack components use,
|
||||
see `Firewalls and default ports`_ in the *OpenStack Configuration Reference*.
|
||||
|
||||
.. _Firewalls and default ports: http://docs.openstack.org/liberty/config-reference/content/firewalls-default-ports.html
|
||||
see `Firewalls and default ports <http://docs.openstack.org/liberty/
|
||||
config-reference/content/firewalls-default-ports.html>`_ in the
|
||||
*OpenStack Configuration Reference*.
|
||||
|
Loading…
x
Reference in New Issue
Block a user