
# 停止集群（待下线） - StopCluster
#### 功能介绍
停止集群接口。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-dataartsstudio/making_request.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-dataartsstudio/abcd.html)。
- 如果使用身份策略授权，当前API调用无需身份策略权限。
 
#### URI
POST /v1.1/{project_id}/clusters/{cluster_id}/action
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                    |
|:---|:---|:---|:---|
| project_id | 是    | String | 项目ID，获取方法请参见[项目ID和账号ID](https://support.huaweicloud.com/api-dataartsstudio/projectid_accountid.html)。 |
| cluster_id | 是    | String | 集群ID，获取方法请参见[获取集群列表](https://support.huaweicloud.com/api-dataartsstudio/ListClusters.html)。           |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token，使用[Token认证](https://support.huaweicloud.com/api-dataartsstudio/dataartsstudio_02_0010.html)时必选。通过调用IAM服务的"获取用户Token"接口获取响应消息头中X-Subject-Token的值。 |
   
表3请求Body参数 
| 参数   | 是否必选 | 参数类型                                      | 描述               |
|:---|:---|:---|:---|
| stop | 是    | [stop] object | 集群停止操作，定义集群停止标识。 |
   
 表4stop 
| 参数        | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|:---|
| stopMode  | 是    | String  | 关机类型： - IMMEDIATELY：立即关机。   - GRACEFULLY：优雅关机。    |
| delayTime | 否    | Integer | 关机时延，仅在stopMode为"GRACEFULLY"生效，单位：秒。该值为-1时，表示等待所有作业完成，并停止接受新作业。该值为大于0的任意值表示等待该时长后关机，并停止接受新作业。                                                                                                                                                                                                                                                 |
   
#### 响应参数
**状态码：200**
表5响应Body参数 
| 参数    | 参数类型             | 描述    |
|:---|:---|:---|
| jobId | Array of strings | 作业ID。 |
   
#### 请求示例
停止集群
```
POST /v1.1/1551c7f6c808414d8e9f3c514a170f2e/clusters/bae65496-643e-47ca-84af-948672de7eeb/action
{
  "stop" : {
    "stopMode" : "GRACEFULLY",
    "delayTime" : -1
  }
}
```
#### 响应示例
**状态码：200**
OK。
```
{
  "jobId" : [ "ff8080815e59d92d015e5b27ccb0004d" ]
}
```
#### 状态码
| 状态码 | 描述                    |
|:---|:---|
| 200 | OK。                   |
| 400 | 请求错误。                 |
| 401 | 鉴权失败。                 |
| 403 | 没有操作权限。               |
| 404 | 找不到资源。                |
| 500 | 服务内部错误，具体返回错误码请参考错误码。 |
| 503 | 服务不可用。                |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-dataartsstudio/ErrorCode.html)。
