调用GetDiscoveredResourceCounts接口查询资源数量。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 | 
|---|---|---|---|---|
| Action | String | 是 | GetDiscoveredResourceCounts | 要执行的操作,取值:GetDiscoveredResourceCounts。 | 
| GroupByKey | String | 否 | ResourceType | 资源数量统计的分组维度。取值: 
 | 
| MultiAccount | Boolean | 否 | true | 该参数计划于2021年06月30日00时00分00秒前下线,其替代功能账号组的API将于2021年05月30日00时00分00秒前上线。如果您正在使用该参数,建议您在2021年05月30日00时00分00秒之后切换为账号组的API。关于账号组,请参见账号组。 | 
| MemberId | Long | 否 | 120886317861**** | 该参数计划于2021年06月30日00时00分00秒前下线,其替代功能账号组的API将于2021年05月30日00时00分00秒前上线。如果您正在使用该参数,建议您在2021年05月30日00时00分00秒之后切换为账号组的API。关于账号组,请参见账号组。 | 
返回数据
| 名称 | 类型 | 示例值 | 描述 | 
|---|---|---|---|
| RequestId | String | 54BFA4FB-6E08-4D58-9E83-1A8A3EC80247 | 请求ID。 | 
| GroupedResourceCounts | Object | 资源数量查询结果。 | |
| GroupedResourceCountList | Array of GroupedResourceCount | 资源数量列表。 | |
| ResourceCount | Long | 10 | 分组下统计的资源数量。 | 
| GroupName | String | ACS::ECS::SecurityGroup | 资源统计的分组名称。 | 
| GroupByKey | String | ResourceType | 资源统计的分组维度。 | 
示例
请求示例
http(s)://[Endpoint]/?Action=GetDiscoveredResourceCounts
&<公共请求参数>正常返回示例
XML格式
                  
HTTP/1.1 200 OK
Content-Type:application/xml
<GetDiscoveredResourceCountsResponse>
	<RequestId>54BFA4FB-6E08-4D58-9E83-1A8A3EC80247</RequestId>
	<GroupedResourceCounts>
		<GroupedResourceCountList>
			<GroupName>ACS::ECS::NetworkInterface</GroupName>
			<ResourceCount>13</ResourceCount>
		</GroupedResourceCountList>
		<GroupedResourceCountList>
			<GroupName>ACS::ECS::SecurityGroup</GroupName>
			<ResourceCount>10</ResourceCount>
		</GroupedResourceCountList>
		<GroupByKey>ResourceType</GroupByKey>
	</GroupedResourceCounts>
</GetDiscoveredResourceCountsResponse>JSON格式
                  
HTTP/1.1 200 OK
Content-Type:application/json
{
  "RequestId" : "54BFA4FB-6E08-4D58-9E83-1A8A3EC80247",
  "GroupedResourceCounts" : {
    "GroupedResourceCountList" : [ {
      "GroupName" : "ACS::ECS::NetworkInterface",
      "ResourceCount" : 13
    }, {
      "GroupName" : "ACS::ECS::SecurityGroup",
      "ResourceCount" : 10
    } ],
    "GroupByKey" : "ResourceType"
  }
}错误码
| HttpCode | 错误码 | 错误信息 | 描述 | 
|---|---|---|---|
| 400 | NoPermission | You are not authorized to perform this operation. | 您无权执行此操作。 | 
| 400 | MemberNotBelongToMaster | The specified member does not belong to your organization. | 该成员账号不属于您所在的资源目录。 | 
| 404 | AccountNotExisted | Your account does not exist. | 您的账号不存在。 | 
| 503 | ServiceUnavailable | The request has failed due to a temporary failure of the server. | 服务不可用。 | 
访问错误中心查看更多错误码。