tuskar/doc/source/api/curl-v2.rst
marios b10d4a65e5 Wires up constraints and type into returned plan parameters
Though constraints and type are both plumbed into the parsing
and storage models, for some reason these were not being captured
in the generated Plan object returned to the client. This adds
those missing attributes of Plan parameters. Also updates the
docs to reflect the "new" attrs

Change-Id: I138818daef38f084acd6e2250986351352b3835d
2015-04-20 12:04:14 +03:00

198 lines
4.4 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

============================
cURL Commands for API ver. 2
============================
.. _index:
Resources
---------
- `Plan`_
- `Role`_
Plan
----
Example of JSON Representation of Plan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
{
"created_at": "2014-09-26T20:23:14.222815",
"description": "Development testing cloud",
"name": "dev-cloud",
"parameters":
[
{
"constraints":
[
{
"constraint_type": "range",
"definition":
{
"min": "0"
},
"description": "Can't be less than zero"
}
],
"default": "0",
"description": "The number of cinder storage nodes to deploy"
"hidden": false,
"label": "The number of cinder storage nodes to deploy",
"name": "Cinder-Storage-1::count",
"parameter_type": "number",
"value": "0"
},
{
"constraints": []
"default": "guest",
"description": "The password for RabbitMQ",
"hidden": true,
"label": null,
"name": "compute-1::RabbitPassword",
"parameter_type: "string"
"value": "secret-password"
}
],
"roles":
[
{
"description": "OpenStack hypervisor node. Can be wrapped in a ResourceGroup for scaling.\n",
"name": "compute",
"uuid": "b7b1583c-5c80-481f-a25b-708ed4a39734",
"version": 1
}
],
"updated_at": null,
"uuid": "53268a27-afc8-4b21-839f-90227dd7a001"
}
List All Plans
~~~~~~~~~~
::
curl -v -X GET -H 'Content-Type: application/json' -H 'Accept: application/json' http://0.0.0.0:8585/v2/plans/
Retrieve a Single Plan
~~~~~~~~~~~~~~~~~~~~~~
::
curl -v -X GET -H 'Content-Type: application/json' -H 'Accept: application/json' http://0.0.0.0:8585/v2/plans/53268a27-afc8-4b21-839f-90227dd7a001
Create a New Plan
~~~~~~~~~~~~~~~~~
::
curl -v -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '
{
"name": "dev-cloud",
"description": "Development testing cloud",
}
' http://0.0.0.0:8585/v2/plans
This command will create new Plan without any Roles associated with it.
To assign a Role to Plan see `How to Add a Role to a Plan <#adding-a-role-to-a-plan>`_.
Delete an Existing Plan
~~~~~~~~~~~~~~~~~~~~~~~
::
curl -v -X DELETE http://localhost:8585/v2/plans/53268a27-afc8-4b21-839f-90227dd7a001
Changing a Plans Configuration Values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
curl -v -X PATCH -H 'Content-Type: application/json' -H 'Accept: application/json' -d '
[
{
"name" : "database_host",
"value" : "10.11.12.13"
},
{
"name" : "database_password",
"value" : "secret"
}
]
' http://0.0.0.0:8585/v2/plans/53268a27-afc8-4b21-839f-90227dd7a001
You can change only existing parameters in Plan.
Retrieve a Plans Template Files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
curl -v -X GET -H 'Content-Type: application/json' -H 'Accept: application/json' http://0.0.0.0:8585/v2/plans/53268a27-afc8-4b21-839f-90227dd7a001/templates
Example of JSON representation:
::
{
"environment.yaml" : "... content of template file ...",
"plan.yaml" : "... content of template file ...",
"provider-compute-1.yaml" : "... content of template file ..."
}
`back to top <#index>`_
Role
----
Example of JSON Representation of Role
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
{
"description": "OpenStack hypervisor node. Can be wrapped in a ResourceGroup for scaling.\n",
"name": "compute",
"uuid": "b7b1583c-5c80-481f-a25b-708ed4a39734",
"version": 1
}
Retrieving Possible Roles
~~~~~~~~~~~~~~~~~~~~~~~~~
::
curl -v -X GET -H 'Content-Type: application/json' -H 'Accept: application/json' http://0.0.0.0:8585/v2/roles/
Adding a Role to a Plan
~~~~~~~~~~~~~~~~~~~~~~~
::
curl -v -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '
{
"uuid": "b7b1583c-5c80-481f-a25b-708ed4a39734"
}
' http://0.0.0.0:8585/v2/plans/53268a27-afc8-4b21-839f-90227dd7a001
Removing a Role from a Plan
~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
curl -v -X DELETE http://localhost:8585/v2/plans/53268a27-afc8-4b21-839f-90227dd7a001/roles/b7b1583c-5c80-481f-a25b-708ed4a39734
`back to top <#index>`_