All Products
Search
Document Center

Elastic Compute Service:DescribeCommands

Last Updated:Nov 22, 2023

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

Usage notes

If you specify only the Action and RegionId parameters, 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. Examples:
    • 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. If you specify Provider, fuzzy search is supported by default.

Description String No testDescription

The description of the common command. This parameter takes effect and fuzzy search is supported by default only when Provider is specified.

Type String No RunShellScript

The type of the command. 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 values in the response. 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 page number.

Pages start from page 1.

Default value: 1.

PageSize Long No 10

The number of entries per page.

Valid values: 1 to 50.

Default value: 10.

Latest Boolean No true

Specifies whether to query only the latest version of common commands when 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.

ResourceGroupId String No rg-123******

The ID of the resource group to which the command belongs.

Tag.N.Key String No TestKey

The key of tag N of the command. Valid values of N: 1 to 20. The tag key cannot be an empty string.

If a single tag is specified to query resources, up to 1,000 resources that have this tag added can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that have all these tags added can be displayed in the response. To query more than 1,000 resources that have specified tags, call the ListTagResources operation.

The tag key can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

Tag.N.Value String No TestValue

The value of tag N of the command. Valid values of N: 1 to 20. The tag value can be an empty string.

It can be up to 128 characters in length and cannot contain http:// or https://.

Response parameters

Parameter

Type

Example

Description

PageSize Long 10

The number of entries per page.

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

The ID of the request.

PageNumber Long 1

The page number.

TotalCount Long 5

The total number of commands.

Commands Array of Command

The queried commands.

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

The time when the command was created.

Type String RunShellScript

The type of the command.

Timeout Long 3600

The timeout period. Unit: seconds.

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 execution path 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 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.

  • If you set ContentEncoding to PlainText, the original command content is returned.
  • If you set ContentEncoding to Base64, the Base64-encoded command content is returned.
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 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 is enabled for the command.

ResourceGroupId String rg-123******

The ID of the resource group to which the command belongs.

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

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

ParameterDefinitions Array of ParameterDefinition

The custom parameters.

ParameterDefinition
Required Boolean true

Indicates whether the custom parameter is required.

  • true
  • false

Default value: false.

Description String Download path of the Cloud Assistant Agent 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 parameter of the enumeration type.

Tags Array of Tag

The tags of the command.

Tag
TagKey String owner

The tag key of the command.

TagValue String zhangsan

The tag value of the command.

Examples

Sample requests

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 Agent 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>
        <Tags>
            <TagKey>owner</TagKey>
            <TagValue>zhangsan</TagValue>
        </Tags>
    </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 Agent installation package",
      "DefaultValue" : "https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm",
      "ParameterName" : "DownloadUrl",
      "PossibleValues" : [ "\"Linux\",\"Windows\"" ]
    } ],
    "Tags" : [ {
      "TagKey" : "owner",
      "TagValue" : "zhangsan"
    } ]
  } ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 RegionId.ApiNotSupported The api is not supported in this region. This operation cannot be performed in the specified region. Check whether the value of the RegionId parameter is valid.
400 Duplicate.TagKey The Tag.N.Key contain duplicate key. The tag key already exists. Tag keys must be unique.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. Invalid Tag.N.Key value.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. Invalid Tag.N.Value value.
400 MissingParameter.TagKey You must specify Tag.N.Key. Tag.N.Key is required.
400 InvalidParam.PageNumber The specified parameter is invalid. Invalid PageNumber value.
400 InvalidParam.PageSize The specified parameter is invalid. Invalid PageSize value.
403 Operation.Forbidden The operation is not permitted. The operation is not supported.
500 InternalError.Dispatch An error occurred when you dispatched the request. An error occurred while the request was being sent. Try again later.
500 ServiceUnavailable The request has failed due to a temporary failure of the server. The request failed due to a temporary failure of the backend server.
500 InternalError The request processing has failed due to some unknown error. An internal error occurred. Try again later.

For a list of error codes, see Service error codes.