Queries the tags that are added to one or more Auto Scaling resources.

Description

  • Specify ResourceId.N or Tag.N that consists of Tag.N.Key and Tag.N.Value in the request to specify the objects that you want to query.
  • If you specify Tag.N and ResourceId.N at the same time, the Auto Scaling resources that match both the parameters are returned.

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 ListTagResources

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

RegionId String Yes cn-hangzhou

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

ResourceType String Yes scalinggroup

The type of the resource. Only scaling groups are supported. Set the value to scalinggroup.

NextToken String No caeba0bbb2be03f84eb48b699f0a4883

The token that is used for the next query.

ResourceId.N String No asg-bp17xb4x1vr29lgt****

The ID of resource N. Valid values of N: 1 to 50.

Tag.N.Key String No TestKey

The key of tag N. The key is used to perform an exact match of Auto Scaling resources. The key must be 1 to 128 characters in length. Valid values of N: 1 to 20.

Tag.N is used to perform an exact match of Auto Scaling resources to which the specified tags are added. Tag.N consists of one key-value pair.

  • If you specify only Tag.N.Key, all resources whose tags contain the specified tag key are returned.
  • If you specify only Tag.N.Value, the MissingParameter.TagKey error is returned.
  • If you specify multiple key-value pairs at the same time, only Auto Scaling resources that match all the tag keys and tag values are returned.
Tag.N.Value String No TestValue

The value of tag N. The value is used to perform an exact match of Auto Scaling resources. The tag value can be an empty string, and it can be up to 128 characters in length. Valid values of N: 1 to 20.

Response parameters

Parameter Type Example Description
NextToken String caeba0bbb2be03f84eb48b699f0a4883

The token that is returned for the next query.

RequestId String DE65F6B7-7566-4802-9007-96F2494A****

The ID of the request.

TagResources Array of TagResource

The details of resources and tags, including resource IDs, resource types, and tag key-value pairs.

TagResource
TagValue String TestValue

The value of the tag.

ResourceType String ALIYUN::ESS::SCALINGGROUP

The type of the resource.

ResourceId String asg-bp17xb4x1vr29lgt****

The ID of the resource.

TagKey String TestKey

The key of the tag.

Propagate Boolean false

Indicates whether the tag can be propagated.

  • true: The tag can be propagated only to instances that are to be added to the scaling group. The tag cannot be propagated to instances that are already running in the scaling group.
  • false: The tag cannot be propagated to an instance.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=scalinggroup
&NextToken=caeba0bbb2be03f84eb48b699f0a4883
&ResourceId=["asg-bp17xb4x1vr29lgt****"]
&Tag=[{"Key":"TestKey","Value":"TestValue"}]
&<Common request parameters>

Sample success responses

XML format

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

<ListTagResourcesResponse>
    <NextToken>caeba0bbb2be03f84eb48b699f0a4883</NextToken>
    <RequestId>DE65F6B7-7566-4802-9007-96F2494A****</RequestId>
    <TagResources>
        <TagValue>TestValue</TagValue>
        <ResourceType>ALIYUN::ESS::SCALINGGROUP</ResourceType>
        <ResourceId>asg-bp17xb4x1vr29lgt****</ResourceId>
        <TagKey>TestKey</TagKey>
        <Propagate>false</Propagate>
    </TagResources>
</ListTagResourcesResponse>

JSON format

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

{
  "NextToken" : "caeba0bbb2be03f84eb48b699f0a4883",
  "RequestId" : "DE65F6B7-7566-4802-9007-96F2494A****",
  "TagResources" : [ {
    "TagValue" : "TestValue",
    "ResourceType" : "ALIYUN::ESS::SCALINGGROUP",
    "ResourceId" : "asg-bp17xb4x1vr29lgt****",
    "TagKey" : "TestKey",
    "Propagate" : false
  } ]
}

Error codes

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