
# 查询专属资源池列表
#### 功能介绍
查询专属资源池列表。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/ModelArts/doc?api=ListClusters)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-modelarts/modelarts_03_0138.html)。
- 如果使用身份策略授权，当前API调用无需身份策略权限。
 
#### URI
GET /v1/{project_id}/clusters
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                               |
|:---|:---|:---|:---|
| project_id | 是    | String | 用户项目ID。获取方法请参见[获取项目ID和名称](https://support.huaweicloud.com/api-modelarts/modelarts_03_0147.html)。 |
   
表2Query参数 
| 参数           | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|:---|:---|:---|:---|
| cluster_name | 否    | String  | 集群名称，默认不过滤集群名。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| status       | 否    | String  | 集群状态，默认不过滤状态。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| offset       | 否    | Integer | 分页列表的起始页，默认为0。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| limit        | 否    | Integer | 指定每一页返回的最大条目数，默认为1000。                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| sort_by      | 否    | String  | 指定排序字段，枚举值如下： - created_at: 创建时间，默认值。   - cluster_name: 集群名称。    |
| order        | 否    | String  | 排序方式，枚举值如下： - asc: 递增排序   - desc: 递减排序，默认值                       |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数          | 参数类型                                                                        | 描述                                              |
|:---|:---|:---|
| total_count | Integer                                                                     | 不分页的情况下符合查询条件的总集群数量。                            |
| count       | Integer                                                                     | 当前查询结果的集群数量，不设置offset、limit查询参数时，count与total相同。 |
| clusters    | Array of [Cluster] objects | 查询到的集群列表。                                       |
   
 表5Cluster 
| 参数                    | 参数类型                                                                      | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|:---|:---|:---|
| owner                 | String                                                                    | 集群归属用户。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| cluster_name          | String                                                                    | 集群名称。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| period_num            | Integer                                                                   | 对应订购周期的个数，仅当集群为包周期类型时返回。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| created_at            | Integer                                                                   | 集群创建时间，距"1970.1.1 0:0:0 UTC"的毫秒数。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| description           | String                                                                    | 集群备注。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| project               | String                                                                    | 集群归属项目。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| allocatable_memory    | Integer                                                                   | 可使用的内存数。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| cluster_id            | String                                                                    | 集群ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| nodes                 | [ClusterNode] object | 集群节点配置。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| allocatable_cpu_cores | Float                                                                     | 可使用的CPU核数。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| product_id            | String                                                                    | 产品ID，仅当集群为包周期类型时返回。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| allocatable_gpus      | Float                                                                     | 可使用的GPU核数。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| order_id              | String                                                                    | 购买产品的订单ID，仅当集群为包周期类型时返回。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| period_type           | String                                                                    | 订购周期类型，取值year或month，仅当集群为包周期类型时返回。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| tenant                | String                                                                    | 集群归属租户。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| status                | String                                                                    | 集群状态，取值为： - deploying：部署中   - running：运行中   - concerning：告警   - abnormal：异常    |
   
 表6ClusterNode 
| 参数              | 参数类型    | 描述     |
|:---|:---|:---|
| available_count | Integer | 可用节点数。 |
| count           | Integer | 节点数。   |
| specification   | String  | 节点规格。  |
   
#### 请求示例
```
GET https://{endpoint}/v1/{project_id}/clusters
```
#### 响应示例
**状态码：200**
服务部署规格列表。
```
{
  "total_count" : 1,
  "count" : 1,
  "clusters" : [ {
    "cluster_id" : "ff808081673fbb3d01673fbb824d0000",
    "cluster_name" : "my-cluster",
    "description" : "",
    "tenant" : "tenant_id",
    "project" : "project_id",
    "owner" : "owner_id",
    "created_at" : 1574923077927,
    "status" : "running",
    "nodes" : {
      "specification" : "modelarts.vm.cpu.8ud",
      "count" : 1,
      "available_count" : 1
    },
    "allocatable_cpu_cores" : 5.5,
    "allocatable_memory" : 4096,
    "allocatable_gpus" : 0.5
  } ]
}
```
#### 状态码
| 状态码 | 描述        |
|:---|:---|
| 200 | 服务部署规格列表。 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-modelarts/modelarts_03_0095.html)。
