All Products
Search
Document Center

Elastic Compute Service:DescribeCommands

Last Updated:Apr 11, 2024

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

Operation description

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.

You can use one of the following methods to check the responses:

  • Method 1: During a paged query, when you call the DescribeCommands operation to retrieve the first page of results, set MaxResults to specify the maximum number of entries to return in the call. The return value of NextToken is a pagination token, which can be used in the next request to retrieve a new page of results. When you call the DescribeCommands operation to retrieve a new page of results, set NextToken to the NextToken value returned in the previous call and set MaxResults to specify the maximum number of entries to return in this call.

  • Method 2: Use PageSize to specify the number of entries to return on each page and then use PageNumber to specify the number of the page to return. You can use only one of the preceding methods. If you specify MaxResults or NextToken, the PageSize and PageNumber request parameters do not take effect and the TotalCount response parameter is invalid.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
ProviderstringNo

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.
AlibabaCloud
CommandIdstringNo

The ID of the command.

c-hz01272yr52****
NamestringNo

The name of the command. If you specify Provider, fuzzy search is supported by default.

testName
DescriptionstringNo

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

testDescription
TypestringNo

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
RunShellScript
ContentEncodingstringNo

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.

PlainText
PageNumberlongNo

The page number.

Pages start from page 1.

Default value: 1.

1
PageSizelongNo

The number of entries per page.

Valid values: 1 to 50.

Default value: 10.

10
MaxResultsintegerNo

The maximum number of entries per page.

Valid values: 1 to 50.

Default value: 10.

10
NextTokenstringNo

The pagination token that is used in the next request to retrieve a new page of results. You must specify the token that is obtained from the previous query as the value of NextToken.

AAAAAdDWBF2
LatestbooleanNo

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.

true
ResourceGroupIdstringNo

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

rg-123******
Tagobject []No

The list of tags.

KeystringNo

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://.

TestKey
ValuestringNo

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://.

TestValue

Response parameters

ParameterTypeDescriptionExample
object
PageSizelong

The number of entries per page.

10
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****
PageNumberlong

The page number.

1
TotalCountlong

The total number of commands.

5
NextTokenstring

A pagination token. It can be used in the next request to retrieve a new page of results.

AAAAAdDWBF2
Commandsobject []

The queried commands.

CreationTimestring

The time when the command was created.

2020-11-17T06:52Z
Typestring

The type of the command.

RunShellScript
Timeoutlong

The timeout period. Unit: seconds.

3600
InvokeTimesinteger

The number of tasks created by using the command.

2
CommandIdstring

The ID of the command.

c-hz01272yr52****
WorkingDirstring

The execution path of the command.

/home/
Descriptionstring

The description of the command.

testDescription
Versioninteger

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.

1
Providerstring

The provider of the common command.

AlibabaCloud.ECS.GuestOS
CommandContentstring

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.
Y2QgL3Jvb3Q=
Categorystring

The category of the common command.

“”
Latestboolean

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.

true
Namestring

The name of the command.

testName
EnableParameterboolean

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

true
ResourceGroupIdstring

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

rg-123******
ParameterNamesarray

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.

string

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.

['parameter1','parameter2']
ParameterDefinitionsobject []

The custom parameters.

Requiredboolean

Indicates whether the custom parameter is required.

  • true
  • false

Default value: false.

true
Descriptionstring

The description of the custom parameter.

Download path of the Cloud Assistant Agent installation package.
DefaultValuestring

The default value of the custom parameter.

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

The name of the custom parameter.

DownloadUrl
PossibleValuesarray

The valid values of the custom parameter of the enumeration type.

string

The valid values of the custom parameter of the enumeration type.

"Linux","Windows"
Tagsobject []

The tags of the command.

TagKeystring

The tag key of the command.

owner
TagValuestring

The tag value of the command.

zhangsan

Examples

Sample success responses

JSONformat

{
  "PageSize": 10,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "PageNumber": 1,
  "TotalCount": 5,
  "NextToken": "AAAAAdDWBF2",
  "Commands": {
    "Command": [
      {
        "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,
        "ResourceGroupId": "rg-123******",
        "ParameterNames": {
          "ParameterName": [
            "['parameter1','parameter2']"
          ]
        },
        "ParameterDefinitions": {
          "ParameterDefinition": [
            {
              "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": {
                "PossibleValue": [
                  "\"Linux\",\"Windows\""
                ]
              }
            }
          ]
        },
        "Tags": {
          "Tag": [
            {
              "TagKey": "owner",
              "TagValue": "zhangsan"
            }
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400RegionId.ApiNotSupportedThe api is not supported in this region.The API operation cannot be called in the specified region. Check whether the specified RegionId parameter is valid.
400NumberExceed.TagsThe Tags parameter number is exceed.The number of tags exceeds the maximum limit.
400Duplicate.TagKeyThe Tag.N.Key contain duplicate key.The specified tag key already exists. Tag keys must be unique.
400InvalidTagKey.MalformedThe specified Tag.n.Key is not valid.The specified Tag.N.Key parameter is invalid.
400InvalidTagValue.MalformedThe specified Tag.n.Value is not valid.The specified tag value is invalid.
400MissingParameter.TagKeyYou must specify Tag.N.Key.The tag key is not specified.
400InvalidParam.PageNumberThe specified parameter is invalid.The specified PageNumber parameter is invalid.
400InvalidParam.PageSizeThe specified parameter is invalid.The specified PageSize parameter is invalid.
400InvalidParameter.NextTokenThe specified parameter NextToken is not valid.The specified parameter NextToken is illegal.
400InvalidParameter.MaxResultsThe specified parameter MaxResults is not valid.The specified parameter MaxResults is illegal.
403Operation.ForbiddenThe operation is not permitted.The operation is not supported.
404InvalidRegionId.NotFoundThe RegionId provided does not exist in our records.The RegionId provided does not exist
500InternalError.DispatchAn error occurred when you dispatched the request.An error occurred while the request is being sent. Try again later.
500ServiceUnavailableThe request has failed due to a temporary failure of the server.-
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-12-21The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: MaxResults
    Added Input Parameters: NextToken
Output ParametersThe response structure of the API has changed.
2023-10-24The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: ResourceGroupId
Output ParametersThe response structure of the API has changed.
2023-05-12The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 403 change
    delete Error Codes: 404
    delete Error Codes: 500
2022-02-25The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 403 change
    Error Codes 404 change
    delete Error Codes: 400
    delete Error Codes: 500