All Products
Search
Document Center

Alibaba Cloud DNS:ListTagResources

Last Updated:Oct 11, 2024

Queries the tags that are added to a specified resource.

Operation description

  • Set ResourceId.N or Tag.N that consists of Tag.N.Key and Tag.N.Value in the request to specify the object to be queried.
  • Tag.N is a resource tag that consists of a key-value pair. If you set only Tag.N.Key, all tag values that are assigned to the specified key are returned. If you set only Tag.N.Value, an error message is returned.
  • If you set both Tag.N and ResourceId.N to filter tags, ResourceId.N must match all specified key-value pairs.
  • If you specify multiple key-value pairs, resources that contain these key-value pairs are returned.

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

Request parameters

ParameterTypeRequiredDescriptionExample
LangstringNo

The language in which you want some response parameters to be returned.

en
ResourceTypestringYes

The resource type.

DOMAIN
NextTokenstringNo

The token that determines the start point of the query.

4698691
Tagarray<object>No

An array of tag key-value pairs.

objectNo
KeystringNo

The key of the tag.

abcd
ValuestringNo

The value of the tag.

abcd
ResourceIdarrayNo

The ID of the resource.

stringNo

The domain name. If Tag.N parameters are left empty, the ResourceId.N is required.

dns-example.com

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

The token used to start the next query. If no value is returned for NextToken, no next queries are sent.

4698691
RequestIdstring

The ID of the request.

61092C8D-6AEB-4310-B74D-C632F89BF4FB
TagResourcesarray<object>

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

TagResourceobject
ResourceTypestring

The type of the resource. Only DOMAIN is returned.

DOMAIN
TagValuestring

The tag value.

abcd
ResourceIdstring

The ID of the resource.

dns-example.com
TagKeystring

The key of the tag.

abcd

Examples

Sample success responses

JSONformat

{
  "NextToken": "4698691",
  "RequestId": "61092C8D-6AEB-4310-B74D-C632F89BF4FB",
  "TagResources": [
    {
      "ResourceType": "DOMAIN",
      "TagValue": "abcd",
      "ResourceId": "dns-example.com",
      "TagKey": "abcd"
    }
  ]
}

Error codes

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