All Products
Search
Document Center

Auto Scaling:ListTagResources

Last Updated:May 21, 2024

Queries tags. You can call the ListTagResources operation to query tags that are added to Auto Scaling resources, thereby clarifying resource utilization and facilitating efficient management. This operation aids in the automation of resource categorization and permission management processes.

Usage notes

  • Specify at least one of the following request parameters: ResourceId.N and Tag.N. Tag.N.Key and Tag.N.Value are used to specify the query objects.

  • If you provide both Tag.N and ResourceId.N in your request, the response will exclusively include Auto Scaling resources that satisfy the criteria set by these parameters, ensuring targeted and precise information retrieval.

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 resource type. Set the value to scalinggroup.

NextToken

String

No

caeba0bbb2be03f84eb48b699f0a4883

The pagination token that is used in the next request to retrieve a new page of results.

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 utilized to precisely locate and identify Auto Scaling resources. The key must be 1 to 128 characters in length. Valid values of N: 1 to 20.

Tag.N is utilized to precisely match Auto Scaling resources that have the designated tags attached to them. Tag. N comprises a key-value pair.

  • If you specify only Tag.N.Key, the response will include all resources that have a tag containing the specified key.

  • If you specify only Tag.N.Value, the system will return an error called MissingParameter.TagKey, indicating that the tag key is required but not provided.

  • If you specify several tags simultaneously, the response will include only Auto Scaling resources that satisfy all the specified key-value pairs.

Tag.N.Value

String

No

TestValue

The value of tag N. The value is utilized to precisely locate and identify Auto Scaling resources. The tag value can be an empty string. The value can be up to 128 characters in length. Valid values of N: 1 to 20.

Response parameters

Parameter

Type

Example

Description

NextToken

String

caeba0bbb2be03f84eb48b699f0a4883

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

RequestId

String

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

The request ID.

TagResources

Array of TagResource

An array that encompasses both the resource details and its tags, comprising elements such as the resource ID, the resource type, the tag key, and the tag value.

TagResource

TagValue

String

TestValue

The tag value of the resource.

ResourceType

String

ALIYUN::ESS::SCALINGGROUP

The resource type.

ResourceId

String

asg-bp17xb4x1vr29lgt****

The resource ID.

TagKey

String

TestKey

The tag key of the resource.

Propagate

Boolean

false

Indicates whether the tags can be propagated to instances. Valid values:

  • true: The tags can be propagated to only instances that are set to join the scaling group, without affecting the existing instances in the scaling group.

  • false: The tags cannot be propagated to any instances.

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, see Service error codes.