Add plans api-ref

add api reference of plans.

Change-Id: I4d50dd6a6921bd7c205d3e34a1a599308999245b
This commit is contained in:
zhangshuai 2016-09-20 11:38:01 +08:00
parent de58d73752
commit aaf98478e7
8 changed files with 549 additions and 0 deletions

View File

@ -5,3 +5,5 @@ Data Protection API V1
======================
.. rest_expand_all::
.. include:: karbor-v1-plans.inc

View File

@ -0,0 +1,265 @@
.. -*- rst -*-
=====
Plans
=====
This API enables the Karbor user to access the protection Plan registry and do
the following operations:
- Plan CRUD.
- List Plans.
- Starting and suspending of plans.
When you perform the above operation, these status values are possible:
+-----------------+----------------------------------------------------------+
| Status | Description |
+=================+==========================================================+
| started | A plan is updated. |
+-----------------+----------------------------------------------------------+
| suspended | A plan is created. |
+-----------------+----------------------------------------------------------+
List plans
==========
.. rest_method:: GET /v1/{tenant_id}/plans
List all the protection plans offered for the given project, or part of the
protection plans limited by ``?limit={limit_num}`` by ``GET`` method.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 401
- 403
Request
-------
.. rest_parameters:: parameters.yaml
- tenant_id: tenant_id
Response
--------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- plans: plan_list
- id: plan_id
- name: plan_name
- resources: resources
- status: plan_status
- provider_id: provider_id
- parameters: plan_parameters
- plans_links: links
Response Example
----------------
.. literalinclude:: ./samples/plans-list-response.json
:language: javascript
Create plan
===========
.. rest_method:: POST /v1/{tenant_id}/plans
Create a new plan.
To specify the parameters for this plan, include the parameters
in the ``parameters`` attribute in the request body.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 401
- 403
Request
-------
.. rest_parameters:: parameters.yaml
- tenant_id: tenant_id
- plan: plan
- name: plan_name
- resources: resources
- provider_id: provider_id
- parameters: plan_parameters
Request Example
---------------
.. literalinclude:: ./samples/plan-create-request.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- plan: plan
- id: plan_id
- name: plan_name
- resources: resources
- status: plan_status
- provider_id: provider_id
- parameters: plan_parameters
Response Example
----------------
.. literalinclude:: ./samples/plan-create-response.json
:language: javascript
Show plan
=========
.. rest_method:: GET /v1/{tenant_id}/plans/{plan_id}
Shows the information about a specific plan.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 401
- 403
Request
-------
.. rest_parameters:: parameters.yaml
- tenant_id: tenant_id
- plan_id: plan_id
Response
--------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- plan: plan
- id: plan_id
- name: plan_name
- resources: resources
- status: plan_status
- provider_id: provider_id
- parameters: plan_parameters
Response Example
----------------
.. literalinclude:: ./samples/plan-create-response.json
:language: javascript
Update plan
===========
.. rest_method:: PUT /v1/{tenant_id}/plans/{plan_id}
Updates a specific plan.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 401
- 403
Request
-------
.. rest_parameters:: parameters.yaml
- tenant_id: tenant_id
- plan_id: plan_id
- plan: plan
- name: plan_name_1
- resources: resources_1
- status: plan_status_1
Request Example
---------------
.. literalinclude:: ./samples/plan-update-request.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- plan: plan
- id: plan_id
- name: plan_name
- resources: resources
- status: plan_status
- provider_id: provider_id
- parameters: plan_parameters
Response Example
----------------
.. literalinclude:: ./samples/plan-update-response.json
:language: javascript
Delete plan
===========
.. rest_method:: DELETE /v1/{tenant_id}/plans/{plan_id}
Deletes a specific plan.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 200
.. rest_status_code:: error status.yaml
- 202
Request
-------
.. rest_parameters:: parameters.yaml
- tenant_id: tenant_id
- plan_id: plan_id

View File

@ -0,0 +1,94 @@
# 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
# variables in path
tenant_id:
description: |
The UUID of the tenant in a multi-tenancy cloud.
in: path
required: true
type: string
# variables in query
# variables in body
links:
description: |
Links for transfer.
in: body
required: true
type: array
plan:
description: |
A ``plan`` object.
in: body
required: true
type: object
plan_id:
description: |
The UUID of the plan.
in: body
required: true
type: UUID
plan_list:
description: |
The list of ``plan`` objects.
in: body
required: true
type: array
plan_name:
description: |
The name of the plan.
in: body
required: true
type: string
plan_name_1:
description: |
The name of the plan.
in: body
required: false
type: string
plan_parameters:
description: |
The specified parameters for plan.
in: body
required: true
type: dict
plan_status:
description: |
The status of plan. A valid value is ``started`` or ``suspended``.
in: body
required: true
type: string
plan_status_1:
description: |
The status of plan. A valid value is ``started`` or ``suspended``.
in: body
required: false
type: string
provider_id:
description: |
The UUID of the provider.
in: body
required: true
type: UUID
resources:
description: |
The list of all resources in plan.
in: body
required: true
type: array
resources_1:
description: |
The list of all resources in plan.
in: body
required: false
type: array

View File

