Add scheduled operations api-ref

add api reference of scheduled operations.

Change-Id: I7c7772b9bf775b3b4f02e3d50d8fb86cad7648fc
This commit is contained in:
zhangshuai 2016-09-22 08:25:34 +08:00
parent ed8acfd7ec
commit 61a511e4ab
6 changed files with 303 additions and 0 deletions

View File

@ -9,4 +9,5 @@ Data Protection API V1
.. include:: karbor-v1-protectables.inc
.. include:: karbor-v1-providers.inc
.. include:: karbor-v1-plans.inc
.. include:: karbor-v1-scheduled-operations.inc
.. include:: karbor-v1-checkpoints.inc

View File

@ -0,0 +1,201 @@
.. -*- rst -*-
====================
Scheduled operations
====================
This API enables the Karbor user to manage protection Operations:
- Create a checkpoint for a given Protection Plan.
- Delete unneeded checkpoints from the provider.
- Status on a given Operation ID.
Scheduled operations are operations that will be executed when a specific
trigger is triggered.
List scheduled operations
=========================
.. rest_method:: GET /v1/{tenant_id}/scheduled_operations
List all the scheduled operations based on tigger and plan, or part of the
scheduled operations 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
- operations: operation_list
- scheduled_operation: operation
- id: operation_id
- name: operation_name
- description: description
- operation_type: operation_type
- trigger_id: trigger_id
- operation_definition: operation_definition
- enabled: enabled
- plans_links: links
Response Example
----------------
.. literalinclude:: ./samples/scheduled-operations-list-response.json
:language: javascript
Create scheduled operation
==========================
.. rest_method:: POST /v1/{tenant_id}/scheduled_operations
Create a new scheduled operation.
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
- scheduled_operation: operation
- name: operation_name
- description: description
- operation_type: operation_type
- trigger_id: trigger_id
- operation_definition: operation_definition
Request Example
---------------
.. literalinclude:: ./samples/scheduled-operation-create-request.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- scheduled_operation: operation
- id: operation_id
- name: operation_name
- description: description
- operation_type: operation_type
- trigger_id: trigger_id
- operation_definition: operation_definition
- enabled: enabled
Response Example
----------------
.. literalinclude:: ./samples/scheduled-operation-create-response.json
:language: javascript
Show scheduled operation
========================
.. rest_method:: GET /v1/{tenant_id}/scheduled_operations/{scheduled_operation_id}
Shows the specified scheduled operation information.
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
- scheduled_operation_id: operation_id_1
Response
--------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- scheduled_operation: operation
- id: operation_id
- name: operation_name
- description: description
- operation_type: operation_type
- trigger_id: trigger_id
- operation_definition: operation_definition
- enabled: enabled
Response Example
----------------
.. literalinclude:: ./samples/scheduled-operation-create-response.json
:language: javascript
Delete scheduled operation
==========================
.. rest_method:: DELETE /v1/{tenant_id}/scheduled_operations/{scheduled_operation_id}
Deletes a specific scheduled operation.
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
- scheduled_operation_id: operation_id_1

View File

@ -14,6 +14,12 @@ checkpoint_id_1:
in: path
required: true
type: UUID
operation_id_1:
description: |
The UUID of the scheduled operation.
in: path
required: true
type: UUID
protectable_type_1:
description: |
The name of a specified protectable type.
@ -89,12 +95,55 @@ description:
in: body
required: true
type: string
enabled:
description: |
"``1``" means ``Enable``, "``0``" means ``Disable``.
in: body
required: true
type: int
links:
description: |
Links for transfer.
in: body
required: true
type: array
operation:
description: |
A ``scheduled operation`` object.
in: body
required: true
type: object
operation_definition:
description: |
The operation definition for scheduled operation, include ``provider_id``
and ``plan_id`` key.
in: body
required: true
type: dict
operation_id:
description: |
The UUID of the scheduled operation.
in: body
required: true
type: UUID
operation_list:
description: |
The list of ``scheduled operation`` objects.
in: body
required: true
type: array
operation_name:
description: |
The name of the scheduled operation.
in: body
required: true
type: string
operation_type:
description: |
The type of the scheduled operation.
in: body
required: true
type: string
plan:
description: |
A ``plan`` object.
@ -257,3 +306,9 @@ tenant_id_1:
in: body
required: true
type: string
trigger_id:
description: |
The UUID of the trigger.
in: body
required: true
type: UUID

View File

@ -0,0 +1,11 @@
{"scheduled_operation": {
"name": "My scheduled operation",
"description": "It will run everyday",
"operation_type": "protect",
"trigger_id": "23902b02-5666-4ee6-8dfe-962ac09c3995",
"operation_definition": {
"provider_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa399",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
}
}
}

View File

@ -0,0 +1,13 @@
{"scheduled_operation": {
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"description": "It will run everyday",
"operation_type": "protect",
"trigger_id": "23902b02-5666-4ee6-8dfe-962ac09c3995",
"operation_definition": {
"provider_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa399",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
},
"enabled": 1
}
}

View File

@ -0,0 +1,22 @@
{"operations": [
{"scheduled_operation": {
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"description": "It will run everyday",
"operation_type": "protect",
"trigger_id": "23902b02-5666-4ee6-8dfe-962ac09c3995",
"operation_definition": {
"provider_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa399",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
},
"enabled": 1
}
},
],
"operations_links": [
{
"href": "/v1/{project_id}/scheduled_operations?limit={limit_num}&marker=1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"rel": "next"
}
]
}