Queries the tags that are added to resources.
Operation description
Set ResourceId.N or Tag.N that consists of Tag.N.Key and Tag.N.Value in the request to specify the object to be queried.
Tag.N is a resource tag that consists of a key-value pair. If you set only Tag.N.Key, all tag values that are associated with the specified tag key are returned. If you set only Tag.N.Value, an error message is returned.
If you set 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.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
slb:ListTagResources |
get |
acl
loadbalancer
ServerCertificate
CaCertificate
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the CLB instance. You can call the DescribeRegions operation to query the most recent region list. |
cn-hangzhou |
| ResourceType |
string |
Yes |
The type of the resource. Valid values:
|
instance |
| NextToken |
string |
No |
The token that determines the start point of the query. Valid values:
|
caeba0bbb2be03f84eb48b699f0a**** |
| ResourceId |
array |
No |
The resource ID. You can specify up to 20 resources. Note
The value of ResourceId of a listener is LoadBalancerId_Listener protocol_Port, where LoadBalancerId is the ID of the CLB instance and port is the listener port. Example: lb-bp1qnnvj18yy6h****_http_80. |
lb-bp1qnnvj18yy6h****** |
|
string |
No |
The resource ID. You can specify up to 20 resources. Note
The value of ResourceId of a listener is LoadBalancerId_Listener protocol_Port, where LoadBalancerId is the ID of the CLB instance and port is the listener port. Example: lb-bp1qnnvj18yy6h****_http_80. |
lb-bp1qnnvj18yy6h**** |
|
| Tag |
array<object> |
No |
The tags. |
|
|
object |
No |
|||
| Key |
string |
No |
The tag key of the resource. You can specify up to 20 tag keys. The tag key cannot be an empty string. The tag key must be 1 to 64 characters in length and cannot start with |
FinanceDept |
| Value |
string |
No |
The tag value of the resource. You can specify up to 20 tag values. The tag value cannot be an empty string. The tag value can be up to 128 characters in length and cannot start with |
FinanceJoshua |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| NextToken |
string |
The token that determines the start point of the query. Valid values:
|
caeba0bbb2be03f84eb48b699f0a**** |
| RequestId |
string |
The ID of the request. |
DE65F6B7-7566-4802-9007-96F2494AC512 |
| TagResources |
object |
||
| TagResource |
array<object> |
The resources to which the tags are added. |
|
|
object |
|||
| TagValue |
string |
The tag value. |
FinanceJoshua |
| ResourceType |
string |
The resource type. |
instance |
| ResourceId |
string |
The resource ID. |
lb-bp16qjewdsunr4**** |
| TagKey |
string |
The tag key. |
FinanceDept |
Examples
Success response
JSON format
{
"NextToken": "caeba0bbb2be03f84eb48b699f0a****",
"RequestId": "DE65F6B7-7566-4802-9007-96F2494AC512",
"TagResources": {
"TagResource": [
{
"TagValue": "FinanceJoshua",
"ResourceType": "instance",
"ResourceId": "lb-bp16qjewdsunr4****",
"TagKey": "FinanceDept"
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | TagTypeNotSame | The category of tags in the same request must be the same. | |
| 400 | ResourceNotExist | %s. | |
| 400 | QueryTokenNotExist | The specified NextToken does not exist. | |
| 400 | InvalidParam.NextToken | The specified NextToken is invalid. | |
| 400 | InvalidParam.Scope | The specified Scope is invalid. | |
| 400 | InvalidParam.ResourceType | The specified ResourceType is invalid. | |
| 400 | InvalidParam.TagKey | The specified TagKey is invalid. | |
| 400 | InvalidParam.TagValue | The specified TagValue is invalid. | |
| 400 | InvalidParam.TagKeyOrValue | The specified TagKey or TagValue is invalid. | |
| 400 | InvalidParam.TagOwnerUid | The specified TagOwnerUid is invalid. | |
| 400 | InvalidParam.TagOwnerBid | The specified TagOwnerBid is invalid. | |
| 400 | MissingParam.Scope | The parameter Scope is required. | |
| 400 | MissingParam.TagOwnerUid | The parameter TagOwnerUid is required. | |
| 400 | MissingParam.TagOwnerBid | The parameter TagOwnerBid is required. | |
| 400 | InvalidParameter.RegionId | The specified RegionId does not exist. | |
| 400 | MissingParam.TagOrResourceId | The parameter Tag or ResourceId is required at least one. | |
| 400 | SizeLimitExceeded.ResourceId | The maximum size of ResourceId is exceeded. | |
| 400 | SizeLimitExceeded.Tag | The maximum size of Tag is exceeded. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.