
# 修改VPC通道健康检查 - UpdateHealthCheck
#### 功能介绍
修改VPC通道健康检查。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/ROMA/doc?api=UpdateHealthCheck)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-roma/roma_06_0018.html)。
#### URI
PUT /v2/{project_id}/apic/instances/{instance_id}/vpc-channels/{vpc_channel_id}/health-config
表1路径参数 
| 参数             | 是否必选 | 参数类型   | 描述                                  |
|:---|:---|:---|:---|
| project_id     | 是    | String | 项目ID，获取方式请参见API参考的"附录 \> 获取项目ID"章节。 |
| instance_id    | 是    | String | 实例ID                                |
| vpc_channel_id | 是    | String | VPC通道的编号                            |
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
表3请求Body参数 
| 参数                 | 是否必选 | 参数类型    | 描述                                                                                                                                        |
|:---|:---|:---|:---|
| protocol           | 是    | String  | 使用以下协议，对VPC中主机执行健康检查： - TCP - HTTP - HTTPS                                                                                                |
| path               | 否    | String  | 健康检查时的目标路径。protocol = http或https时必选                                                                                                       |
| method             | 否    | String  | 健康检查时的请求方法                                                                                                                                |
| port               | 否    | Integer | 健康检查的目标端口，缺少或port = 0时为VPC中主机的端口号。 若此端口存在非0值，则使用此端口进行健康检查。                                                                                |
| threshold_normal   | 是    | Integer | 正常阈值。判定VPC通道中主机正常的依据为：连续检查x成功，x为您设置的正常阈值。                                                                                                 |
| threshold_abnormal | 是    | Integer | 异常阈值。判定VPC通道中主机异常的依据为：连续检查x失败，x为您设置的异常阈值。                                                                                                 |
| time_interval      | 是    | Integer | 间隔时间：连续两次检查的间隔时间，单位为秒。必须大于timeout字段取值。                                                                                                    |
| http_code          | 否    | String  | 检查目标HTTP响应时，判断成功使用的HTTP响应码。取值范围为100到599之前的任意整数值，支持如下三种格式： - 多个值，如：200,201,202 - 一系列值，如：200-299 - 组合值，如：201,202,210-299 protocol = http时必选 |
| enable_client_ssl  | 否    | Boolean | 是否开启双向认证。若开启，则使用实例配置中的backend_client_certificate配置项的证书                                                                                    |
| status             | 否    | Integer | 健康检查状态 - 1：可用 - 2：不可用                                                                                                                     |
| timeout            | 是    | Integer | 超时时间：检查期间，无响应的时间，单位为秒。必须小于time_interval字段取值。                                                                                              |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数                 | 参数类型    | 描述                                                                                                                                        |
|:---|:---|:---|
| protocol           | String  | 使用以下协议，对VPC中主机执行健康检查： - TCP - HTTP - HTTPS                                                                                                |
| path               | String  | 健康检查时的目标路径。protocol = http或https时必选                                                                                                       |
| method             | String  | 健康检查时的请求方法                                                                                                                                |
| port               | Integer | 健康检查的目标端口，缺少或port = 0时为VPC中主机的端口号。 若此端口存在非0值，则使用此端口进行健康检查。                                                                                |
| threshold_normal   | Integer | 正常阈值。判定VPC通道中主机正常的依据为：连续检查x成功，x为您设置的正常阈值。                                                                                                 |
| threshold_abnormal | Integer | 异常阈值。判定VPC通道中主机异常的依据为：连续检查x失败，x为您设置的异常阈值。                                                                                                 |
| time_interval      | Integer | 间隔时间：连续两次检查的间隔时间，单位为秒。必须大于timeout字段取值。                                                                                                    |
| http_code          | String  | 检查目标HTTP响应时，判断成功使用的HTTP响应码。取值范围为100到599之前的任意整数值，支持如下三种格式： - 多个值，如：200,201,202 - 一系列值，如：200-299 - 组合值，如：201,202,210-299 protocol = http时必选 |
| enable_client_ssl  | Boolean | 是否开启双向认证。若开启，则使用实例配置中的backend_client_certificate配置项的证书                                                                                    |
| status             | Integer | 健康检查状态 - 1：可用 - 2：不可用                                                                                                                     |
| timeout            | Integer | 超时时间：检查期间，无响应的时间，单位为秒。必须小于time_interval字段取值。                                                                                              |
| vpc_channel_id     | String  | VPC通道的编号                                                                                                                                  |
| id                 | String  | 健康检查的编号                                                                                                                                   |
| create_time        | String  | 创建时间                                                                                                                                      |
   
**状态码：401**
表5响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：403**
表6响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：404**
表7响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：500**
表8响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
#### 请求示例
修改指定VPC通道的健康检查配置，协议修改为HTTP，关闭双向认证
```
{
  "http_code" : "200",
  "path" : "/vpc/demo",
  "port" : 22,
  "protocol" : "http",
  "threshold_abnormal" : 5,
  "threshold_normal" : 2,
  "time_interval" : 10,
  "timeout" : 5,
  "enable_client_ssl" : false
}
```
#### 响应示例
**状态码：200**
OK
```
{
  "protocol" : "http",
  "path" : "/vpc/demo",
  "method" : "GET",
  "port" : 22,
  "threshold_abnormal" : 5,
  "threshold_normal" : 2,
  "time_interval" : 10,
  "http_code" : "200",
  "enable_client_ssl" : false,
  "status" : 1,
  "timeout" : 5,
  "id" : "3b3d02026c5f402d85e8645ea95b0816",
  "vpc_channel_id" : "d38c55c926ca44c2bfb37886d93b9a0d",
  "create_time" : "2020-07-23T07:11:57Z"
}
```
**状态码：401**
Unauthorized
```
{
  "error_code" : "APIG.1002",
  "error_msg" : "Incorrect token or token resolution failed"
}
```
**状态码：403**
Forbidden
```
{
  "error_code" : "APIG.1005",
  "error_msg" : "No permissions to request this method"
}
```
**状态码：404**
Not Found
```
{
  "error_code" : "APIG.3030",
  "error_msg" : "The instance does not exist;id:f0fa1789-3b76-433b-a787-9892951c620ec"
}
```
**状态码：500**
Internal Server Error
```
{
  "error_code" : "APIG.9999",
  "error_msg" : "System error"
}
```
#### 状态码
| 状态码 | 描述                    |
|:---|:---|
| 200 | OK                    |
| 401 | Unauthorized          |
| 403 | Forbidden             |
| 404 | Not Found             |
| 500 | Internal Server Error |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-roma/ErrorCode.html)。
