Queries the number of resources within the management account and multiple members of a resource directory.
Operation description
You can query only resources supported by Resource Center. For more information, see Services that work with Resource Center.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
resourcecenter:GetMultiAccountResourceCounts |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| GroupByKey |
string |
No |
The dimension by which resources are queried. Valid values:
Note
If this parameter is not configured, the total number of resources that meet the conditions is returned. |
ResourceType |
| Filter |
array<object> |
No |
The filter condition. |
|
|
object |
No |
The filter condition. |
||
| Key |
string |
No |
The key of the filter condition. For more information, see |
RegionId |
| MatchType |
string |
No |
The matching method. Set the value to Equals, which indicates an exact match. |
Equals |
| Value |
array |
No |
The values of the filter condition. |
|
|
string |
No |
The value of the filter condition. |
cn-shanghai |
|
| Scope |
string |
No |
The search scope. Valid values:
For information about how to obtain the ID of a resource directory, the Root folder, a folder, or a member, see GetResourceDirectory, ListFoldersForParent, or ListAccounts. |
rd-r4**** |
Supported filter parameters
| Parameter | Description | Supported matching method |
| 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 pairs. The JSON format is { "key": $key, "value": $value }, and at least one of the key and value must be specified. For example, specify { "key": "foo", "value": "bar" } to query the tag key foo and the tag value bar, or specify { "key": "foo" } to query the tag key foo. | Contains, NotContains, and NotExists |
| VpcId | The virtual private cloud (VPC) ID. | Equals |
| VSwitchId | The vSwitch ID. | Equals |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| Filters |
array<object> |
The filter condition. |
|
|
object |
The filter condition. |
||
| Key |
string |
The key of the filter condition. |
RegionId |
| Values |
array |
The values of the filter condition. |
|
|
string |
The value of the filter condition. |
cn-shanghai |
|
| GroupByKey |
string |
The dimension by which resources are queried. |
ResourceType |
| RequestId |
string |
The request ID. |
EFA806B9-7F36-55AB-8B7A-D680C2C5EE57 |
| ResourceCounts |
array<object> |
The numbers of resources. |
|
|
object |
The number of resources. |
||
| Count |
integer |
The number of resources. |
2 |
| GroupName |
string |
The group name. |
ACS::ECS::NetworkInterface |
| Scope |
string |
The search scope. Valid values:
For information about how to obtain the ID of a resource directory, the Root folder, a folder, or a member, see GetResourceDirectory, ListFoldersForParent, or ListAccounts. |
rd-r4**** |
Examples
Success response
JSON format
{
"Filters": [
{
"Key": "RegionId",
"Values": [
"cn-shanghai"
]
}
],
"GroupByKey": "ResourceType",
"RequestId": "EFA806B9-7F36-55AB-8B7A-D680C2C5EE57",
"ResourceCounts": [
{
"Count": 2,
"GroupName": "ACS::ECS::NetworkInterface"
}
],
"Scope": "rd-r4****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | NoPermission | You are not authorized to perform this operation. | |
| 400 | MultiAccountServiceNotEnabled | Multi account ResourceCenter service is not enabled. | |
| 400 | InvalidParameter.Filter.ResourceType | The specified parameter value of Filter.ResourceType is not valid. | |
| 400 | MissingParameter.AccountScope | The specified parameter AccountScope is missing. | The specified parameter AccountScope is missing. |
| 403 | NoPermission.AccountScope | The operator is not permitted for this account scope. | The operator is not permitted for this account scope. |
| 404 | NotExists.ResourceDirectory | The resource directory for the account is not enabled. | No resource directory is enabled for the account. |
| 404 | NotExists.ResourceDirectory.FolderId | The specified folder does not exist. | The specified folder does not exist. |
| 409 | InvalidParameter.Scope | The Scope is invalid. | |
| 409 | NoPermission.ResourceDirectory.MemberAccount | ResourceDirectory Member Account is not authorized to perform this operation. | |
| 409 | ServiceNotEnabled.SpecifiedAccount | ResourceCenter service of the specified account is not enabled. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.