You need to enable JavaScript to run this app.
导航

DescribeCommands

最近更新时间2023.11.20 19:41:56

首次发布时间2023.09.04 15:43:18

调用DescribeCommands接口,查询批量作业命令列表。

调试

请求参数

名称类型是否必填示例值描述
ActionStringDescribeCommands要执行的操作,取值:DescribeCommands。
VersionString2020-04-01接口的版本,取值:2020-04-01。

Provider

String

Volcengine

查询不同命令类型的所有命令。取值:

  • Volcengine:查询火山引擎提供的所有公共命令。
  • 不传值时,默认查询用户手动创建的所有自定义命令。
CommandIdStringcmd-hz012yr52****命令ID。
NameStringupdateAgent命令名称。

Type

String

Shell

命令类型。取值:

  • Shell:查询Shell类型的命令。
  • Python:查询Python类型的命令。

Order

String

created_at

返回命令的排序方式。取值:

  • created_at:按创建时间倒序排列。
  • name:按名称列的字母顺序进行排序。

说明

  • 公共命令:默认按照name进行排序。
  • 自定义命令:默认按照created_at排序,可以选择基于名称列(字母顺序)或创建时间列进行排序。

OrderAscending

Boolean

false

指定返回命令按升序或降序排列。取值:

  • false(默认):降序
  • true:升序

PageNumber

Integer

1

当前页码。

  • 起始值:1。
  • 默认值:1。

PageSize

Integer

10

分页查询时设置的每页行数。

  • 取值范围:1~100。
  • 默认值:10。

返回数据

名称类型示例值描述
PageSizeInteger1每页展示命令数。
PageNumberInteger10命令列表页码。
TotalCountInteger4命令总个数。
CommandsArray of Struct-符合条件的命令信息。具体请参见下表“Command 结构”。

Command 结构

名称类型示例值描述
NameString安装云监控Agent命令名称。
CommandIdStringcmd-hz012yr52****命令ID。
CreateAtString2023-06-07T06:58:05Z命令创建时间。
UpdatedAtString2023-06-07T06:58:05Z命令更新时间。
TypeStringShell命令类型。
TimeoutInteger60超时时间。
WorkingDirString/home执行路径。
UsernameStringroot执行用户。
DescriptionString这是一个命令描述。命令描述。

Provider

String

Volcengine

公共命令的提供者。取值:

  • Volcengine:由火山引擎提供。

说明

查询自定义命令时,该返回值为空。

CommandContentStringIyEvYmluL2Jhc2******c3N3b3JkfX0iIHwgY2hwYXNzd2Q=Base64编码后的命令内容。

EnableParameter

Boolean

false

该命令是否启用自定义参数。取值:

  • false:未启用。
  • true:已启用。

ParameterDefinitions

Array of Struct

-

自定义参数详细信息列表,具体请参见下表“ParameterDefinition 结构”。

InvocationTimesInteger10命令被调用次数。

ParameterDefinition 结构

名称类型示例值描述
NameStringParam参数名称。

Type

String

String

参数类型。取值:

  • String:表示自定义参数类型为String(字符串)类型。
  • Digit:表示自定义参数类型为Digit(数值)类型。

Required

String

true

是否必填。取值:

  • true:必填。
  • false:非必填。
DefaultValueString-自定义参数默认值。
MinLengthInteger1自定义参数值(字符串)的最小长度。
MaxLengthInteger50自定义参数值(字符串)的最大长度。
MinValueInteger10自定义参数值(数值)的最小值。
MaxValueInteger100自定义参数值(数值)的最大值。
DecimalPrecisionInteger2自定义参数值(数值)允许的小数点后位数。

请求示例

GET /?Action=DescribeCommands&Version=2020-04-01&CommandId=cmd-4302d02424c5c8e10281e3a31**** HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
Service: ecs

返回示例

{
    "ResponseMetadata": {
        "RequestId": "202106111445100102252431000052****",
        "Action": "DescribeCommands",
        "Version": "2020-04-01",
        "Service": "ecs",
        "Region": "cn-beijing"
    },
    "Result": {
        "pageNumber": 1,
        "pageSize": 10,
        "totalCount": 1,
        "commands": [
           {
                "name": "修改Linux实例密码",
                "commandId": "cmd-yc1eagyk****",
                "createdAt": "2022-11-07T08:33:38Z",
                "updatedAt": "2022-11-07T08:33:38Z",
                "type": "Shell",
                "timeout": 60,
                "workingDir": "/home",
                "username": "root",
                "description": "脚本描述",
                "provider": "",
                "commandContent": "IyEvYmluL2Jhc2******c3N3b3JkfX0iIHwgY2hwYXNzd2Q=",
                "enableParameter": true,
                "parameterDefinitions": [
                    {
                        "type": "String",
                        "name": "username",
                        "required": true,
                        "defaultValue": "",
                        "minLength": 1,
                        "maxLength": 100,
                        "minValue": "",
                        "maxValue": "",
                        "decimalPrecision": 0
                    },
                    {
                        "type": "String",
                        "name": "password",
                        "required": true,
                        "defaultValue": "",
                        "minLength": 1,
                        "maxLength": 100,
                        "minValue": "",
                        "maxValue": "",
                        "decimalPrecision": 0
                    }
                ],
                "invocationTimes": 10
            }
        ]
    }
}