Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: wangdengke2 <wangdengke2@huawei.com> Co-committed-by: wangdengke2 <wangdengke2@huawei.com>
35 KiB
Obtaining Information About a Task with a Specified ID
Function
This API is used to obtain information about a task with a specified ID in the task center.
- Before calling an API, you need to understand the API in Authentication.
- Before calling this API, obtain the required region and endpoint.
Constraints
- RDS jobs are asynchronous. After a job is generated, it takes several seconds to query the job ID.
- This API is used to query only asynchronous tasks in the task center within one month.
- Information of the following asynchronous tasks can be obtained: creating single or primary/standby DB instances, creating read replicas, changing single DB instances to primary/standby instances, switching primary/standby DB instances, scaling up storage space, and binding or unbinding EIPs.
URI
- Parameter description
Table 1 Parameter description Name
Mandatory
Description
project_id
Yes
Specifies the project ID of a tenant in a region.
For details about how to obtain the project ID, see Obtaining a Project ID.
id
Yes
Specifies the task ID.
Request
- Request parameters
Table 2 Request header parameters Parameter
Mandatory
Type
Description
X-Auth-Token
Yes
String
Specifies the user token.
The user token is a response to the API used to obtain a user token.
Response
- Normal response
Table 3 Parameters Parameter
Type
Description
job
Object
Indicates the task information. For details, see Table 4.
Table 4 Job field data structure description Name
Type
Description
id
String
Indicates the task ID.
name
String
Indicates the task name.
status
String
Indicates the task execution status.
Value:- Running: The task is being executed.
- Completed: The task is successfully executed.
- Failed: The task fails to be executed.
created
String
Indicates the creation time in the "yyyy-mm-ddThh:mm:ssZ" format.
T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.
ended
String
Indicates the end time in the "yyyy-mm-ddThh:mm:ssZ" format.
T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.
process
String
Indicates the task execution progress.
NOTE:The execution progress (such as "60", indicating the task execution progress is 60%) is displayed only when the task is being executed. Otherwise, "" is returned.
instance
Object
Indicates information of the DB instance on which the task is executed.
For details, see Table 5.
entities
Object
The displayed information varies depending on the tasks.
For details, see Table 6.
NOTE:For asynchronous tasks without the entities field description, {} is returned.
fail_reason
String
Indicates the error information displayed when a task failed.
Table 5 instances field data structure description Name
Type
Description
id
String
Indicates the DB instance ID.
name
String
Indicates the DB instance name.
Table 6 entities field data structure description Name
Type
Description
instance
Object
Indicates the information required for creating an instance, changing a single instance to primary/standby, or creating a read replica.
For details, see Table 7.
resource_ids
Array of strings
Indicates the queried resource ID.
volume
Object
Indicates the resized disk information.
For details, see Table 9.
public_ip
String
Indicates the EIP implemented by the task.
switch_strategy
String
Indicates the primary/standby switchover policy.
Table 7 entities.instance field data structure description Name
Type
Description
endpoint
String
Indicates the DB instance connection address.
type
String
Indicates the DB instance type.
- Single: single-node instance
- Ha: primary/standby instance
- Replica: read replica
datastore
Object
Indicates the database information. For details, see Table 8.
replica_of
String
Indicates the primary DB instance ID. This parameter is returned only when a read replica is created.
Table 8 datastore field data structure description Name
Type
Description
type
String
Indicates the DB engine.
version
String
Indicates the database version.
- Example normal responseCreating a DB instance:
{ "job": { "id": "31b8ae23-c687-4d80-b7b4-42a66c9bb886", "name": "CreateMysqlSingleHAInstance", "status": "Completed", "created": "2018-08-06T10:41:14+0000", "ended": "2018-08-06T16:41:14+0000", "process": "", "instance": { "id": "a48e43ff268f4c0e879652d65e63d0fbin01", "name": "DO-NOT-TOUCH-mgr2-mysql-single" }, "entities": { "instance": { "endpoint": "192.168.1.203:3306", "type": "Single", "datastore": { "type": "mysql", "version": "5.7" } }, "resource_ids": ["a48e43ff268f4c0e879652d65e63d0fbin01.vm", "a48e43ff268f4c0e879652d65e63d0fbin01.volume"] } } }Creating a read replica:{ "job": { "id": "31b8ae23-c687-4d80-b7b4-42a66c9bb886", "name": " CreateMysqlReplicaInstance", "status": "Completed", "created": "2018-08-06T10:41:14+0000", "ended": "2018-08-06T16:41:14+0000", "process": "", "instance": { "id": "288caaa9d05f4ec1a1f58de2e0945685in01", "name": "mysql-replica" }, "entities": { "instance": { "endpoint": "192.168.1.203:3306", "type": "replica", "datastore": { "type": "mysql", "version": "5.7" }, "replica_of": "a48e43ff268f4c0e879652d65e63d0fbin01" }, "resource_ids": ["288caaa9d05f4ec1a1f58de2e0945685in01.vm", "288caaa9d05f4ec1a1f58de2e0945685in01.volume"] } } }Binding an EIP:{ "job": { "id": "31b8ae23-c687-4d80-b7b4-42a66c9bb886", "name": "MysqlBindEIP", "status": "Completed", "created": "2018-08-06T10:41:14+0000", "ended": "2018-08-06T16:41:14+0000", "process": "", "instance": { "id": "a48e43ff268f4c0e879652d65e63d0fbin01", "name": "DO-NOT-TOUCH-mgr2-mysql-single" }, "entities": { "public_ip": "10.10.10.1" } } }Rebooting a DB instance:{ "job": { "id": "31b8ae23-c687-4d80-b7b4-42a66c9bb886", "name": " RestartMysqlInstance", "status": "Completed", "created": "2018-08-06T10:41:14+0000", "ended": "2018-08-06T16:41:14+0000", "process": "", "instance": { "id": "a48e43ff268f4c0e879652d65e63d0fbin01", "name": "DO-NOT-TOUCH-mgr2-mysql-single" }, "entities": {} } }Task being executed:{ "job": { "id": "31 b8ae23 - c687 - 4 d80 - b7b4 - 42 a66c9bb886", "name": "CreateMysqlSingleHAInstance"," status": "Running", "created": "2018-08-06T10:41:14+0000", "process": "60% ", "instance": { "id": "a48e43ff268f4c0e879652d65e63d0fbin01", "name": "DO-NOT-TOUCH-mgr2-mysql-single" }, "entities": { "instance": { "type": "Single", "datastore": { "type": "mysql", "version": "5.7" } } } } }Task fails to be executed:{ "job": { "id": "31 b8ae23 - c687 - 4 d80 - b7b4 - 42 a66c9bb886", "name": "CreateMysqlSingleHAInstance", "status": "Failed", "created": "2018-08-06T10:41:14+0000", "ended": "2018-08-06T16:41:14+0000", "process": "", "instance": { "id": "a48e43ff268f4c0e879652d65e63d0fbin01", "name": "DO-NOT-TOUCH-mgr2-mysql-single" }, "entities": { "instance": { "type": "Single", "datastore": { "type": "mysql", "version": "5.7" } } }, "fail_reason": "createVM failed." } } - Abnormal Response
For details, see Abnormal Request Results.
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.
