
# 获取专属计算集群资源 - ShowResourceClusters
#### 功能介绍
用户可以查询已经申请的专属计算集群资源。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-dcc/dcc_api_03_0001.html)。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/DCC/doc?api=ShowResourceClusters)中调试该接口。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-dcc/dcc_api_07_0001.html)。
#### URI
GET /v1/{project_id}/dcc/resource_clusters
参数说明请参见[表1]。
 表1路径参数 
| 参数         | 参数类型   | 是否必选 | 描述                                                                                                                     |
|:---|:---|:---|:---|
| project_id | String | 是    | 项目ID。 获取方式请参见[获取项目ID](https://support.huaweicloud.com/api-dcc/dcc_api_06_0003.html)。 |
   
可以在URI中增加service_type参数，来过滤查询结果。
例如：**/v1/{project_id}/dcc/resource_clusters?service_type={service_type}**
表2查询参数 
| 参数           | 参数类型   | 是否必选 | 描述                 |
|:---|:---|:---|:---|
| service_type | String | 否    | 集群服务类型。当前仅支持"ecs"。 |
   
#### 请求参数
无
#### 响应参数
表3响应参数 
| 参数                | 参数类型             | 描述                                                                                                |
|:---|:---|:---|
| dedicated_cluster | Array of objects | 已开通的专属计算集群资源列表。 详情请参见[表4]。 |
   
 表4dedicated_cluster字段数据结构说明 
| 参数                | 参数类型             | 描述                                                           |
|:---|:---|:---|
| project_id        | String           | 项目ID。                                                        |
| availability_zone | String           | 可用区。                                                         |
| host_total        | Integer          | 主机数量。                                                        |
| host_type         | String           | 主机规格编码。                                                      |
| service_type      | String           | 集群服务类型。当前仅支持"ecs"。                                           |
| host_properties   | Object           | 主机规格信息。字段结构说明请参见[表5]。 |
| vcpus_used        | Integer          | 已用vcpu个数。                                                    |
| vcpus_total       | Integer          | 总的vcpu个数。                                                    |
| memory_mb_used    | Integer          | 已用内存。                                                        |
| memory_mb_total   | Integer          | 总内存。                                                         |
| flavors           | Array of strings | 支持的flavor列表。                                                 |
| instance_total    | Integer          | 运行的计算实例总数。                                                   |
   
 表5host_properties字段结构说明 
| 参数        | 参数类型    | 描述  |
|:---|:---|:---|
| cpu_cores | Integer | 核数。 |
| memory_mb | Integer | 内存。 |
| cpu_speed | String  | 主频。 |
   
#### 请求示例
查询已经申请的集群服务类型为ecs的资源。
```
GET https://{Endpoint}/v1/056f7ec7e100d3d32f81c014630b5648/dcc/resource_clusters?service_type=ecs
```
#### 响应示例
```
{
    "dedicated_cluster": [
        {
            "project_id": "056f7ec7e100d3d32f81c014630b5648",
            "availability_zone": "kvmxen.dc1",
            "host_total": 1,
            "host_type": "dec_IOoptimizedS2",
            "service_type": "ecs",
            "host_properties": {
                "cpu_cores": 216,
                "memory_mb": 264192,
                "cpu_speed": "2.5"
            },
            "vcpus_used": 1,
            "vcpus_total": 96,
            "memory_mb_used": 2048,
            "memory_mb_total": 264192,
            "flavors": [
                "s2.2xlarge.2",
                "s2.2xlarge.4",
                "s2.4xlarge.2",
                "s2.4xlarge.4",
                "s2.8xlarge.2",
                "s2.8xlarge.4",
                "s2.large.2",
                "s2.large.4",
                "s2.medium.2",
                "s2.medium.4",
                "s2.xlarge.2",
                "s2.xlarge.4"
            ],
            "instance_total": 1
        },
        {
            "project_id": "056f7ec7e100d3d32f81c014630b5648",
            "availability_zone": "kvmxen.dc1",
            "host_total": 3,
            "host_type": "dec_IOoptimizedS2",
            "service_type": "ecs",
            "host_properties": {
                "cpu_cores": 108,
                "memory_mb": 264192,
                "cpu_speed": "2.5"
            },
            "vcpus_used": 24,
            "vcpus_total": 134,
            "memory_mb_used": 53248,
            "memory_mb_total": 792576,
            "flavors": [
                "s2.2xlarge.2",
                "s2.2xlarge.4",
                "s2.4xlarge.2",
                "s2.4xlarge.4",
                "s2.8xlarge.2",
                "s2.8xlarge.4",
                "s2.large.2",
                "s2.large.4",
                "s2.medium.2",
                "s2.medium.4",
                "s2.xlarge.2",
                "s2.xlarge.4"
            ],
            "instance_total": 23
        }
    ]
}
```
#### 返回值
请参见[状态码](https://support.huaweicloud.com/api-dcc/dcc_api_06_0002.html)。
