Search for resources that you can access within the current account.
Operation description
- You can use this operation to search for only resources whose types are supported by Resource Center in services that work with Resource Center. For more information about the services and the resource types that are supported by Resource Center, see Services that work with Resource Center.
- By default, the operation returns a maximum of 20 entries. You can configure the
MaxResults
parameter to specify the maximum number of entries to return. - If the response does not contain the
NextToken
parameter, all entries are returned. Otherwise, more entries exist. If you want to obtain the entries, you can call the operation again to initiate another query request. In the request, set theNextToken
parameter to the value ofNextToken
in the last response of the operation. If you do not configure theNextToken
parameter, entries on the first page are returned by default. - You can specify one or more filter conditions to narrow the search scope. For more information about supported filter parameters and matching methods, see the Supported filter parameters section. Multiple filter conditions have logical
AND
relations. Only resources that meet all filter conditions are returned. The values of a filter condition have logicalOR
relations. Resources that meet any value of the filter condition are returned. - You can visit Sample Code Center to view more sample queries.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
NextToken | string | No | The pagination token that is used in the next request to retrieve a new page of results. If the total number of entries returned for the current request exceeds the value of the | eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd**** |
MaxResults | integer | No | The maximum number of entries per page. Valid values: 1 to 100. Default value: 20. | 10 |
Filter | object [] | No | The filter conditions. | |
Key | string | No | The key of the filter condition. For more information, see | RegionId |
Value | array | No | The values of the filter condition. | |
string | No | A value of the filter condition. | Filter condition value | |
MatchType | string | No | The matching mode. The value Equals indicates an equal match. | Equals |
ResourceGroupId | string | No | The ID of the resource group. | rg-acfmzawhxxc**** |
SortCriterion | object | No | The method that is used to sort the entries returned. | |
Key | string | No | The attribute based on which the entries are sorted. The value CreateTime indicates the creation time of resources. | CreateTime |
Order | string | No | The order in which the entries are sorted. Valid values:
| ASC |
Supported filter parameters
Parameter | Description | Supported matching mode |
---|---|---|
ResourceType | The resource type. | Equals |
RegionId | The region ID. | Equals |
ResourceId | The resource ID. | Equals and Prefix |
ResourceGroupId | The resource group ID. | Equals, Exists, and NotExists |
ResourceName | The resource name. | Equals and Contains |
Tag | The key-value pair of the tag. The key-value pair must be in the { "key": $key, "value": $value } JSON format. You must specify at least one of key and value. For example, if you want to query the tag key foo and tag value bar , set this parameter to { "key": "foo", "value": "bar" } . If you want to query only the tag key foo , set this parameter to { "key": "foo" } . | Contains, NotContains, and NotExists |
VpcId | The VPC ID. | Equals |
VSwitchId | The vSwitch ID. | Equals |
Response parameters
Examples
Sample success responses
JSON
format
{
"NextToken": "eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****\t\n",
"RequestId": "D696E6EF-3A6D-5770-801E-4982081FE4D0",
"MaxResults": 10,
"Filters": [
{
"Key": "RegionId",
"MatchType": "Equals",
"Values": [
"cn-hangzhou"
]
}
],
"Resources": [
{
"ResourceType": "ACS::VPC::RouteTable",
"CreateTime": "2021-06-30T09:20:08Z",
"ResourceGroupId": "rg-acfmzawhxxc****",
"ZoneId": "cn-hangzhou-k",
"AccountId": "151266687691****",
"ResourceId": "vtb-bp11lbh452fr8940s****",
"ResourceName": "group1",
"RegionId": "cn-hangzhou",
"Tags": [
{
"Key": "test_key",
"Value": "test_value"
}
],
"IpAddresses": [
"192.168.1.2"
],
"IpAddressAttributes": [
{
"IpAddress": [
"120.221.xxx.xxx"
],
"NetworkType": "Public",
"Version": "Ipv4"
}
],
"ExpireTime": "2021-07-30T09:20:08Z"
}
]
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | NoPermission | You are not authorized to perform this operation. | You are not authorized to perform the operation. |
400 | InvalidParameter.MaxResults | The specified parameter MaxResults is not valid. | The MaxResults parameter is invalid. |
409 | InvalidParameter.SortCriterion.Key | The specified parameter SortCriterion.Key is not valid. | The SortCriterion.Key parameter is invalid. |
409 | ExceedLimit.Filter | The maximum length of Filters is exceeded. | The number of objects specified in the Filter parameter exceeds the upper limit. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
2023-11-21 | The Error code has changed. The response structure of the API has changed | see changesets | ||||||||
| ||||||||||
2023-11-10 | The Error code has changed. The response structure of the API has changed | see changesets | ||||||||
| ||||||||||
2023-08-22 | The Error code has changed | see changesets | ||||||||
| ||||||||||
2023-03-30 | The Error code has changed | see changesets | ||||||||
| ||||||||||
2023-03-07 | The Error code has changed | see changesets | ||||||||
|