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
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
privatelink:ListTagResources | get |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ResourceId | array | No | The resource IDs. You can specify up to 50 resource IDs. | |
string | No | The resource ID. | ep-hp3i05294c2d2d****** | |
ResourceType | string | Yes | The type of the resource. Valid values:
| vpcendpoint |
Tag | array<object> | No | The tags to add to the resource. | |
object | No | The tags to add to the resource. | ||
Key | string | No | 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 | FinanceDept |
Value | string | No | 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 | FinanceJoshua |
ClientToken | string | No | 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 |
RegionId | string | Yes | The ID of the region where the resource resides. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
NextToken | string | No | The pagination token that is used in the next request to retrieve a new page of results.
| caeba0bbb2be03f84eb48b699f0a**** |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "8D8992C1-6712-423C-BAC5-E5E817484C6B",
"TagResources": [
{
"TagKey": "endpoint",
"TagValue": "FinanceJoshua",
"ResourceId": "ep-hp3i05294c2d2d******",
"ResourceType": "vpcendpoint"
}
],
"NextToken": "caeba0bbb2be03f84eb48b699f0a4883"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | DuplicatedTagKey | The tag keys is duplicated. | The tag key must be unique. |
400 | MissingTagKeyParam | The tag key is empty. | The tag key is empty. |
400 | MissingTagValueParam | The tag value is empty. | The tag value is empty. |
400 | MissingResourceIdOrTagParam | The resource id and tag is empty. | The resource id and tag is empty. |
400 | IllegalTagKeyParam | IllegalTagKeyParam | IllegalTagKeyParam |
400 | IllegalTagValueParam | The tag value is Illegal. | The tag value is Illegal. |
For a list of error codes, visit the Service error codes.