创建执行
更新时间:2026-07-16
描述
可以通过如下两种方式创建执行:
- 引用一个已存在的模板(参考请求示例1)
- 在创建执行时动态创建一个模板(参考请求示例2)
OpenAPI Explorer
去调试
您可以在 OpenAPI Explorer 中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer 可以自动生成 SDK 代码示例。
请求结构
Plain Text
1POST /v{version}/execution?locale={locale}
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "description": description,
7 "template": {
8 "id": id,
9 "ref": ref,
10 "name": name,
11 "type": type,
12 "description": description,
13 "tags": [
14 {}
15 ],
16 "linear": linear,
17 "parallelism": parallelism,
18 "operators": [
19 {
20 "name": name,
21 "description": description,
22 "tags": [
23 {}
24 ],
25 "operator": operator,
26 "label": label,
27 "retries": retries,
28 "retryInterval": retryInterval,
29 "timeout": timeout,
30 "parallelismRatio": parallelismRatio,
31 "parallelismCount": parallelismCount,
32 "parallelismControl": {
33 "ratio": ratio,
34 "count": count
35 },
36 "allowedFailureRatio": allowedFailureRatio,
37 "allowedFailureCount": allowedFailureCount,
38 "allowedFailureControl": {
39 "ratio": ratio,
40 "count": count
41 },
42 "manually": manually,
43 "scheduleDelayMilli": scheduleDelayMilli,
44 "waitOnAgentMilli": waitOnAgentMilli,
45 "pauseOnFailure": pauseOnFailure,
46 "condition": condition,
47 "breakpoints": [breakpoints],
48 "triggerRule": triggerRule,
49 "loopWindowType": loopWindowType,
50 "properties": properties,
51 "loops": [
52 {}
53 ]
54 }
55 ],
56 "links": [
57 {
58 "src": src,
59 "dst": dst
60 }
61 ],
62 "properties": [
63 {
64 "name": name,
65 "required": required,
66 "type": type,
67 "label": label,
68 "description": description,
69 "multiple": multiple,
70 "options": [options],
71 "selectOptions": [
72 {
73 "label": label,
74 "value": value
75 }
76 ],
77 "defaultValue": defaultValue
78 }
79 ],
80 "updatedTime": updatedTime,
81 "supportedInstanceTypes": [supportedInstanceTypes]
82 },
83 "parallelism": parallelism,
84 "manually": manually,
85 "properties": properties,
86 "tags": [
87 {
88 "tagKey": tagKey,
89 "tagValue": tagValue
90 }
91 ]
92}
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| version | String | 是 | URL参数 | API版本号,当前取值为2 |
| locale | String | 否 | Query参数 | 语言,默认 zh-cn |
| description | String | 否 | RequestBody参数 | 执行描述 |
| template | Template | 是 | RequestBody参数 | 嵌套引用的子模板 |
| parallelism | Integer | 否 | RequestBody参数 | 并发度 |
| manually | Boolean | 否 | RequestBody参数 | 是否手动触发 |
| properties | Object | 否 | RequestBody参数 | 全局参数取值集合 |
| tags | List<Tag> | 否 | RequestBody参数 | 执行绑定标签列表 |
返回头域
除公共头域,无其它特殊头域。
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| success | Boolean | 请求是否成功 |
| msg | String | 失败时返回失败原因,成功时为空字符串 |
| code | Integer | 状态码 |
| result | Object | 创建成功的执行详情 |
请求示例,1
Plain Text
1POST /v{version}/execution?locale={locale}
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "template" : {
7 "ref" : "tpl-tKXV1J**",
8 "name" : "test_oos_template",
9 "linear" : true
10 },
11 "properties" : {
12 "param1" : "testParam"
13 },
14 "description" : "这是一段描述",
15 "tags" : [ {
16 "tagKey" : "key2",
17 "tagValue" : "value2"
18 } ]
19}
请求示例,2
Plain Text
1POST /v{version}/execution?locale={locale}
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "template" : {
7 "name" : "runcommand",
8 "description" : "",
9 "linear" : false,
10 "parallelism" : 10,
11 "operators" : [ {
12 "name" : "call0",
13 "description" : "用户虚机执行脚本",
14 "operator" : "BCE::Agent::ExecuteShell",
15 "label" : "",
16 "retries" : 0,
17 "retryInterval" : 60000,
18 "timeout" : 3600000,
19 "parallelismRatio" : 0,
20 "parallelismCount" : 0,
21 "parallelismControl" : {
22 "ratio" : 0,
23 "count" : 0
24 },
25 "allowedFailureRatio" : 0,
26 "allowedFailureCount" : 0,
27 "allowedFailureControl" : {
28 "ratio" : 0,
29 "count" : 0
30 },
31 "manually" : false,
32 "scheduleDelayMilli" : 0,
33 "waitOnAgentMilli" : 0,
34 "pauseOnFailure" : false,
35 "triggerRule" : "ALL_SUCCESS",
36 "loopWindowType" : "SLICING",
37 "properties" : {
38 "execUser" : "root",
39 "workDir" : "/home",
40 "__workerSelectors__" : {
41 "type" : "INSTANCE_IDS",
42 "instanceIds" : [ "i-gMxxxx", "i-ttxxxx" ]
43 },
44 "content" : "echo 'hello call0'"
45 }
46 }, {
47 "name" : "call1",
48 "description" : "用户虚机执行脚本",
49 "operator" : "BCE::Agent::ExecuteShell",
50 "label" : "",
51 "retries" : 0,
52 "retryInterval" : 60000,
53 "timeout" : 3600000,
54 "parallelismRatio" : 0,
55 "parallelismCount" : 0,
56 "parallelismControl" : {
57 "ratio" : 0,
58 "count" : 0
59 },
60 "allowedFailureRatio" : 0,
61 "allowedFailureCount" : 0,
62 "allowedFailureControl" : {
63 "ratio" : 0,
64 "count" : 0
65 },
66 "manually" : false,
67 "scheduleDelayMilli" : 0,
68 "waitOnAgentMilli" : 0,
69 "pauseOnFailure" : false,
70 "triggerRule" : "ALL_SUCCESS",
71 "loopWindowType" : "SLICING",
72 "properties" : {
73 "execUser" : "root",
74 "workDir" : "/home",
75 "__workerSelectors__" : {
76 "type" : "INSTANCE_IDS",
77 "instanceIds" : [ "i-gMxxxx", "i-ttxxxx" ]
78 },
79 "content" : "echo 'hello call1'"
80 }
81 } ],
82 "links" : [ {
83 "src" : "call0",
84 "dst" : "call1"
85 } ]
86 }
87}
返回示例
Plain Text
1200 Success
2
3{
4 "success" : true,
5 "msg" : "",
6 "code" : 200,
7 "result" : {
8 "id" : "d-CRpnWZ******"
9 }
10}
评价此篇文章
