All Products
Search
Document Center

Elastic Compute Service:DescribeActivations

Last Updated:Nov 14, 2024

Queries existing activation codes and their usage information.

Operation description

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

  • Method 1: When you call the DescribeActivations operation to retrieve the first page of results during a paged query, use MaxResults to specify the maximum number of entries to return in the call. The return value of NextToken is a pagination token, which you can use in the next request to retrieve a new page of results. When you call the DescribeActivations operation to retrieve a new page of results, set NextToken to the NextToken value returned in the previous call and use 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:DescribeActivationsget
*Activation
acs:ecs:{#regionId}:{#accountId}:activation/*
*Activation
acs:ecs:{#regionId}:{#accountId}:activation/{#activationId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the command. Supported regions: China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Heyuan), and China (Hong Kong).

You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
ActivationIdstringNo

The ID of the activation code.

4ECEEE12-56F1-4FBC-9AB1-890F1234****
InstanceNamestringNo

The default instance name prefix.

test-InstanceName
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 do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken.

AAAAAdDWBF2****
ResourceGroupIdstringNo

The ID of the resource group to which the activation code belongs.

rg-123******
Tagarray<object>No

The tags of the activation code.

objectNo

The tag of the activation code.

KeystringNo

The key of tag N of the activation code. 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 can be returned. If multiple tags are specified to query resources, up to 1,000 resources that have all these tags can be returned. 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 activation code. Valid values of N: 1 to 20. The tag value can be an empty string.

The tag value 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 request ID.

4ECEEE12-56F1-4FBC-9AB1-890F74625134
PageNumberlong

The page number.

1
TotalCountlong

The total number of entries returned.

1
NextTokenstring

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

AAAAAdDWBF2****
ActivationListarray<object>

The activation codes and their usage information.

Activationobject
CreationTimestring

The time when the activation code was created.

2021-01-20T06:00:00Z
DeregisteredCountinteger

The number of instances that were deregistered.

1
InstanceCountinteger

The maximum number of times that the activation code can be used to register managed instances.

1
Descriptionstring

The description of the activation code.

This is description.
RegisteredCountinteger

The number of instances that were registered.

1
InstanceNamestring

The default instance name prefix.

test-InstanceName
Disabledboolean

Indicates whether the activation code is disabled.

false
IpAddressRangestring

The IP addresses of hosts that are allowed to use the activation code.

0.0.0.0/0
TimeToLiveInHourslong

The validity period of the activation code. Unit: hours.

4
ActivationIdstring

The ID of the activation code.

4ECEEE12-56F1-4FBC-9AB1-890F1234****
ResourceGroupIdstring

The ID of the resource group to which the activation code belongs.

rg-123******
Tagsarray<object>

The tags of the activation code.

Tagobject

The tag of the activation code.

TagKeystring

The tag key of the activation code.

owner
TagValuestring

The tag value of the activation code.

zhangsan

Examples

Sample success responses

JSONformat

{
  "PageSize": 10,
  "RequestId": "4ECEEE12-56F1-4FBC-9AB1-890F74625134",
  "PageNumber": 1,
  "TotalCount": 1,
  "NextToken": "AAAAAdDWBF2****",
  "ActivationList": [
    {
      "CreationTime": "2021-01-20T06:00:00Z",
      "DeregisteredCount": 1,
      "InstanceCount": 1,
      "Description": "This is description.",
      "RegisteredCount": 1,
      "InstanceName": "test-InstanceName",
      "Disabled": false,
      "IpAddressRange": "0.0.0.0/0",
      "TimeToLiveInHours": 4,
      "ActivationId": "4ECEEE12-56F1-4FBC-9AB1-890F1234****",
      "ResourceGroupId": "rg-123******",
      "Tags": [
        {
          "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.
400InvalidParam.PageNumberThe specified parameter is invalid.The specified PageNumber parameter is invalid.
400InvalidParam.PageSizeThe specified parameter is invalid.The specified PageSize parameter is invalid.
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.
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.
400MissingParameter.TagKeyYou must specify Tag.N.Key.The tag key is not specified.
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.

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 changedView Change Details
2023-10-24The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedView Change Details
2022-02-25The Error code has changedView Change Details