Update the api doc part of scheduled operation

The api doc is not consistent with the codes regarding to scheduled
operation, so update it.

Change-Id: I4f1d9d2f64d6d02d4015ea54124ee170029ba525
This commit is contained in:
zengchen 2016-09-05 16:13:58 +08:00
parent bbc3c673a9
commit 5ea596efb1
3 changed files with 133 additions and 73 deletions

View File

@ -267,45 +267,55 @@ None
> **get** : /v1/{project_id}/scheduled_operations
#### Response JSON ####
```json
[
{
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"project_id": "23902b02-5666-4ee6-8dfe-962ac09c3994",
"operation_type": "protect",
"operation_definition": {
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
}
},
]
{"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": ""
}
```
### Create Scheduled Operation ###
> **post** : /v1/{project_id}/scheduled_operations
#### Request JSON ####
```json
{
"name": "My scheduled operation",
"project_id": "23902b02-5666-4ee6-8dfe-962ac09c3994",
"operation_type": "protect",
"operation_definition": {
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
{"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"
}
}
}
```
#### Response JSON ####
```json
{
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"project_id": "23902b02-5666-4ee6-8dfe-962ac09c3994",
"operation_type": "protect",
"operation_definition": {
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
{"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
}
}
```
@ -314,16 +324,18 @@ None
> **get** : /v1/{project_id}/scheduled_operations/{scheduled_operation_id}
#### Response JSON ####
```json
{
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"project_id": "23902b02-5666-4ee6-8dfe-962ac09c3994",
"operation_type": "protect",
"operation_definition": {
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
},
"next_schedule_time": "2016-1-5T08:30:00"
{"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

@ -613,6 +613,9 @@ paths:
parameters:
- $ref: '#/parameters/projectParam'
- $ref: '#/parameters/nameFilterParam'
- $ref: '#/parameters/scheduled_operation_typeFilterParam'
- $ref: '#/parameters/trigger_idParam'
- $ref: '#/parameters/scheduled_operation_defFilterParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
@ -627,18 +630,24 @@ paths:
items:
$ref: '#/definitions/ScheduledOperation'
examples:
application/json: [
{
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"project_id": "23902b02-5666-4ee6-8dfe-962ac09c3994",
"operation_type": "protect",
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"operation_definition": {
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
}
},
]
application/json: {
"operations": [ {
"scheduled_operation": {
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"description": "It will run everyday",
"operation_type": "protect",
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"operation_definition": {
"provider_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa399",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
},
"enabled": 1
}
},
],
"operations_links": ""
}
default:
description: Unexpected error
schema:
@ -656,7 +665,7 @@ paths:
in: body
required: true
schema:
$ref: '#/definitions/ScheduledOperation'
$ref: '#/definitions/ScheduledOperationCreateBody'
responses:
'200':
description: The new scheduled operation
@ -664,15 +673,19 @@ paths:
$ref: '#/definitions/ScheduledOperation'
examples:
application/json: {
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"project_id": "23902b02-5666-4ee6-8dfe-962ac09c3994",
"operation_type": "protect",
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"operation_definition": {
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
"scheduled_operation": {
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"description": "It will run everyday",
"operation_type": "protect",
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"operation_definition": {
"provider_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa399",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
},
"enabled": 1
}
}
}
default:
description: Unexpected error
schema:
@ -695,15 +708,19 @@ paths:
$ref: '#/definitions/ScheduledOperation'
examples:
application/json: {
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"project_id": "23902b02-5666-4ee6-8dfe-962ac09c3994",
"operation_type": "protect",
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"operation_definition": {
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
"scheduled_operation": {
"id": "1a2c0c3d-f402-4cd8-b5db-82e85cb51fad",
"name": "My scheduled operation",
"description": "It will run everyday",
"operation_type": "protect",
"trigger_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"operation_definition": {
"provider_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa399",
"plan_id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398"
},
"enabled": 1
}
}
}
default:
description: Unexpected error
schema:
@ -1316,19 +1333,38 @@ definitions:
name:
type: string
description: Display name of scheduled operation.
project_id:
type: string
format: UUID
operation_type:
type: string
description:
type: string
description: Description about the scheduled operation.
operation_type:
type: string
trigger_id:
type: string
format: UUID
operation_definition:
$ref: '#/definitions/OperationDefinition'
type: object
description: |
Supply parameters for the operation type.
enabled:
type: integer
ScheduledOperationCreateBody:
type: object
properties:
name:
type: string
description: Display name of scheduled operation.
description:
type: string
description: Description about the scheduled operation.
operation_type:
type: string
trigger_id:
type: string
format: UUID
operation_definition:
type: object
description: |
Supply parameters for the operation type.
OperationStatus:
type: object
properties:
@ -1587,6 +1623,19 @@ parameters:
required: true
in: path
description: id of the scheduled operation.
scheduled_operation_typeFilterParam:
name: operation_type
in: query
description: type of the scheduled operation.
required: false
type: string
scheduled_operation_defFilterParam:
name: operation_definition
in: query
format: regex
description: definition of the scheduled operation. Could be a regex pattern.
required: false
type: string
operation_log_idParam:
name: operation_log_id
type: string

View File

@ -50,7 +50,6 @@ class ScheduledOperationViewBuilder(common.ViewBuilder):
'name': operation.get('name'),
'description': operation.get('description'),
'operation_type': operation.get('operation_type'),
'project_id': operation.get('project_id'),
'trigger_id': operation.get('trigger_id'),
'operation_definition': operation.get('operation_definition'),
'enabled': operation.get('enabled'),