Add environments to api-ref

This patch add the environments api to api-ref

Change-Id: Idfb2807a5b8e5e58c552a5b69440a005d4bb3183
Partially-Implements: blueprint murano-api-ref
This commit is contained in:
zhurong 2017-03-06 17:27:53 +08:00
parent 2b253671bd
commit 1b0280a07f
12 changed files with 804 additions and 0 deletions

View File

@ -0,0 +1,386 @@
.. -*- rst -*-
============
Environments
============
List environments
=================
.. rest_method:: GET /environments
Get a list of existing Environments
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 400
- 401
- 500
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- all_tenants: all_tenants
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- environments: environments
- status: env_status
- updated: updated
- networking: networking
- name: env_name
- created: created
- tenant_id: tenant_id
- version: env_version
- id: env_id
Response Example
----------------
.. literalinclude:: samples/environments-list-response.json
:language: javascript
Create environment
==================
.. rest_method:: POST /environments
Creates a environment.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 400
- 401
- 409
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- name: env_name_request
Request Example
---------------
.. literalinclude:: samples/environment-create-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- id: env_id
- name: env_name
- created: created
- updated: updated
- tenant_id: tenant_id
- version: env_version
Response Example
----------------
.. literalinclude:: samples/environment-create-response.json
:language: javascript
Update environment
==================
.. rest_method:: PUT /environments/<env_id>
Updates an environment.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 202
.. rest_status_code:: error status.yaml
- 400
- 403
- 404
- 409
- 500
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- name: env_name_update
Request Example
---------------
.. literalinclude:: samples/environment-update-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- id: env_id
- name: env_name
- created: created
- updated: updated
- tenant_id: tenant_id
- version: env_version
Response Example
----------------
.. literalinclude:: samples/environment-update-response.json
:language: javascript
Show environment details
========================
.. rest_method:: GET /environments/{id}
Shows details for a environment.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 400
- 401
- 404
- 500
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- id: env_id_url
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- status: env_status
- updated: updated
- networking: networking
- name: env_name
- created: created
- tenant_id: tenant_id
- version: env_version
- services: services
- id: env_id
Response Example
----------------
.. literalinclude:: samples/environment-show-response.json
:language: javascript
Delete environment
==================
.. rest_method:: DELETE /environments/{id}?abandon
Remove specified Environment.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 403
- 404
- 500
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- id: env_id_url
- abandon: abandon
Response Parameters
-------------------
This request does not return anything in the response body.
Get environment model
=====================
.. rest_method:: GET /environments/{env_id}/model/{path}
Get an Environment model.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 400
- 401
- 500
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- env_id: env_id_url
- path: env_model_path
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- defaultNetworks: env_default_networks
- region: env_region
- name: env_name
- regions: regions
- services: services
- ?: env_model
Response Example
----------------
.. literalinclude:: samples/environments-model-response.json
:language: javascript
Update environment model
========================
.. rest_method:: PATCH /environments/<env_id>/model/
Update an Environment model.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 202
.. rest_status_code:: error status.yaml
- 400
- 403
- 404
- 409
- 500
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- name: env_name_update
Request Example
---------------
.. literalinclude:: samples/environment-model-update-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- defaultNetworks: env_default_networks
- region: env_region
- name: env_name
- regions: regions
- services: services
- ?: env_model
Response Example
----------------
.. literalinclude:: samples/environments-model-response.json
:language: javascript
Get environment last status
===========================
.. rest_method:: GET /environments/{id}/lastStatus
Get last status for a environment.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 400
- 401
- 404
- 500
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- id: env_id_url
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- uuid: last_status_uuid
Response Example
----------------
.. literalinclude:: samples/environment-last-status-response.json
:language: javascript

View File

