修改我的命令
更新时间:2026-07-28
描述
修改我的命令。
OpenAPI Explorer
去调试
您可以在 OpenAPI Explorer 中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer 可以自动生成 SDK 代码示例。
请求结构
Plain Text
1PUT /v{version}/ca/action
2Host: ca.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "execution": execution,
7 "action": {
8 "id": id,
9 "ref": ref,
10 "type": type,
11 "name": name,
12 "alias": alias,
13 "description": description,
14 "timeoutSecond": timeoutSecond,
15 "command": {
16 "type": type,
17 "content": content,
18 "scope": scope,
19 "enableParameter": enableParameter,
20 "parameters": [
21 {
22 "name": name,
23 "desc": desc,
24 "required": required,
25 "defaultValue": defaultValue
26 }
27 ],
28 "user": user,
29 "workDir": workDir,
30 "execParams": execParams,
31 "waitOnAgentMilli": waitOnAgentMilli
32 },
33 "fileUpload": {
34 "os": os,
35 "content": content,
36 "filename": filename,
37 "filepath": filepath,
38 "bosBucketName": bosBucketName,
39 "bosFilePath": bosFilePath,
40 "bosEtag": bosEtag,
41 "user": user,
42 "group": group,
43 "mode": mode,
44 "overwrite": overwrite
45 },
46 "supportedInstanceTypes": [supportedInstanceTypes],
47 "createdTimestamp": createdTimestamp,
48 "updatedTimestamp": updatedTimestamp
49 },
50 "parameters": parameters,
51 "targetSelectorType": targetSelectorType,
52 "targets": [
53 {
54 "instanceType": instanceType,
55 "instanceId": instanceId,
56 "instanceName": instanceName,
57 "internalIp": internalIp,
58 "externalIp": externalIp,
59 "bandwidth": bandwidth
60 }
61 ],
62 "targetSelector": {
63 "instanceType": instanceType,
64 "tags": [
65 {
66 "tagKey": tagKey,
67 "tagValue": tagValue
68 }
69 ],
70 "importInstances": {
71 "keywordType": keywordType,
72 "instances": [instances]
73 }
74 }
75}
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| version | String | 是 | URL参数 | API版本号,当前取值为1 |
| execution | execution | 是 | RequestBody参数 | 执行动作。SAVE(仅保存),RUN(仅执行),SAVE_AND_RUN(保存并执行) |
| action | Action | 是 | RequestBody参数 | |
| parameters | Map<String,String> | 否 | RequestBody参数 | 执行命令时的参数值,仅在命令有参数时需要 |
| targetSelectorType | TargetSelectorType | 否 | RequestBody参数 | 实例选择器类型,仅在执行动作为执行或保存并执行时需要。默认值为INSTANCES_LIST。可选值:INSTANCES_LIST(实例列表),ALL_INSTANCES(全部实例),TAG_INSTANCES(实例标签选择),INSTANCES_IMPORT(实例列表导入) |
| targets | List<Target> | 否 | RequestBody参数 | 实例ID列表,仅在targetSelectorType为INSTANCES_LIST时需要 |
| targetSelector | TargetSelector | 否 | RequestBody参数 | 实例选择器 |
返回头域
除公共头域,无其它特殊头域。
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| requestId | String | 请求id |
| code | String | 响应状态,成功为success |
| message | String | 错误信息 |
| success | Boolean | 请求是否处理成功 |
请求示例
Plain Text
1PUT /v1/ca/action
2Host: ca.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "action" : {
7 "ref" : "c-WgEtWtD3sV******",
8 "name" : "cmd_2024_03_21_16_41_32",
9 "description" : "this is a test",
10 "timeoutSecond" : 60,
11 "command" : {
12 "type" : "SHELL",
13 "scope" : "INDIVIDUAL",
14 "enableParameter" : true,
15 "parameters" : [ {
16 "name" : "param1",
17 "desc" : "this is a text"
18 } ],
19 "user" : "root",
20 "workDir" : "/home",
21 "content" : "{{param1}}"
22 }
23 }
24}
返回示例
Plain Text
1200 Success
2
3{
4 "requestId" : "be82abc6-eb4c-4a51-9f52-f59b97******",
5 "code" : "success"
6}
评价此篇文章
