更新时间:2024-05-20 GMT+08:00
分享

查询任务列表

功能介绍

获取任务中心的任务列表。

接口约束

最多查询最近一个月的任务列表。

调试

您可以在API Explorer中调试该接口。

URI

GET https://{Endpoint}/v3/{project_id}/tasks

表1 参数说明

名称

是否必选

参数类型

说明

project_id

String

租户在某一Region下的项目ID。

获取方法请参见获取项目ID

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

任务进度,单位:%。

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" : null, 
    "fail_reason" : "ECS云服务器处理异常。"
  }, { 
    "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" : null, 
    "fail_reason" : null
  } ], 
  "total_count" : 2 
}

状态码

错误码

请参见错误码

分享:

    相关文档

    相关产品