Add triggers api-ref

add api reference of triggers.

Change-Id: Ia9dcf6b8122e74d695a1b31c4df6fe169a6c2246
This commit is contained in:
zhangshuai 2016-09-22 10:22:43 +08:00
parent 61a511e4ab
commit 7793322269
8 changed files with 364 additions and 0 deletions

View File

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

View File

@ -0,0 +1,242 @@
.. -*- rst -*-
========
Triggers
========
This API enables the Karbor user to access the trigger registry and do
the following operations:
- Trigger CRUD.
- List Triggers.
List triggers
=============
.. rest_method:: GET /v1/{tenant_id}/triggers
List all the triggers offered for the given project, or part of the triggers
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
- triggers: trigger_list
- id: trigger_id
- type: trigger_type
- name: trigger_name
- properties: trigger_properties
- plans_links: links
Response Example
----------------
.. literalinclude:: ./samples/triggers-list-response.json
:language: javascript
Create trigger
==============
.. rest_method:: POST /v1/{tenant_id}/triggers
Create a new trigger.
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
- trigger_info: trigger
- type: trigger_type
- name: trigger_name
- properties: trigger_properties
Request Example
---------------
.. literalinclude:: ./samples/trigger-create-request.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- trigger_info: trigger
- id: trigger_id
- type: trigger_type
- name: trigger_name
- properties: trigger_properties
Response Example
----------------
.. literalinclude:: ./samples/trigger-create-response.json
:language: javascript
Show trigger
============
.. rest_method:: GET /v1/{tenant_id}/triggers/{trigger_id}
Shows the information about a specified trigger.
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
- trigger_id: trigger_id_1
Response
--------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- trigger_info: trigger
- id: trigger_id
- type: trigger_type
- name: trigger_name
- properties: trigger_properties
Response Example
----------------
.. literalinclude:: ./samples/trigger-create-response.json
:language: javascript
Update trigger
==============
.. rest_method:: PUT /v1/{tenant_id}/triggers/{trigger_id}
Updates the name or properties of a specific trigger alonely or at the same
time.
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
- trigger_id: trigger_id_1
- trigger_info: trigger
- name: trigger_name_1
- properties: trigger_properties_1
Request Example
---------------
.. literalinclude:: ./samples/trigger-update-request.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
- trigger_info: trigger
- id: trigger_id
- type: trigger_type
- name: trigger_name
- properties: trigger_properties
Response Example
----------------
.. literalinclude:: ./samples/trigger-update-response.json
:language: javascript
Delete trigger
==============
.. rest_method:: DELETE /v1/{tenant_id}/triggers/{trigger_id}
Deletes a specific trigger.
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
- trigger_id: trigger_id_1

View File

@ -44,6 +44,12 @@ tenant_id:
in: path
required: true
type: string
trigger_id_1:
description: |
The UUID of the trigger.
in: path
required: true
type: UUID
# variables in query
@ -306,9 +312,53 @@ tenant_id_1:
in: body
required: true
type: string
trigger:
description: |
A ``trigger`` object.
in: body
required: true
type: object
trigger_id:
description: |
The UUID of the trigger.
in: body
required: true
type: UUID
trigger_list:
description: |
The list of ``trigger`` objects.
in: body
required: true
type: array
trigger_name:
description: |
The name of the trigger.
in: body
required: true
type: string
trigger_name_1:
description: |
The name of the trigger.
in: body
required: false
type: string
trigger_properties:
description: |
The property list for trigger. it must include "``pattern``" and
"``window``", may include "``format``" "``start_time``" and "``end_time``".
in: body
required: true
type: dict
trigger_properties_1:
description: |
The property list for trigger. it must include "``pattern``" and
"``window``", may include "``format``" "``start_time``" and "``end_time``".
in: body
required: false
type: dict
trigger_type:
description: |
The type of the trigger.
in: body
required: true
type: string

View File

@ -0,0 +1,12 @@
{"trigger_info": {
"name": "My backup trigger",
"type": "time",
"properties": {
"format": "crontab",
"pattern": "0 9 * * *",
"start_time": "2015-12-17T08:30:00",
"end_time": "2016-03-17T08:30:00",
"window": "3600",
}
}
}

View File

@ -0,0 +1,13 @@
{"trigger_info": {
"id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"type": "time",
"name": "My backup trigger",
"properties": {
"format": "crontab",
"pattern": "0 9 * * *",
"start_time": "2015-12-17T08:30:00",
"end_time": "2016-03-17T08:30:00",
"window": "3600",
}
}
}

View File

@ -0,0 +1,11 @@
{"trigger_info": {
"name": "Trigger for backup",
"properties": {
"format": "crontab",
"pattern": "0 10 * * *",
"start_time": "2015-12-17T08:30:00",
"end_time": "2016-03-17T08:30:00",
"window": "3600",
}
}
}

View File

@ -0,0 +1,13 @@
{"trigger_info": {
"id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"type": "time",
"name": "Trigger for backup",
"properties": {
"format": "crontab",
"pattern": "0 10 * * *",
"start_time": "2015-12-17T08:30:00",
"end_time": "2016-03-17T08:30:00",
"window": "3600",
}
}
}

View File

@ -0,0 +1,22 @@
{"triggers": [
{"trigger_info": {
"id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"type": "time",
"name": "My backup trigger",
"properties": {
"format": "crontab",
"pattern": "0 9 * * *",
"start_time": "2015-12-17T08:30:00",
"end_time": "2016-03-17T08:30:00",
"window": "3600",
}
}
},
],
"triggers_links": [
{
"href": "/v1/{project_id}/triggers?limit={limit_num}&marker=2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"rel": "next"
}
]
}