All Products
Search
Document Center

Resource Management:ListTagResources

Last Updated:Jun 05, 2024

Queries the tags that are added to resource groups or the members in a resource directory.

Operation description

This topic provides an example on how to call the API operation to query the tags that are added to the resource group with an ID of rg-aekz6bre2uq****. The response shows that only the k1:v1 tag is added to the resource group.

Debugging

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

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
resourcemanager:ListTagResourcesRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
NextTokenstringNo

The token that is used to start the next query.

caeba0bbb2be03f84eb48b699f0a****
MaxResultsintegerNo

The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.

10
Tagobject []No

The tag key and value.

KeystringNo

A tag key.

k1
ValuestringNo

A tag value.

v1
ResourceIdarrayNo

The resource ID.

stringNo

The ID of a resource group or member. This parameter specifies a filter condition for the query.

Note If you want to query the tags that are added to the members in a resource directory, you must configure both the ResourceId.N and ResourceType parameters and set the ResourceType parameter to Account in your request.
rg-aekz6bre2uq****
ResourceTypestringNo

The type of the objects whose tags you want to query. This parameter specifies a filter condition for the query. Valid values:

  • ResourceGroup: resource group. This is the default value.
  • Account: member.
ResourceGroup

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

Indicates whether the next query is required.

  • If the value of this parameter is empty ("NextToken": ""), all results are returned, and the next query is not required.
  • If the value of this parameter is not empty, the next query is required, and the value is the token used to start the next query.
caeba0bbb2be03f84eb48b699f0a****
RequestIdstring

The ID of the request.

8054B059-6B36-53BF-AA45-B8C9A0ED05AB
TagResourcesobject []

The tags.

TagValuestring

The tag value.

k1
ResourceIdstring

The ID of the resource group or member.

rg-aekz6bre2uq****
TagKeystring

The tag key.

k1
ResourceTypestring

The type of the object whose tags are queried. Valid values:

  • resourcegroup: resource group
  • Account: member
resourcegroup

Examples

Sample success responses

JSONformat

{
  "NextToken": "caeba0bbb2be03f84eb48b699f0a****",
  "RequestId": "8054B059-6B36-53BF-AA45-B8C9A0ED05AB",
  "TagResources": [
    {
      "TagValue": "k1",
      "ResourceId": "rg-aekz6bre2uq****",
      "TagKey": "k1",
      "ResourceType": "resourcegroup"
    }
  ]
}

Error codes

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

Change history

Change timeSummary of changesOperation
No change history