All Products
Search
Document Center

Tair:ListTagResources

Last Updated:Feb 20, 2024

Queries the relationships between ApsaraDB for Redis instances and tags.

Operation description

You can also query the relationships between instances and tags in the ApsaraDB for Redis console. For more information, see Filter ApsaraDB for Redis instances by tag and View tags bound to an instance.

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
kvstore:ListTagResourcesLIST
  • DBInstance
    acs:kvstore:{#regionId}:{#accountId}:instance/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the instance.

cn-hangzhou
ResourceTypestringYes

The resource type. Set the value to INSTANCE.

INSTANCE
NextTokenstringNo

The token used to start the next query to retrieve more results.

Note This parameter is not required in the first query. If not all results are returned in one query, you can specify the NextToken value returned for the query to perform the next query.
212db86sca4384811e0b5e8707ec2****
ResourceIdarrayNo

The IDs of the instances.

Note
  • You must specify this parameter or the Tag parameter.
  • stringNo

    The ID of the instance.

    r-bp1zxszhcgatnx****
    Tagobject []No

    The tags of the instance. You must specify this parameter or the ResourceId parameter.

    KeystringNo

    The keys of the tags associated with the instances you want to query.

    demokey
    ValuestringNo

    The values of the tags associated with the instances you want to query.

    demovalue

    Response parameters

    ParameterTypeDescriptionExample
    object

    The 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.

    212db86sca4384811e0b5e8707ec2****
    RequestIdstring

    The ID of the request.

    47A514A1-4B77-4E30-B4C5-2A880650****
    TagResourcesobject []

    Details of the instances and tags.

    TagValuestring

    The values of the tags.

    demovalue
    ResourceTypestring

    The resource type. The return value is ALIYUN::KVSTORE::INSTANCE. This value indicates an ApsaraDB for Redis instance.

    ALIYUN::KVSTORE::INSTANCE
    ResourceIdstring

    The resource ID, which is also the ID of the instance.

    r-bp1zxszhcgatnx****
    TagKeystring

    The keys of the tags.

    demokey

    Examples

    Sample success responses

    JSONformat

    {
      "NextToken": "212db86sca4384811e0b5e8707ec2****",
      "RequestId": "47A514A1-4B77-4E30-B4C5-2A880650****",
      "TagResources": {
        "TagResource": [
          {
            "TagValue": "demovalue",
            "ResourceType": "ALIYUN::KVSTORE::INSTANCE",
            "ResourceId": "r-bp1zxszhcgatnx****",
            "TagKey": "demokey"
          }
        ]
      }
    }

    Error codes

    HTTP status codeError codeError message
    400InvalidTagKey.MalformedThe specified parameter Tag.n.Key or TagKey.n is not valid.
    400InvalidTagValue.MalformedThe specified parameter Tag.n.Value is not valid.
    400InvalidParameter.ResourceIdThe specified parameter ResourceId.n is not valid.
    400MissParameter.TagOrResourceIdThe parameter Tag.n or ResourceId.n is needed.
    400InvalidParameter.ScopeThe specified parameter Scope is not valid.
    400NumberExceed.ResourceIdsThe ResourceIds parameter number is exceed.
    400NumberExceed.TagsThe Tags parameter number is exceed.
    400Duplicate.TagKeyThe specified parameter Tag.n.Key is duplicated.
    400InvalidParameter.ResourceTypeThe specified parameter ResourceType is not valid.
    404InvalidDbInstanceId.NotFoundSpecified instance does not exist.

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