You need to enable JavaScript to run this app.
导航
GetResourceCounts - 查询当前账号下的资源数量
最近更新时间:2024.06.24 21:35:41首次发布时间:2024.06.24 21:35:41

查询当前账号下的资源数量

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

GetResourceCounts

要执行的操作,取值:GetResourceCounts。

Version
String

2023-06-01

API的版本,取值:2023-06-01。

Filter
Array of Filter

[
{
"Key": "Region",
"Values": [
"cn-beijing"
]
}
]

过滤条件

GroupByKey
String

ResourceType

资源数量统计的分组维度。取值:

  • ResourceType:资源类型
  • Region:地域

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
GroupByKey
String

ResourceType

资源数量统计的分组维度

Filter
Array of Filter

[
{
"Key": "Region",
"Values": [
"cn-beijing"
],
"MatchType": "Equals"
}
]

过滤条件

ResourceCounts
Array of ResourceCount

[
{
"GroupName": "ecs:instance",
"Count": 20
}
]

资源数量

请求示例

POST /?Action=GetResourceCounts&Version=2023-06-01 HTTP/1.1
Host: https://open.volcengineapi.com/
Content-Type: application/json; charset=UTF-8
X-Date: 20240614T035338Z
X-Content-Sha256: 287e874e******d653b44d21e
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20240614/cn-beijing/resourcecenter/request, SignedHeaders=host;x-content-sha256;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f

{
  "Filter": [
    {
      "Key": "Region",
      "Values": [
        "cn-beijing"
      ]
    }
  ],
  "GroupByKey": "ResourceType"
}

返回示例

{
    "ResponseMetadata": {
        "RequestId": "20240614115719A19B22DF398BBD1151C8",
        "Action": "GetResourceCounts",
        "Version": "2023-06-01",
        "Service": "resourcecenter",
        "Region": "cn-beijing"
    },
    "Result": {
        "GroupByKey": "ResourceType",
        "Filter": [
            {
                "Key": "Region",
                "Values": [
                    "cn-beijing"
                ],
                "MatchType": "Equals"
            }
        ],
        "ResourceCounts": [
            {
                "GroupName": "ecs:instance",
                "Count": 20
            }
        ]
    }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
400
InvalidParameter
The specified parameter %s is invalid.
400
ServiceNotEnabled
ResourceCenter Service is not enabled.

资源中心服务暂未开通

500
InternalError
The request has failed due to an unknown error.