查询任务列表
功能介绍
获取任务中心的任务列表。
接口约束
最多查询最近一个月的任务列表。
调试
您可以在API Explorer中调试该接口。
URI
GET https://{
Endpoint
}/v3/{project_id}/tasks
表1 参数说明
名称
是否必选
参数类型
说明
project_id
是
String
参数解释:
租户在某一Region下的项目ID。
获取方法请参见获取项目ID。
约束限制:
不涉及。
取值范围:
只能由英文字母、数字组成,且长度为32个字符。
默认取值:
不涉及。
status
否
String
任务状态。
- Running:运行中
- Completed:完成
- Failed:失败
name
否
String
任务名称。
- CreateGaussDBV5Instance:创建实例。
- BackupSnapshotGaussDBV5InInstance:手动创建备份。
- CloneGaussDBV5NewInstance:恢复到新实例。
- RestoreGaussDBV5InInstance:恢复到当前实例。
- RestoreGaussDBV5InInstanceToExistedInst:恢复到已有实例
- DeleteGaussDBV5Instance:删除实例。
- EnlargeGaussDBV5Volume:磁盘扩容。
- ResizeGaussDBV5Flavor:规格变更。
- GaussDBV5ExpandClusterCN:协调节点扩容。
- GaussDBV5ExpandClusterDN:分片扩容。
start_time
否
String
开始时间。UNIX时间戳格式,单位是毫秒,时区是UTC。
end_time
否
String
结束时间。UNIX时间戳格式,单位是毫秒,时区是UTC。
offset
否
Integer
索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
limit
否
Integer
查询记录数。默认为100,不能为负数,最小值为1,最大值为100。
请求参数
无。
响应参数
表2 要素说明
名称
参数类型
说明
tasks
Array of objects
任务列表。
详情请参见表3 tasks字段数据结构说明。
total_count
Integer
任务数量。
表3 tasks字段数据结构说明
名称
参数类型
说明
instance_info
Object
任务绑定的实例信息。
详情请参见表4 instance_info字段数据结构说明。
job_id
String
任务ID。
name
String
任务名称。
status
String
任务状态。
process
String
任务进度,单位:%。
created_at
String
创建时间,格式为“yyyy-mm-ddThh:mm:ssZ”。
其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
ended_at
String
结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。
其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
fail_reason
String
失败原因。
表4 instance_info字段数据结构说明
名称
参数类型
说明
instance_id
String
实例ID。
instance_name
String
实例名称。
instance_status
String
实例状态。
请求示例
-
查询任务状态为“运行中”的任务列表
GET https://gaussdb-opengauss.cn-north-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/tasks?status=Running&name=CreateGaussDBV5Instance&offset=1&limit=10 -
查询任务状态为“完成”的任务列表
GET https://gaussdb-opengauss.cn-north-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/tasks?status=Completed&name=CreateGaussDBV5Instance&offset=1&limit=10 -
查询任务状态为“失败”的任务列表
GET https://gaussdb-opengauss.cn-north-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/tasks?status=Failed&name=CreateGaussDBV5Instance&offset=1&limit=10
响应示例
查询任务列表成功。
{
"tasks" : [ {
"instance_info" : {
"instance_id" : "ce2dce50f365430abe161bab79495a6ein14",
"instance_name" : "gauss-6568-zzh",
"instance_status" : "creating"
},
"job_id" : "03bc055a-135c-4245-8bd8-b0bc6d3350b3",
"name" : "CreateGaussDBV5Instance",
"status" : "Failed",
"process" : "",
"created_at": "2022-08-05T08:15:07+0800",
"ended_at": "2022-08-09T03:06:52+0800",
"fail_reason" : "500000"
}, {
"instance_info" : {
"instance_id" : "20ba433bd7ee40da9cf35064f04f9e4cin14",
"instance_name" : "gauss-7875-lt-m",
"instance_status" : "deleted"
},
"job_id" : "2cc16e0b-75ab-4a28-9453-16517e990bba",
"name" : "DeleteGaussDBV5Instance",
"status" : "Completed",
"process" : "",
"created_at": "2022-08-06T09:15:07+0800",
"ended_at": "2022-08-10T03:06:52+0800",
"fail_reason" : null
} ],
"total_count" : 2
}
状态码
-
正常
200
-
异常
请参见状态码。
错误码
请参见错误码。