The periodic task management APS type defines the platform built-in service that allows the applications to manage periodic tasks in the platform.
In this document:
The considered APS type (download
)
extends the Resource APS type(s) and looks as follows:
{
"name": "PeriodicTaskManagement",
"id": "http://www.parallels.com/pa/pa-core-services/periodic-task-manager/1.0",
"apsVersion": "2.0",
"implements": [
"http://aps-standard.org/types/core/resource/1.0"
],
"access": {
"global": true
},
"operations": {
"schedulePeriodicTask": {
"path": "/tasks",
"verb": "POST",
"response": {
"type": "PeriodicTaskInfo"
},
"errorResponse": {
"type": "object"
},
"parameters": {
"taskInfo": {
"kind": "body",
"type": "PeriodicTaskInfo"
}
}
},
"reschedulePeriodicTask": {
"path": "/tasks/{taskUuid}",
"verb": "PUT",
"response": {
"type": "Schedule"
},
"errorResponse": {
"type": "object"
},
"parameters": {
"taskUuid": {
"kind": "path",
"type": "string"
}
}
},
"cancelPeriodicTask": {
"path": "/tasks/{taskUuid}",
"verb": "DELETE",
"errorResponse": {
"type": "object"
},
"parameters": {
"taskUuid": {
"kind": "path",
"type": "string"
}
}
},
"getPeriodicTaskStatus": {
"path": "/tasks",
"verb": "GET",
"response": {
"type": "PeriodicTaskStatus"
},
"errorResponse": {
"type": "object"
},
"access": {
"referrer": false,
"public": false
},
"parameters": {
"taskType": {
"kind": "query",
"type": "string"
},
"appInstanceId": {
"kind": "query",
"type": "string"
}
}
},
"runPeriodicTask": {
"path": "/tasks",
"verb": "PUT",
"errorResponse": {
"type": "object"
},
"access": {
"referrer": false,
"public": false
},
"parameters": {
"taskType": {
"kind": "query",
"type": "string"
},
"appInstanceId": {
"kind": "query",
"type": "string"
}
}
}
},
"structures": {
"ServiceCall": {
"type": "object",
"properties": {
"resourceId": {
"type": "string"
},
"path": {
"type": "string"
},
"headers": {
"type": "object"
},
"verb": {
"type": "string"
},
"entity": {
"type": "string"
}
}
},
"Schedule": {
"type": "object",
"properties": {
"period": {
"type": "integer",
"required": true
},
"periodType": {
"type": "string"
},
"startDay": {
"type": "integer"
},
"startHour": {
"type": "integer"
},
"startMinute": {
"type": "integer"
}
}
},
"PeriodicTaskInfo": {
"type": "object",
"properties": {
"taskUuid": {
"type": "string"
},
"taskName": {
"type": "string"
},
"taskDescription": {
"type": "string"
},
"callInfo": {
"type": "ServiceCall"
},
"schedule": {
"type": "Schedule"
}
}
},
"PeriodicTaskStatus": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"started": {
"type": "string"
}
}
}
}
}
NAME | VALUES | DESCRIPTION |
---|---|---|
PeriodicTaskExecutionStatus |
|
Request status of the periodic task. |
OPERATION | VERB | PATH | RETURNS | Description |
---|---|---|---|---|
cancelPeriodicTask | DELETE | /tasks/{taskUuid} | If successful, this method returns the 200 OK standard status code. | Delete the specified periodic task. |
getPeriodicTaskStatus | GET | /tasks | If successful, this method returns the PeriodicTaskStatus structure in the response body. | Get the current status of the task that polls the resource usage of the specified application. |
reschedulePeriodicTask | PUT | /tasks/{taskUuid} | If successful, this method returns the Schedule structure in the response body. | Reschedule the specified periodic task. |
runPeriodicTask | PUT | /tasks | If successful, this method returns the 200 OK standard status code. | Run a periodic task that must poll the resource usage of the specified application. |
schedulePeriodicTask | POST | /tasks | If successful, this method returns the PeriodicTaskInfo structure in the response body. | Schedule a periodic task. |
HTTP Request
DELETE /aps/2/resources/{aps-id}/tasks/{taskUuid}
Description
Delete the specified periodic task.
Parameters
PARAMETER | TYPE | DESCRIPTION |
---|---|---|
taskUuid | String | Task uuid |
Returns
If successful, this method returns the 200 OK standard status code.
HTTP Request
GET /aps/2/resources/{aps-id}/tasks
Description
Get the current status of the task that polls the resource usage of the specified application.
Parameters
PARAMETER | TYPE | DESCRIPTION |
---|---|---|
appInstanceId | String | Application instance id |
taskType | String | Task type |
Returns
If successful, this method returns the PeriodicTaskStatus structure in the response body.
HTTP Request
PUT /aps/2/resources/{aps-id}/tasks/{taskUuid}
Description
Reschedule the specified periodic task.
Parameters
PARAMETER | TYPE | DESCRIPTION |
---|---|---|
schedule | Schedule | Schedule |
taskUuid | String | Task uuid |
Returns
If successful, this method returns the Schedule structure in the response body.
HTTP Request
PUT /aps/2/resources/{aps-id}/tasks
Description
Run a periodic task that must poll the resource usage of the specified application.
Parameters
PARAMETER | TYPE | DESCRIPTION |
---|---|---|
appInstanceId | String | Application instance id |
taskType | String | Task type |
Returns
If successful, this method returns the 200 OK standard status code.
HTTP Request
POST /aps/2/resources/{aps-id}/tasks
Description
Schedule a periodic task.
Parameters
PARAMETER | TYPE | DESCRIPTION |
---|---|---|
taskInfo | PeriodicTaskInfo | PeriodicTaskInfo |
Returns
If successful, this method returns the PeriodicTaskInfo structure in the response body.
Information about a periodic task.
NAME | TYPE | ATTRIBUTES | DEFAULT | DESCRIPTION |
---|---|---|---|---|
callInfo | ServiceCall | Not Required | Service call ServiceCall | |
schedule | Schedule | Not Required | Schedule Schedule | |
taskDescription | String | Not Required | Task description | |
taskName | String | Not Required | Task name | |
taskUuid | String | Not Required | Task Universally Unique Identifier |
Information about the task that collects resource usage.
NAME | TYPE | ATTRIBUTES | DEFAULT | DESCRIPTION |
---|---|---|---|---|
message | String | Not Required | Stask trace error | |
started | timestamp string | Not Required | The date and time the task started. | |
status | enum PeriodicTaskExecutionStatus | Not Required | Enum: SUCCESS, RUNNING, FAILED, NOTSTARTED. | |
title | String | Not Required | Title of the task. |
Initialization data for scheduling a periodic task
NAME | TYPE | ATTRIBUTES | DEFAULT | DESCRIPTION |
---|---|---|---|---|
period | Integer | Required | Required field. Period the launch | |
periodType | String | Not Required | Type ‘week’, ‘day’ … | |
startDay | Integer | Not Required | Start day | |
startHour | Integer | Not Required | Start hour | |
startMinute | Integer | Not Required | Start minute |
Service call initialization data.
NAME | TYPE | ATTRIBUTES | DEFAULT | DESCRIPTION |
---|---|---|---|---|
entity | String | Not Required | Entity | |
headers | key-value pairs of String | Not Required | Map. HTTP header fields | |
path | String | Not Required | URI resource | |
resourceId | String | Not Required | ID of the resource. | |
verb | String | Not Required | Method: ‘GET’, ‘POST’ … |
Since the considered APS type contains custom operations, refer to Custom Operations for the general explanation of their structure and examples of operation calls.