Queries the Cloud Assistant commands that you created or the common Cloud Assistant commands that Alibaba Cloud provides.

Description

If you specify only the Action and RegionId parameters to call this operation, all the available commands (CommandId) that you created in the specified region are queried by default.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeCommands

The operation that you want to perform. Set the value to DescribeCommands.

RegionId String Yes cn-hangzhou

The region ID of the command. You can call the DescribeRegions operation to query the most recent region list.

Provider String No AlibabaCloud

The provider of the common command. Take note of the following items:

  • If you do not specify this parameter, all the commands that you created are queried.
  • If you set this parameter to AlibabaCloud, all the common commands provided by Alibaba Cloud are queried.
  • If you set this parameter to a specific provider, all the common commands provided by the provider are queried. Example:
    • If you set Provider to AlibabaCloud.ECS.GuestOS, all the common commands provided by AlibabaCloud.ECS.GuestOS are queried.
    • If you set Provider to AlibabaCloud.ECS.GuestOSDiagnose, all the common commands provided by AlibabaCloud.ECS.GuestOSDiagnose are queried.
CommandId String No c-hz01272yr52****

The ID of the command.

Name String No testName

The name of the command. Partial command names are not supported.

Description String No testDescription
Note This parameter is deprecated and does not take effect.
Type String No RunShellScript

The command type. Valid values:

  • RunBatScript: batch command, applicable to Windows instances
  • RunPowerShellScript: PowerShell command, applicable to Windows instances
  • RunShellScript: shell command, applicable to Linux instances
ContentEncoding String No PlainText

The encoding mode of the CommandContent and Output response parameters. Valid values:

  • PlainText: returns the original command content and command output.
  • Base64: returns the Base64-encoded command content and command output.

Default value: Base64.

PageNumber Long No 1

The number of the page to return.

Pages start from page 1.

Default value: 1.

PageSize Long No 10

The number of entries to return on each page.

Maximum value: 50.

Default value: 10.

Latest Boolean No true

Specifies whether to query only the latest version of common commands if common commands are queried. This parameter does not affect the query for private commands.

  • true: queries only the latest version of common commands.
  • false: queries all versions of common commands.

Default value: false.

Response parameters

Parameter Type Example Description
PageSize Long 10

The number of entries returned on each page.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The ID of the request.

PageNumber Long 1

The page number of the returned page.

TotalCount Long 5

The total number of commands.

Commands Array of Command

Details about the commands.

Command
CreationTime String 2020-11-17T06:52Z

The time when the command was created.

Type String RunShellScript

The command type.

Timeout Long 3600

The timeout period.

InvokeTimes Integer 2

The number of tasks created by using the command.

CommandId String c-hz01272yr52****

The ID of the command.

WorkingDir String /home/

The working directory of the command.

Description String testDescription

The description of the command.

Version Integer 1

The version of the common command. If multiple common commands from the same provider (Provider) belong to the same category and have the same name, these commands are of different versions of the same command. This parameter is not returned for the Cloud Assistant commands that you created.

Provider String AlibabaCloud.ECS.GuestOS

The provider of the common command.

CommandContent String Y2QgL3Jvb3Q=

The Base64-encoded command content.

Category String ""

The category of the common command.

Latest Boolean true

Indicates whether the common command is of the latest version. If multiple common commands from the same provider (Provider) belong to the same category and have the same name, these commands are of different versions of the same command. This parameter is not returned for the Cloud Assistant commands that you created.

Name String testName

The name of the command.

EnableParameter Boolean true

Indicates whether the custom parameter feature was enabled for the command.

ParameterNames Array of String ['parameter1','parameter2']

A list of custom parameter names that are parsed from the command specified when the command was being created. If the custom parameter feature is not enabled, an empty list is returned.

ParameterDefinitions Array of ParameterDefinition

Details about the custom parameters.

ParameterDefinition
Required Boolean true

Indicates whether the custom parameter is required.

  • true
  • false

Default value: false.

Description String The download path of the Cloud Assistant client installation package.

The description of the custom parameter.

DefaultValue String https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm

The default value of the custom parameter.

ParameterName String DownloadUrl

The name of the custom parameter.

PossibleValues Array of String "Linux","Windows"

The valid values of the custom enumeration parameter.

Examples

Sample request

http(s)://ecs.aliyuncs.com/?Action=DescribeCommands
&RegionId=cn-hangzhou
&CommandId=c-hz01272yr52****
&PageNumber=1
&PageSize=10
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeCommandsResponse>
    <PageSize>10</PageSize>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
    <PageNumber>1</PageNumber>
    <TotalCount>5</TotalCount>
    <Commands>
        <CreationTime>2020-11-17T06:52Z</CreationTime>
        <Type>RunShellScript</Type>
        <Timeout>3600</Timeout>
        <InvokeTimes>2</InvokeTimes>
        <CommandId>c-hz01272yr52****</CommandId>
        <WorkingDir>/home/</WorkingDir>
        <Description>testDescription</Description>
        <Version>1</Version>
        <Provider>AlibabaCloud.ECS.GuestOS</Provider>
        <CommandContent>Y2QgL3Jvb3Q=</CommandContent>
        <Category>""</Category>
        <Latest>true</Latest>
        <Name>testName</Name>
        <EnableParameter>true</EnableParameter>
        <ParameterNames>['parameter1','parameter2']</ParameterNames>
        <ParameterDefinitions>
            <Required>true</Required>
            <Description>Download path of the Cloud Assistant client installation package</Description>
            <DefaultValue>https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm</DefaultValue>
            <ParameterName>DownloadUrl</ParameterName>
            <PossibleValues>"Linux","Windows"</PossibleValues>
        </ParameterDefinitions>
    </Commands>
</DescribeCommandsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "PageSize" : 10,
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "PageNumber" : 1,
  "TotalCount" : 5,
  "Commands" : [ {
    "CreationTime" : "2020-11-17T06:52Z",
    "Type" : "RunShellScript",
    "Timeout" : 3600,
    "InvokeTimes" : 2,
    "CommandId" : "c-hz01272yr52****",
    "WorkingDir" : "/home/",
    "Description" : "testDescription",
    "Version" : 1,
    "Provider" : "AlibabaCloud.ECS.GuestOS",
    "CommandContent" : "Y2QgL3Jvb3Q=",
    "Category" : """",
    "Latest" : true,
    "Name" : "testName",
    "EnableParameter" : true,
    "ParameterNames" : [ "['parameter1','parameter2']" ],
    "ParameterDefinitions" : [ {
      "Required" : true,
      "Description" : "Download path of the Cloud Assistant client installation package",
      "DefaultValue" : "https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm",
      "ParameterName" : "DownloadUrl",
      "PossibleValues" : [ "\"Linux\",\"Windows\"" ]
    } ]
  } ]
}

Error codes

HTTP status code Error code Error message Description
400 RegionId.ApiNotSupported The api is not supported in this region. The error message returned because the API operation cannot be called in the specified region. Check whether the RegionId parameter is valid.
403 InvalidParam.PageNumber The specified parameter is invalid. The error message returned because the specified PageNumber parameter is invalid.
403 InvalidParam.PageSize The specified parameter is invalid. The error message returned because the specified PageSize parameter is invalid.
403 Operation.Forbidden The operation is not permitted. The error message returned because the operation is not supported.
500 InternalError.Dispatch An error occurred when you dispatched the request. The error message returned because the operation is not supported.

For a list of error codes, visit the API Error Center.