更新定时任务(UpdateSchedulerJob)
API请求
URLs
PUT zstack/v1/scheduler/jobs/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateSchedulerJob": {
"name": "Test2",
"description": "new test"
},
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSchedulerJob":{"name":"Test2","description":"new test"}}' \
http://localhost:8080/zstack/v1/scheduler/jobs/676b5d17ee953aa892c6439a06e49bf6/actions
参数列表
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
---|---|---|---|---|---|
uuid | String | url | 资源的UUID,唯一标示该资源 | 2.1 | |
name (可选) | String | body(包含在updateSchedulerJob结构中) | 资源名称 | 2.1 | |
description (可选) | String | body(包含在updateSchedulerJob结构中) | 资源的详细描述 | 2.1 | |
systemTags (可选) | List | body | 2.1 | ||
userTags (可选) | List | body | 2.1 |
API返回
返回示例
{
"inventory": {
"uuid": "11f1249eaae74b50b909839492ee0991",
"targetResourceUuid": "eee374cb49904855ad1c46a1c92846af",
"name": "Test",
"description": "create volume snapshot job",
"createDate": "Jul 17, 2017 10:18:53 AM",
"lastOpDate": "Jul 17, 2017 10:18:53 AM"
}
}
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.1 |
inventory | SchedulerJobInventory | 详情参考inventory | 2.1 |
#error
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.1 |
description | String | 错误的概要描述 | 2.1 |
details | String | 错误的详细信息 | 2.1 |
elaboration | String | 保留字段,默认为null | 2.1 |
opaque | LinkedHashMap | 保留字段,默认为null | 2.1 |
cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.1 |
#inventory
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 2.1 |
targetResourceUuid | String | 2.1 | |
name | String | 资源名称 | 2.1 |
description | String | 资源的详细描述 | 2.1 |
state | String | 2.1 | |
createDate | Timestamp | 创建时间 | 2.1 |
lastOpDate | Timestamp | 最后一次修改时间 | 2.1 |
triggersUuid | List | 2.1 |
SDK示例
Java
SDK
UpdateSchedulerJobAction action = new UpdateSchedulerJobAction();
action.uuid = "4283a6a09fac4871ab8cd4f94384d32e";
action.name = "Test2";
action.description = "new test";
action.sessionId = "c15d0314892e493281494181e19eae02";
UpdateSchedulerJobAction.Result res = action.call();
Python
SDK
UpdateSchedulerJobAction action = UpdateSchedulerJobAction()
action.uuid = "f0696f10eb5b408b8f6fddb1094f7b2b"
action.name = "Test2"
action.description = "new test"
action.sessionId = "47041d647e834f5698e613a5e4a99a08"
UpdateSchedulerJobAction.Result res = action.call()