更新运维模板
更新时间:2026-07-16
描述
该接口用于更新运维模版,注意模版名称无法更改。
OpenAPI Explorer
去调试
您可以在 OpenAPI Explorer 中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer 可以自动生成 SDK 代码示例。
请求结构
Plain Text
1PUT /v{version}/template
2Host: oos.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "namespace": namespace,
7 "id": id,
8 "name": name,
9 "description": description,
10 "tags": [
11 {
12 "key": key,
13 "value": value
14 }
15 ],
16 "linear": linear,
17 "parallelism": parallelism,
18 "operators": [
19 {
20 "name": name,
21 "description": description,
22 "tags": [
23 {
24 "key": key,
25 "value": value
26 }
27 ],
28 "operator": operator,
29 "label": label,
30 "template": {
31 "id": id,
32 "ref": ref,
33 "name": name,
34 "type": type,
35 "description": description,
36 "tags": [
37 {
38 "key": key,
39 "value": value
40 }
41 ],
42 "linear": linear,
43 "parallelism": parallelism,
44 "operators": [
45 {
46 "name": name,
47 "description": description,
48 "tags": [
49 {
50 "key": key,
51 "value": value
52 }
53 ],
54 "operator": operator,
55 "label": label,
56 "template": {
57 "id": id,
58 "ref": ref,
59 "name": name,
60 "type": type,
61 "description": description,
62 "tags": tags,
63 "linear": linear,
64 "parallelism": parallelism,
65 "operators": operators,
66 "links": links,
67 "properties": properties,
68 "updatedTime": updatedTime,
69 "supportedInstanceTypes": supportedInstanceTypes
70 },
71 "retries": retries,
72 "retryInterval": retryInterval,
73 "timeout": timeout,
74 "parallelismRatio": parallelismRatio,
75 "parallelismCount": parallelismCount,
76 "parallelismControl": {
77 "ratio": ratio,
78 "count": count
79 },
80 "allowedFailureRatio": allowedFailureRatio,
81 "allowedFailureCount": allowedFailureCount,
82 "allowedFailureControl": {
83 "ratio": ratio,
84 "count": count
85 },
86 "manually": manually,
87 "scheduleDelayMilli": scheduleDelayMilli,
88 "waitOnAgentMilli": waitOnAgentMilli,
89 "pauseOnFailure": pauseOnFailure,
90 "condition": condition,
91 "breakpoints": [breakpoints],
92 "triggerRule": triggerRule,
93 "loopWindowType": loopWindowType,
94 "properties": properties,
95 "loops": [
96 {}
97 ]
98 }
99 ],
100 "links": [
101 {
102 "src": src,
103 "dst": dst
104 }
105 ],
106 "properties": [
107 {
108 "name": name,
109 "required": required,
110 "type": type,
111 "label": label,
112 "description": description,
113 "multiple": multiple,
114 "options": [options],
115 "selectOptions": [
116 {
117 "label": label,
118 "value": value
119 }
120 ],
121 "defaultValue": defaultValue
122 }
123 ],
124 "updatedTime": updatedTime,
125 "supportedInstanceTypes": [supportedInstanceTypes]
126 },
127 "retries": retries,
128 "retryInterval": retryInterval,
129 "timeout": timeout,
130 "parallelismRatio": parallelismRatio,
131 "parallelismCount": parallelismCount,
132 "parallelismControl": {
133 "ratio": ratio,
134 "count": count
135 },
136 "allowedFailureRatio": allowedFailureRatio,
137 "allowedFailureCount": allowedFailureCount,
138 "allowedFailureControl": {
139 "ratio": ratio,
140 "count": count
141 },
142 "manually": manually,
143 "scheduleDelayMilli": scheduleDelayMilli,
144 "waitOnAgentMilli": waitOnAgentMilli,
145 "pauseOnFailure": pauseOnFailure,
146 "condition": condition,
147 "breakpoints": [breakpoints],
148 "triggerRule": triggerRule,
149 "loopWindowType": loopWindowType,
150 "properties": properties,
151 "loops": [
152 {}
153 ]
154 }
155 ],
156 "links": [
157 {
158 "src": src,
159 "dst": dst
160 }
161 ],
162 "properties": [
163 {
164 "name": name,
165 "required": required,
166 "type": type,
167 "label": label,
168 "description": description,
169 "multiple": multiple,
170 "options": [options],
171 "selectOptions": [
172 {
173 "label": label,
174 "value": value
175 }
176 ],
177 "defaultValue": defaultValue
178 }
179 ]
180}
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| version | String | 是 | URL参数 | API版本号,当前取值为2 |
| namespace | String | 否 | RequestBody参数 | 名称空间,默认 default |
| id | String | 是 | RequestBody参数 | 模板唯一标识,由服务端生成,更新模版需要传递此字段,查询详情和列表时响应此字段 |
| name | String | 是 | RequestBody参数 | 模板名称,和原名称保持一致 |
| description | String | 否 | RequestBody参数 | 模板描述 |
| tags | List<KeyValuePair> | 否 | RequestBody参数 | 模板标签 |
| linear | Boolean | 否 | RequestBody参数 | 任务是否串行执行,默认false |
| parallelism | Integer | 否 | RequestBody参数 | 并发度,当linear=false的时候,可以控制Operator并发执行的数量 |
| operators | List<Operator> | 是 | RequestBody参数 | 模板任务步骤列表 |
| links | List<LinkModel> | 否 | RequestBody参数 | 描述 operator 之间的拓扑关系,linear=false 时必填 |
| properties | List<Property> | 否 | RequestBody参数 | 全局参数列表 |
返回头域
除公共头域,无其它特殊头域。
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| success | Boolean | 请求是否成功 |
| msg | String | 失败时返回失败原因,成功时为空字符串 |
请求示例
Plain Text
1PUT /v{version}/template
2Host: oos.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "id" : "tpl-tKXV1J**",
7 "namespace" : "default",
8 "name" : "Test",
9 "description" : "这是描述",
10 "operators" : [ {
11 "name" : "testCMD",
12 "description" : "exec cmd on agent",
13 "operator" : "BCE::Agent::ExecuteShell",
14 "inline" : false,
15 "retries" : 0,
16 "retryInterval" : 60000,
17 "timeout" : 300000,
18 "properties" : {
19 "execUser" : "root",
20 "workDir" : "/",
21 "__workerSelectors__" : {
22 "Ref" : "instanceList"
23 },
24 "content" : "echo 'hello world'"
25 }
26 } ],
27 "linear" : true,
28 "properties" : [ {
29 "name" : "instanceList",
30 "required" : true,
31 "type" : "bccInstance",
32 "description" : "instance list"
33 } ]
34}
返回示例
Plain Text
1200 Success
2
3{
4 "success" : true,
5 "msg" : "",
6 "code" : 200
7}
评价此篇文章
