任务组添加任务

POST/zstack/v1/scheduler/jobgroups/{schedulerJobGroupUuid}/job

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "schedulerJobUuids": [
      "ed43fba83eb63a1cacb38c113e2bd38a"
    ]
  },
  "systemTags": [],
  "userTags": []
}

上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"schedulerJobUuids":["ed43fba83eb63a1cacb38c113e2bd38a"]}}' \
http://localhost:8080/zstack/v1/scheduler/jobgroups/280d3a22ab363006b61b4a6c0318056f/job

参数列表

名字类型位置描述可选值起始版本
schedulerJobGroupUuidStringurl定时任务组UUID 3.4.0
schedulerJobUuidsListbody(包含在params结构中)定时任务UUID列表 3.4.0
priorities (可选)Mapbody(包含在params结构中)定时任务优先级 4.3.0
systemTags (可选)Listbody系统标签 3.4.0
userTags (可选)Listbody用户标签 3.4.0

API返回

该API成功时返回一个空的JSON结构**{}**,出错时返回的JSON结构包含一个error字段,例如:

{
  "error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
  }
}

SDK示例

Java SDK

AddSchedulerJobsToSchedulerJobGroupAction action = new AddSchedulerJobsToSchedulerJobGroupAction();
action.schedulerJobGroupUuid = "280d3a22ab363006b61b4a6c0318056f";
action.schedulerJobUuids = asList("ed43fba83eb63a1cacb38c113e2bd38a");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSchedulerJobsToSchedulerJobGroupAction.Result res = action.call();

Python SDK

AddSchedulerJobsToSchedulerJobGroupAction action = AddSchedulerJobsToSchedulerJobGroupAction()
action.schedulerJobGroupUuid = "280d3a22ab363006b61b4a6c0318056f"
action.schedulerJobUuids = [ed43fba83eb63a1cacb38c113e2bd38a]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSchedulerJobsToSchedulerJobGroupAction.Result res = action.call()