All Products
Search
Document Center

:ListTagResources

更新時間:Dec 19, 2024

Queries the relationships between Tair (Redis OSS-compatible) 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

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
kvstore:ListTagResourcesget
*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****
    Tagarray<object>No

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

    objectNo
    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****
    TagResourcesarray<object>

    Details of the instances and tags.

    TagResourceobject

    The object.

    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 messageDescription
    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.The parameters Tag and ResourceId cannot all be empty. At least one of them is passed in.
    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.The specified instance does not exist

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