All Products
Search
Document Center

ApsaraDB RDS:ListTagResources

Last Updated:May 29, 2023

You can call the ListTagResources operation to query tags that are bound to one or more ApsaraDB RDS instances.

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
rds:ListTagResourcesREAD
  • RDS
    acs:rds:*:{#accountId}:dbinstance/*
  • RDS
    acs:rds:{#regionId}:{#accountId}:dbinstance/{#dbinstanceId}
  • rds:ResourceTag
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
ResourceTypestringYes

The type of the resource. Set the value to INSTANCE.

INSTANCE
NextTokenstringNo

The token required to obtain more results. This parameter is not required in the first query. If a query does not return all results, in the next query, you can specify the token returned from the previous query to obtain more results.

212db86sca4384811e0b5e8707ec21345
ResourceIdarrayNo

The IDs of resources. You can specifies up to 50 resource IDs.

stringNo

The ID of the instance. You can query the tags of N instances at a time. Valid values of N: 1 to 50.

NoteYou must specify at least one of the ResourceId.N and Tag.N.Key parameters.
rm-uf6wjk5*******
Tagobject []No

The tags to query resources. You can specify up to 20 tags.

KeystringNo

The key of the tag. You can query N tag keys at a time. Valid values of N: 1 to 20. The value of this parameter cannot be an empty string.

NoteYou must specify at least one of the ResourceId.N and Tag.N.Key parameters.
testkey1
ValuestringNo

The tag value that is associated with the specified tag key. You can specify N tag values at a time. Valid values of N: 1 to 20. This parameter can be an empty string.

testvalue1

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

The token required to obtain more results. If a query does not return all results, in the next query, you can provide the token returned by the previous query to obtain more results.

212db86sca4384811e0b5e8707ec21345
RequestIdstring

The ID of the request.

47A514A1-4B77-4E30-B4C5-2A880650B3FD
TagResourcesobject []

The information of the returned instances and tags.

TagValuestring

The tag value that is associated with the specified tag key.

testvalue1
ResourceTypestring

The resource type. The value ALIYUN::RDS::INSTANCE indicates ApsaraDB RDS instances.

ALIYUN::RDS::INSTANCE
ResourceIdstring

The ID of the instance.

rm-uf6wjk5xxxxxxx
TagKeystring

The key of the tag.

testkey1

Examples

Sample success responses

JSONformat

{
  "NextToken": "212db86sca4384811e0b5e8707ec21345",
  "RequestId": "47A514A1-4B77-4E30-B4C5-2A880650B3FD",
  "TagResources": {
    "TagResource": [
      {
        "TagValue": "testvalue1",
        "ResourceType": "ALIYUN::RDS::INSTANCE",
        "ResourceId": "rm-uf6wjk5xxxxxxx",
        "TagKey": "testkey1"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400BothEmpty.TagsAndResourcesThe specified Tags and ResourcesIds are not allow to both empty.The operation failed. The tag and the resource ID cannot be left unspecified at the same time.
400NumberExceed.TagsThe number of Tags parameter is exceed, Valid : 20-
400NumberExceed.ResourceIdsThe number of ResourceIds parameter is exceed , Valid : 50-
400InvalidParameter.ResourceTypeThe parameter ResourceType is invalid.The operation failed. Check the resource type.

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

Change history

Change timeSummary of changesOperation
2022-09-01The error codes of the API operation change.
Change itemChange content
Error CodesThe error codes of the API operation change.
    Error Codes 400 change