All Products
Search
Document Center

ApsaraDB RDS:ListTagResources

Last Updated:Apr 17, 2024

Queries the tags that are added to one or more instances.

Operation description

Supported database engines

  • MySQL
  • PostgreSQL
  • SQL Server
  • MariaDB

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

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID. 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, you can specify the token returned from the previous query for the next query to obtain more results.

212db86sca4384811e0b5e8707ec21345
ResourceIdarrayNo

The instance ID. You can specify a maximum of 50 instance IDs.****

Note You must specify at least one of the ResourceId and Key parameters.
stringNo

The instance ID.

rm-uf6wjk5*******
Tagobject []No

The tag list.

KeystringNo

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

Note You must specify at least one of the ResourceId and 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. The value can be an empty string.

testvalue1

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

NextTokenstring

You must specify the token that is obtained from the previous query as the value of NextToken.

212db86sca4384811e0b5e8707ec21345
RequestIdstring

The request ID.

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

The list of queried 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 instance ID.

rm-uf6wjk5xxxxxxx
TagKeystring

The tag key.

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 code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change