All Products
Search
Document Center

PrivateLink:ListTagResources

Last Updated:Feb 27, 2024

Queries the tags that are added to resources.

Operation description

  • You must specify ResourceId.N or Tag.N in the request to specify the object that you want to query.
  • Tag.N is a resource tag that consists of a key-value pair (Tag.N.Key and Tag.N.Value). If you specify only Tag.N.Key, all tag values that are associated with the specified key are returned. If you specify only Tag.N.Value, an error message is returned.
  • If you specify 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

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
privatelink:ListTagResourcesRead
  • VpcEndpoint
    acs:privatelink:*:{#accountId}:vpcendpoint/{#vpcendpointId}
  • VpcEndpointService
    acs:privatelink:*:{#accountId}:vpcendpointservice/{#vpcendpointserviceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceIdarrayNo

The resource IDs. You can specify up to 50 resource IDs.

stringNo

The resource ID.

ep-hp3i05294c2d2d******
ResourceTypestringYes

The type of the resource. Valid values:

  • vpcendpoint: endpoint
  • vpcendpointservice: endpoint service
vpcendpoint
Tagobject []No

The tags to add to the resource.

KeystringNo

The key of tag N to add to the resource. You can specify up to 20 tag keys. The tag key cannot be an empty string.

The tag key can be up to 64 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The tag key must start with a letter but cannot start with aliyun or acs:. The tag key cannot contain http:// or https://.

FinanceDept
ValuestringNo

The value of tag N to add to the resource. You can specify up to 20 tag values. The tag value can be an empty string.

The tag value can be up to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The tag value must start with a letter but cannot start with aliyun or acs:. The tag value cannot contain http:// or https://.

FinanceJoshua
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

0c593ea1-3bea-11e9-b96b-88e9fe637760
RegionIdstringYes

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

cn-hangzhou
NextTokenstringNo

The pagination token that is used in the next request to retrieve a new page of results.

  • If this is your first request or no next requests are to be sent, you do not need to specify this parameter.
  • If a next request is to be sent, you must specify the token that is obtained from the previous request as the value of NextToken.
caeba0bbb2be03f84eb48b699f0a****

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

8D8992C1-6712-423C-BAC5-E5E817484C6B
TagResourcesobject []

The resources to which the tags are added.

TagKeystring

The key of tag N added to the resource.

endpoint
TagValuestring

The value of tag N added to the resource.

FinanceJoshua
ResourceIdstring

The resource ID.

ep-hp3i05294c2d2d******
ResourceTypestring

The type of the resource. Valid values:

  • vpcendpoint: endpoint
  • vpcendpointservice: endpoint service
vpcendpoint
NextTokenstring

The pagination token that is used in the next request to retrieve a new page of results. Valid values:

  • If this is your first request and no next requests are to be performed, you do not need to specify this parameter.
  • If a next request is to be performed, set the parameter to the value of NextToken that is returned from the last call.
caeba0bbb2be03f84eb48b699f0a4883

Examples

Sample success responses

JSONformat

{
  "RequestId": "8D8992C1-6712-423C-BAC5-E5E817484C6B",
  "TagResources": [
    {
      "TagKey": "endpoint",
      "TagValue": "FinanceJoshua",
      "ResourceId": "ep-hp3i05294c2d2d******",
      "ResourceType": "vpcendpoint"
    }
  ],
  "NextToken": "caeba0bbb2be03f84eb48b699f0a4883"
}

Error codes

HTTP status codeError codeError messageDescription
400DuplicatedTagKeyThe tag keys is duplicated.The tag key must be unique.
400MissingTagKeyParamThe tag key is empty.The tag key is empty.
400MissingTagValueParamThe tag value is empty.The tag value is empty.
400MissingResourceIdOrTagParamThe resource id and tag is empty.The resource id and tag is empty.
400IllegalTagKeyParamIllegalTagKeyParamIllegalTagKeyParam
400IllegalTagValueParamThe tag value is Illegal.The tag value is Illegal.

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