@ -0,0 +1,42 @@
{
"plan": {
"name": "My 3 tier application",
"resources": [
{
"id": "99777fdd-8a5b-45ab-ba2c-52420008103f",
"type": "OS::Glance::Image",
"name": "cirros-0.3.4-x86_64-uec"
},
{
"id": "cb4ef2ff-10f5-46c9-bce4-cf7a49c65a01",
"type": "OS::Nova::Server",
"name": "App server"
},
{
"id": "25336116-f38e-4c22-81ad-e9b7bd71ba51",
"type": "OS::Cinder::Volume",
"name": "System volume"
},
{
"id": "33b6bb0b-1157-4e66-8553-1c9e14b1c7ba",
"type": "OS::Cinder::Volume",
"name": "Data volume"
}
],
"provider_id": "cf56bd3e-97a7-4078-b6d5-f36246333fd9",
"parameters": {
"OS::Nova::Server": {
"backup_name": "os"
},
"OS::Nova::Server#cb4ef2ff-10f5-46c9-bce4-cf7a49c65a01": {
"backup_name": "crash"
},
"OS::Cinder::Volume": {
"backup_name": "os"
},
"OS::Cinder::Volume#33b6bb0b-1157-4e66-8553-1c9e14b1c7ba": {
"backup_name": "crash"
}
}
}
}

View File

@ -0,0 +1,44 @@
{
"plan": {
"id": "9e5475d2-6425-4986-9136-a4f09642297f",
"name": "My 3 tier application",
"resources": [
{
"id": "99777fdd-8a5b-45ab-ba2c-52420008103f",
"type": "OS::Glance::Image",
"name": "cirros-0.3.4-x86_64-uec"
},
{
"id": "cb4ef2ff-10f5-46c9-bce4-cf7a49c65a01",
"type": "OS::Nova::Server",
"name": "App server"
},
{
"id": "25336116-f38e-4c22-81ad-e9b7bd71ba51",
"type": "OS::Cinder::Volume",
"name": "System volume"
},
{
"id": "33b6bb0b-1157-4e66-8553-1c9e14b1c7ba",
"type": "OS::Cinder::Volume",
"name": "Data volume"
}
],
"status": "suspended",
"provider_id": "cf56bd3e-97a7-4078-b6d5-f36246333fd9",
"parameters": {
"OS::Nova::Server": {
"backup_name": "os"
},
"OS::Nova::Server#cb4ef2ff-10f5-46c9-bce4-cf7a49c65a01": {
"backup_name": "crash"
},
"OS::Cinder::Volume": {
"backup_name": "os"
},
"OS::Cinder::Volume#33b6bb0b-1157-4e66-8553-1c9e14b1c7ba": {
"backup_name": "crash"
}
}
}
}

View File

@ -0,0 +1,6 @@
{
"plan":{
"status": "started",
"name": "My 1 tier application"
}
}

View File

@ -0,0 +1,44 @@
{
"plan": {
"id": "9e5475d2-6425-4986-9136-a4f09642297f",
"name": "My 1 tier application",
"resources": [
{
"id": "99777fdd-8a5b-45ab-ba2c-52420008103f",
"type": "OS::Glance::Image",
"name": "cirros-0.3.4-x86_64-uec"
},
{
"id": "cb4ef2ff-10f5-46c9-bce4-cf7a49c65a01",
"type": "OS::Nova::Server",
"name": "App server"
},
{
"id": "25336116-f38e-4c22-81ad-e9b7bd71ba51",
"type": "OS::Cinder::Volume",
"name": "System volume"
},
{
"id": "33b6bb0b-1157-4e66-8553-1c9e14b1c7ba",
"type": "OS::Cinder::Volume",
"name": "Data volume"
}
],
"status": "started",
"provider_id": "cf56bd3e-97a7-4078-b6d5-f36246333fd9",
"parameters": {
"OS::Nova::Server": {
"backup_name": "os"
},
"OS::Nova::Server#cb4ef2ff-10f5-46c9-bce4-cf7a49c65a01": {
"backup_name": "crash"
},
"OS::Cinder::Volume": {
"backup_name": "os"
},
"OS::Cinder::Volume#33b6bb0b-1157-4e66-8553-1c9e14b1c7ba": {
"backup_name": "crash"
}
}
}
}

View File

@ -0,0 +1,52 @@
{
"plans": [
{
"id": "9e5475d2-6425-4986-9136-a4f09642297f",
"name": "My 3 tier application",
"resources": [
{
"id": "99777fdd-8a5b-45ab-ba2c-52420008103f",
"type": "OS::Glance::Image",
"name": "cirros-0.3.4-x86_64-uec"
},
{
"id": "cb4ef2ff-10f5-46c9-bce4-cf7a49c65a01",
"type": "OS::Nova::Server",
"name": "App server"
},
{
"id": "25336116-f38e-4c22-81ad-e9b7bd71ba51",
"type": "OS::Cinder::Volume",
"name": "System volume"
},
{
"id": "33b6bb0b-1157-4e66-8553-1c9e14b1c7ba",
"type": "OS::Cinder::Volume",
"name": "Data volume"
}
],
"status": "suspended",
"provider_id": "cf56bd3e-97a7-4078-b6d5-f36246333fd9",
"parameters": {
"OS::Nova::Server": {
"backup_name": "os"
},
"OS::Nova::Server#cb4ef2ff-10f5-46c9-bce4-cf7a49c65a01": {
"backup_name": "crash"
},
"OS::Cinder::Volume": {
"backup_name": "os"
},
"OS::Cinder::Volume#33b6bb0b-1157-4e66-8553-1c9e14b1c7ba": {
"backup_name": "crash"
}
}
}
],
"plans_links": [
{
"href": "/v1/{project_id}/plans?limit={limit_num}&marker=9e5475d2-6425-4986-9136-a4f09642297f",
"rel": "next"
}
]
}