Task相关接口
更新时间:2025-04-16
获取任务列表
描述
获取任务列表
请求结构
Plain Text
1GET /v2/tasks/{taskType} HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必须 | 参数位置 | 描述 |
---|---|---|---|---|
taskType | String | 是 | URL 参数 | 任务类型,目前仅支持 [InstanceGroupReplicas] |
targetID | String | 是 | Query 参数 | 任务目标对象 ID,任务类型为 InstanceGroupReplicas 时,targetID 是目标节点组的 ID |
operationType | String | 否 | Query 参数 | 操作类型,目前支持[ScalingUp, ScalingDown, Repair, ExistedScaleup],ScalingUp表示扩容,ScalingDown表示缩容,Repair 表示修改期望节点数的伸缩处理,ExistedScaleup表示添加已有节点到节点组的处理 |
phase | String | 否 | Query 参数 | 任务状态,目前支持[Pending, Processing, Done, Aborted, Collecting] |
order | String | 否 | Query 参数 | 排序方式,目前支持[ASC,DESC], 默认为DESC(降序),如果传ASC需要保证orderBy非空才有效。 |
orderBy | String | 否 | Query 参数 | 排序字段,目前仅支持[startTime], 默认为startTime(创建时间) |
pageNo | Integer | 否 | Query 参数 | 查询页码序号。 为0时不分页 |
pageSize | Integer | 否 | Query 参数 | 查询结果每页条目数。为0时不分页 |
返回头域
除公共头域,无其它特殊头域。
返回参数
参数名称 | 类型 | 描述 |
---|---|---|
page | ListTaskPage | 任务查询结果页 |
requestID | String | 请求 ID, 问题定位提供该 ID |
请求示例
Plain Text
1GET /api/cce/service/v2/tasks/InstanceGroupReplicas?targetID=cce-ig-h5zc8dqu&pageNo=1&pageSize=2 HTTP/1.1
2Host: cce.bj.baidubce.com
3Content-Type: application/json
4Authorization: authorization string
返回示例
Plain Text
1{
2 "requestID": "dc172e92-67b1-4697-97f7-ded9cccfa455",
3 "Page": {
4 "pageNo": 1,
5 "pageSize": 2,
6 "totalCount": 5,
7 "items": [
8 {
9 "id": "task-cce-ig-h5zc8dqu-scaleupexist-2w2snkxf",
10 "type": "InstanceGroupReplicas",
11 "description": "attach 4 instances to instancegroup",
12 "startTime": "2025-04-11T11:39:40Z",
13 "finishTime": "2025-04-11T11:47:09Z",
14 "phase": "Done",
15 "processes": [
16 {
17 "name": "MoveExistedInstanceIntoInstanceGroup",
18 "phase": "Done",
19 "startTime": "2025-04-11T19:39:41+08:00",
20 "finishTime": "2025-04-11T19:47:09+08:00",
21 "metrics": {
22 "cce-fm8eewfh-5v7gw5g2": "create_failed",
23 "cce-fm8eewfh-iw5kw5pu": "running",
24 "cce-fm8eewfh-l3f4lsbd": "running",
25 "cce-fm8eewfh-obgcevn2": "running"
26 }
27 }
28 ]
29 },
30 {
31 "id": "task-cce-ig-h5zc8dqu-scaledown-9xejb2fj",
32 "type": "InstanceGroupReplicas",
33 "description": "remove specified instances from instance group",
34 "startTime": "2025-04-11T11:32:56Z",
35 "finishTime": "2025-04-11T11:37:10Z",
36 "phase": "Done",
37 "processes": [
38 {
39 "name": "RemoveInstancesFromInstanceGroup",
40 "phase": "Done",
41 "startTime": "2025-04-11T19:32:56+08:00",
42 "finishTime": "2025-04-11T19:37:10+08:00",
43 "metrics": {
44 "cce-fm8eewfh-60cyxs3v": "Succeed",
45 "cce-fm8eewfh-djzjnidb": "Succeed",
46 "cce-fm8eewfh-nom6v0on": "Succeed",
47 "cce-fm8eewfh-qbdqj6aj": "Succeed"
48 }
49 }
50 ]
51 }
52 ]
53 }
54}
查看任务详情
描述
查看任务详情
请求结构
Plain Text
1GET /v2/task/{taskType}/{taskID} HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必须 | 参数位置 | 描述 |
---|---|---|---|---|
taskType | String | 是 | URL 参数 | 任务类型,目前仅支持 [InstanceGroupReplicas] |
taskID | String | 是 | URL 参数 | 任务 ID |
返回头域
除公共头域,无其它特殊头域。
返回参数
参数名称 | 类型 | 描述 |
---|---|---|
task | Task | 任务详情 |
requestID | String | 请求 ID, 问题定位提供该 ID |
请求示例
Plain Text
1GET /api/cce/service/v2/task/InstanceGroupReplicas/task-cce-ig-h5zc8dqu-scaleupexist-2w2snkxf~~~~ HTTP/1.1
2Host: cce.bj.baidubce.com
3Content-Type: application/json
4Authorization: authorization string
返回示例
Plain Text
1{
2 "requestID": "58731113-1d37-49e8-8644-afbc55cee5ef",
3 "task": {
4 "id": "task-cce-ig-h5zc8dqu-scaleupexist-2w2snkxf",
5 "type": "InstanceGroupReplicas",
6 "description": "attach 4 instances to instancegroup",
7 "startTime": "2025-04-11T11:39:40Z",
8 "finishTime": "2025-04-11T11:47:09Z",
9 "phase": "Done",
10 "processes": [
11 {
12 "name": "MoveExistedInstanceIntoInstanceGroup",
13 "phase": "Done",
14 "startTime": "2025-04-11T19:39:41+08:00",
15 "finishTime": "2025-04-11T19:47:09+08:00",
16 "metrics": {
17 "cce-fm8eewfh-5v7gw5g2": "create_failed",
18 "cce-fm8eewfh-iw5kw5pu": "running",
19 "cce-fm8eewfh-l3f4lsbd": "running",
20 "cce-fm8eewfh-obgcevn2": "running"
21 }
22 }
23 ]
24 }
25}