@ -0,0 +1,165 @@
# variables in header
request_id:
description: |
A unique ID for tracking service request. The request ID associated
with the request by default appears in the service logs.
in: header
required: true
type: UUID
abandon:
description: |
Indicates how to delete environment.
``True`` is used when just database must be cleaned.
``False`` is used if all resources used by environment must be destroyed.
in: path
required: false
default: false
type: boolean
env_id_url:
description: |
The UUID of the environment.
in: path
required: true
type: string
env_model_path:
description: |
Allows to get a specific section of the model, for example
``defaultNetworks``, ``region`` or ``?`` or any of the subsections.
in: path
required: false
type: string
env_name_update:
description: |
A name for the environment. Name must be at least
one non-white space symbol.
in: path
required: true
type: string
all_tenants:
description: |
Indicates whether environments from all projects are listed.
``True`` environments from all projects are listed. Admin user required.
``False`` environments only from current project are listed (default like
option unspecified).
in: query
required: false
default: false
type: boolean
created:
description: |
The date and time when the resource was created. The date and time stamp
format is `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_:
::
CCYY-MM-DDThh:mm:ss±hh:mm
For example, ``2015-08-27T09:49:58-05:00``.
The ``±hh:mm`` value, if included, is the time zone as an offset
from UTC.
in: body
required: true
type: string
env_default_networks:
description: |
The default networks of the environment.
in: body
required: true
type: array
env_id:
description: |
The UUID of the environment.
in: body
required: true
type: string
env_model:
description: |
The ``?`` sections of the environment..
in: body
required: true
type: array
env_name:
description: |
A name for the environment. Name must be at least
one non-white space symbol.
in: body
required: true
type: string
env_name_request:
description: |
A name for the environment. Name must be at least
one non-white space symbol.
in: body
required: true
type: string
env_region:
description: |
Current region of the environment.
in: body
required: true
type: string
env_status:
description: |
Current status of the environment.
in: body
required: true
type: string
env_version:
description: |
Current version.
in: body
required: true
type: int
environments:
description: |
A list of ``environment`` object.
in: body
required: true
type: array
last_status_uuid:
description: |
A list of environment last status object.
in: body
required: true
type: array
networking:
description: |
Current network of the environment.
in: body
required: true
type: string
regions:
description: |
The regions detail of the cloud.
in: body
required: true
type: array
services:
description: |
A list of ``services`` object.
in: body
required: true
type: array
tenant_id:
description: |
The UUID of the tenant. A tenant is also known as
a project.
in: body
required: true
type: string
updated:
description: |
The date and time when the object was updated. The date and time stamp
format is `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_:
::
CCYY-MM-DDThh:mm:ss±hh:mm
For example, ``2015-08-27T09:49:58-05:00``.
The ``±hh:mm`` value, if included, is the time zone as an offset from UTC.
in: body
required: true
type: string

View File

@ -0,0 +1 @@
{"name": "env_name"}

View File

@ -0,0 +1,8 @@
{
"id": "ce373a477f211e187a55404a662f968",
"name": "env_name",
"created": "2013-11-30T03:23:42Z",
"updated": "2013-11-30T03:23:44Z",
"tenant_id": "0849006f7ce94961b3aab4e46d6f229a",
"version": 0
}

View File

@ -0,0 +1,15 @@
{
"lastStatuses": {
"66563e45-4d0a-451e-8138-7bc773b0607d": {
"updated": "2017-03-09T07:31:51",
"task_id": "1267d8dfcf2144f9a31f0f033defa0fd",
"level": "info",
"text": "Unable to install ApacheHttpServer on node-1 due to The murano-agent did not respond within 3600 seconds",
"created": "2017-03-09T07:31:51",
"entity_id": "66563e45-4d0a-451e-8138-7bc773b0607d",
"entity": null,
"details": null,
"id": "4f93ae1f73294bf1a58cbc59fffe6238"
}
}
}

View File

@ -0,0 +1,5 @@
[{
"op": "replace",
"path": "/defaultNetworks/flat",
"value": true
}]

View File

@ -0,0 +1,35 @@
{
"status": "ready",
"updated": "2014-05-14T13:12:26",
"networking": {},
"name": "quick-env-2",
"created": "2014-05-14T13:09:55",
"tenant_id": "726ed856965f43cc8e565bc991fa76c3",
"version": 1,
"services": [
{
"instance": {
"flavor": "m1.medium",
"image": "cloud-fedora-v3",
"name": "exgchhv6nbika2",
"ipAddresses": [
"10.0.0.200"
],
"?": {
"type": "io.murano.resources.Instance",
"id": "14cce9d9-aaa1-4f09-84a9-c4bb859edaff"
}
},
"name": "rewt4w56",
"?": {
"status": "ready",
"_26411a1861294160833743e45d0eaad9": {
"name": "Telnet"
},
"type": "io.murano.apps.linux.Telnet",
"id": "446373ef-03b5-4925-b095-6c56568fa518"
}
}
],
"id": "20d4a012628e4073b48490a336a8acbf"
}

View File

@ -0,0 +1 @@
{"name": "env_name_changed"}

View File

@ -0,0 +1,8 @@
{
"id": "ce373a477f211e187a55404a662f968",
"name": "env_name_changed",
"created": "2013-11-30T03:23:42Z",
"updated": "2013-11-30T03:45:54Z",
"tenant_id": "0849006f7ce94961b3aab4e46d6f229a",
"version": 0
}

View File

