All Products
Search
Document Center

Auto Scaling:ListTagResources

Last Updated:Dec 11, 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.

Operation description

  • Specify at least one of the following request parameters: ResourceIds and Tags. Tags.Key and Tags.Value are used to specify the query objects.
  • If you provide both ResourceIds and Tags 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

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
ess:ListTagResourcesget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
ResourceTypestringYes

The resource type. Set the value to scalinggroup.

scalinggroup
NextTokenstringNo

The token that determines the start point of the next query.

caeba0bbb2be03f84eb48b699f0a4883
ResourceIdsarrayNo

The IDs of the Auto Scaling resources. You can specify 1 to 50 resource IDs.

stringNo

The IDs of the Auto Scaling resources. You can specify 1 to 50 resource IDs.

asg-bp17xb4x1vr29lgt****
Tagsarray<object>No

Details of the tags.

objectNo

Details of the tags.

KeystringNo

The key of the tag. The key is used to perform an exact match of Auto Scaling resources. The key must be 1 to 128 characters in length.

Tags is used to perform an exact match of Auto Scaling resources to which the specified tags are added. Specify a tag in the key-value pair format.

  • If you specify only Tags.Key, all resources whose tags contain the specified tag key are returned.
  • If you specify only Tags.Value, the MissingParameter.TagKey error is reported.
  • 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.
TestKey
ValuestringNo

The value of the tag. The value is used to perform an exact match of Auto Scaling resources. The value can be up to 128 characters in length.

TestValue

Response parameters

ParameterTypeDescriptionExample
object

The response that is returned.

NextTokenstring

The token that determines the start point of the next query.

caeba0bbb2be03f84eb48b699f0a4883
RequestIdstring

The ID of the request.

DE65F6B7-7566-4802-9007-96F2494A****
TagResourcesarray<object>

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

TagResourceobject

Details of the resource and tags, such as the resource ID, the resource type, tag keys, and tag values.

TagValuestring

The tag value of the resource.

TestValue
ResourceTypestring

The resource type.

ALIYUN::ESS::SCALINGGROUP
ResourceIdstring

The resource ID.

asg-bp17xb4x1vr29lgt****
TagKeystring

The tag key of the resource.

TestKey
Propagateboolean

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

  • true: The tags of the scaling group can be propagated to only instances that are newly created.
  • false: The tags of the scaling group cannot be propagated to instances.
false

Examples

Sample success responses

JSONformat

{
  "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 Service error codes.

Change history

Change timeSummary of changesOperation
No change history