Queries resources to which a specified tag is added or resources to which a specified tag is not added.
Operation description
This topic provides an example on how to call the API operation in the China (Shenzhen) region to query virtual private clouds (VPCs) to which the tag key k1
is added. The response shows that the tag key is added to two VPCs.
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 |
---|---|---|---|---|
tag:ListResourcesByTag | Read |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID. For more information about region IDs, see Endpoints . | cn-shenzhen |
NextToken | string | No | The token that is used to start the next query. | caeba0bbb2be03f84eb48b699f0a**** |
MaxResult | integer | No | The number of entries to return on each page. Default value: 50. Maximum value: 1000. | 50 |
ResourceType | string | Yes | The resource type. This parameter specifies a filter condition for the query.
| ALIYUN::VPC::VPC |
FuzzyType | string | No | The type of the query. Valid values:
| EQUAL |
TagFilter.Value | string | No | The tag value. This parameter specifies a filter condition for the query. The tag value can be a maximum of 128 characters in length. It cannot contain | v1 |
TagFilter.Key | string | Yes | The tag key. This parameter specifies a filter condition for the query. The tag key can be a maximum of 128 characters in length. It cannot contain | k1 |
IncludeAllTags | boolean | No | Specifies whether to return the information of tags added to the resources. Valid values:
| False |
Types of resources that support queries based on the NOT operator:
- ALIYUN::ADB::CLUSTER
- ALIYUN::ALB::ACL
- ALIYUN::ALB::LOADBALANCER
- ALIYUN::ALB::SECURITYPOLICY
- ALIYUN::ALB::SERVERGROUP
- ALIYUN::ALIDNS::DOMAIN
- ALIYUN::BASTIONHOST::INSTANCE
- ALIYUN::BPSTUDIO::APPLICATION
- ALIYUN::BPSTUDIO::TEMPLATE
- ALIYUN::CAS::INSTANCE
- ALIYUN::CDN::DOMAIN
- ALIYUN::CDS::CLUSTER
- ALIYUN::CEN::BANDWIDTHPACKAGE
- ALIYUN::CEN::CEN
- ALIYUN::CS::CLUSTER
- ALIYUN::DBAUDIT::INSTANCE
- ALIYUN::DCDN::DOMAIN
- ALIYUN::DDOSBGP::INSTANCE
- ALIYUN::DDOSCOO::INSTANCE
- ALIYUN::DDS::INSTANCE
- ALIYUN::DRDS::INSTANCE
- ALIYUN::ECS::DDH
- ALIYUN::ECS::DDHCLUSTER
- ALIYUN::ECS::DISK
- ALIYUN::ECS::ENI
- ALIYUN::ECS::INSTANCE
- ALIYUN::ECS::KEYPAIR
- ALIYUN::ECS::LAUNCHTEMPLATE
- ALIYUN::ECS::SECURITYGROUP
- ALIYUN::ECS::SNAPSHOT
- ALIYUN::EDAS::APPLICATION
- ALIYUN::EDAS::CLUSTER
- ALIYUN::ELASTICSEARCH::INSTANCE
- ALIYUN::EMR::CLUSTER
- ALIYUN::EMR::FLOWPROJECT
- ALIYUN::HBR::CLIENT
- ALIYUN::HBR::HANAINSTANCE
- ALIYUN::HBR::VAULT
- ALIYUN::KVSTORE::INSTANCE
- ALIYUN::MULTIMOD::CLUSTER
- ALIYUN::OCEANBASE::INSTANCE
- ALIYUN::OOS::EXECUTION
- ALIYUN::OOS::PARAMETER
- ALIYUN::OOS::SECRETPARAMETER
- ALIYUN::OOS::STATECONFIGURATION
- ALIYUN::OOS::TEMPLATE
- ALIYUN::OSS::BUCKET
- ALIYUN::OUTBOUNDBOT::INSTANCE
- ALIYUN::POLARDB::CLUSTER
- ALIYUN::PVTZ::ZONE
- ALIYUN::RDS::INSTANCE
- ALIYUN::VPC::COMMONBANDWIDTHPACKAGE
- ALIYUN::VPC::EIP
- ALIYUN::VPC::NATGATEWAY
- ALIYUN::VPC::VPC
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "7D61FF74-61C2-5768-B01F-05FC97F24F35",
"NextToken": "caeba0bbb2be03f84eb48b699f0a****",
"Resources": [
{
"ResourceId": "vpc-wz9pifyuw26esxd05****",
"Tags": [
{
"Key": "k1",
"Value": "v1",
"Category": "custom"
}
]
}
]
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||
---|---|---|---|---|
2022-12-06 | The internal configuration of the API is changed, but the call is not affected | see changesets | ||
| ||||
2022-11-21 | The internal configuration of the API is changed, but the call is not affected | see changesets | ||
|