@ -0,0 +1,24 @@
{
"environments": [
{
"status": "ready",
"updated": "2014-05-14T13:02:54",
"networking": {},
"name": "test1",
"created": "2014-05-14T13:02:46",
"tenant_id": "726ed856965f43cc8e565bc991fa76c3",
"version": 0,
"id": "2fa5ab704749444bbeafe7991b412c33"
},
{
"status": "ready",
"updated": "2014-05-14T13:02:55",
"networking": {},
"name": "test2",
"created": "2014-05-14T13:02:51",
"tenant_id": "726ed856965f43cc8e565bc991fa76c3",
"version": 0,
"id": "744e44812da84e858946f5d817de4f72"
}
]
}

View File

@ -0,0 +1,94 @@
{
"defaultNetworks": {
"environment": {
"internalNetworkName": "net_two",
"?": {
"type": "io.murano.resources.ExistingNeutronNetwork",
"id": "594e94fcfe4c48ef8f9b55edb3b9f177"
}
},
"flat": null
},
"region": "RegionTwo",
"name": "new_env",
"regions": {
"": {
"defaultNetworks": {
"environment": {
"autoUplink": true,
"name": "new_env-network",
"externalRouterId": null,
"dnsNameservers": [],
"autogenerateSubnet": true,
"subnetCidr": null,
"openstackId": null,
"?": {
"dependencies": {
"onDestruction": [{
"subscriber": "c80e33dd67a44f489b2f04818b72f404",
"handler": null
}]
},
"type": "io.murano.resources.NeutronNetwork/0.0.0@io.murano",
"id": "e145b50623c04a68956e3e656a0568d3",
"name": null
},
"regionName": "RegionOne"
},
"flat": null
},
"name": "RegionOne",
"?": {
"type": "io.murano.CloudRegion/0.0.0@io.murano",
"id": "c80e33dd67a44f489b2f04818b72f404",
"name": null
}
},
"RegionOne": "c80e33dd67a44f489b2f04818b72f404",
"RegionTwo": {
"defaultNetworks": {
"environment": {
"autoUplink": true,
"name": "new_env-network",
"externalRouterId": "e449bdd5-228c-4747-a925-18cda80fbd6b",
"dnsNameservers": ["8.8.8.8"],
"autogenerateSubnet": true,
"subnetCidr": "10.0.198.0/24",
"openstackId": "00a695c1-60ff-42ec-acb9-b916165413da",
"?": {
"dependencies": {
"onDestruction": [{
"subscriber": "f8cb28d147914850978edb35eca156e1",
"handler": null
}]
},
"type": "io.murano.resources.NeutronNetwork/0.0.0@io.murano",
"id": "72d2c13c600247c98e09e2e3c1cd9d70",
"name": null
},
"regionName": "RegionTwo"
},
"flat": null
},
"name": "RegionTwo",
"?": {
"type": "io.murano.CloudRegion/0.0.0@io.murano",
"id": "f8cb28d147914850978edb35eca156e1",
"name": null
}
}
},
"services": [],
"?": {
"type": "io.murano.Environment/0.0.0@io.murano",
"_actions": {
"f7f22c174070455c9cafc59391402bdc_deploy": {
"enabled": true,
"name": "deploy",
"title": "deploy"
}
},
"id": "f7f22c174070455c9cafc59391402bdc",
"name": null
}
}

View File

@ -0,0 +1,62 @@
#################
# Success Codes #
#################
200:
default: |
Request was successful.
201:
default: |
Resource was created and is ready to use.
202:
default: |
Request was accepted for processing, but the processing has not been
completed. A 'location' header is included in the response which contains
a link to check the progress of the request.
204:
default: |
The server has fulfilled the request by deleting the resource.
300:
default: |
There are multiple choices for resources. The request has to be more
specific to successfully retrieve one of these resources.
302:
default: |
The response is about a redirection hint. The header of the response
usually contains a 'location' value where requesters can check to track
the real location of the resource.
#################
# Error Codes #
#################
400:
default: |
Some content in the request was invalid.
resource_signal: |
The target resource doesn't support receiving a signal.
401:
default: |
User must authenticate before making a request.
403:
default: |
Policy does not allow current user to do this operation.
404:
default: |
The requested resource could not be found.
405:
default: |
Method is not valid for this endpoint.
409:
default: |
This operation conflicted with another operation on this resource.
duplicate_zone: |
There is already a zone with this name.
500:
default: |
Something went wrong inside the service. This should not happen usually.
If it does happen, it means the server has experienced some serious
problems.
503:
default: |
Service is not available. This is mostly caused by service configuration
errors which prevents the service from successful start up.