接口功能介绍
调用此接口可以创建一条云助手命令
接口约束
无
URI
POST /v4/cloud-assistant/create-command
路径参数
无
Query参数
无
请求参数
请求头header参数
无
请求体body参数
参数 | 是否必填 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|---|
regionID | 是 | String | 资源池ID | 88f8888888dd88ec888888888d888d8b | |
commandName | 是 | String | 命令名称,长度不超过128个字符 | testName | |
description | 否 | String | 命令描述,长度不超过512个字符 | testDescription | |
commandType | 是 | String | 命令类型,取值范围: Shell:适用于Linux云主机、物理机的Shell命令; Bat:适用于Windows云主机的Bat命令; PowerShell:适用于Windows云主机的PowerShell命令; Python:适用于Python命令 |
Shell | |
commandContent | 是 | String | 加密后的命令内容,base64编码长度不可超过24KB | ZWNobyB0ZXN0 | |
workingDirectory | 否 | String | 命令在实例中运行目录。Linux系统默认路径为 /root;Windows系统默认路径为C:\Windows\System32 说明:若在Windows系统云主机下执行Python脚本命令,需传Python安装全路径。 |
/home/user | |
timeout | 否 | Integer | 命令超时时间,默认值60秒 | 60 | |
enabledParameter | 否 | Boolean | 是否启用自定义参数,若传true,则必须传defaultParameter,若enabledParameter为false,则defaultParameter不能传 | false | |
defaultParameter | 否 | Array of Objects | 启用自定义参数功能时,自定义参数的默认取值,json 格式string数组 | param |
表 param
参数 | 是否必填 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|---|
key | 是 | String | 参数名 | userid | |
description | 否 | String | 参数描述 | 用户id | |
value | 是 | String | 参数值 | test |
响应参数
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
statusCode | Integer | 返回状态码(800 为成功,900 为失败) | 800 | |
errorCode | String | 业务细分码,为product.module.code三段式码 | ||
message | String | 失败时的错误描述,一般为英文描述 | Param is null | |
description | String | 失败时的错误描述,一般为中文描述 | 请求参数错误 | |
returnObj | Object | 成功时返回的数据 | returnObj |
表 returnObj
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
commandID | String | 命令id | a6a08d82-2f89-11ee-a2b7-774dd7c6ebaf |
枚举参数
无
请求示例
请求url
无
请求头header
无
请求体body
{
"regionID": "200000003335",
"commandName": "test-0221",
"description": "testDescription",
"commandType": "shell",
"commandContent": "gAAAAABnt2HNcJPKQ6CeFECn_RkLTKghL7xPCWFiAEWtRIPeMn6R-oBNiEexHUexolzhMM1qU5tjxRI9dHhrrSuNYa481GGxX6AFZq1upa6fFTsHJvnDPgzg3sH_UZxIZCFWHXuVkQmy",
"workingDirectory": "/tmp",
"timeout": 30,
"enabledParameter": true,
"defaultParameter": [
{
"value": "test",
"description": "参数1",
"key": "param-1"
}
]
}
响应示例
{
"returnObj": {
"commandID": "a6a08d82-2f89-11ee-a2b7-774dd7c6ebaf"
},
"message": "SUCCESS",
"description": "成功",
"statusCode": 800
}
状态码
请参考 状态码
错误码
请参考 错误码