創建健康檢查
更新時間 2025-07-02 09:17:17
最近更新時間: 2025-07-02 09:17:17
分享文章
接口功能介紹
創建健康檢查
接口約束
無
URI
POST /v4/elb/create-health-check
路徑參數
無
Query參數
無
請求參數
請求頭header參數
無
請求體body參數
| 參數 | 是否必填 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|---|
| clientToken | 是 | String | 客戶端存根,用于保證訂單冪等性, 長度 1 - 64 | 79fa97e3-c48b-xxxx-9f46-6a13d8163678 | |
| regionID | 是 | String | 區域ID | ||
| name | 是 | String | 唯一。支持拉丁字母、中文、數字,下劃線,連字符,中文 / 英文字母開頭,不能以 http: / https: 開頭,長度 2 - 32 | acl11 | |
| description | 否 | String | 支持拉丁字母、中文、數字, 特殊字符: |
||
| protocol | 是 | String | 健康檢查協議。取值范圍:TCP、UDP、HTTP | ||
| timeout | 否 | Integer | 健康檢查響應的最大超時時間,取值范圍:2-60秒,默認為2秒 | 2 | |
| interval | 否 | Integer | 負載均衡進行健康檢查的時間間隔,取值范圍:1-20940秒,默認為5秒 | 5 | |
| maxRetry | 否 | Integer | 最大重試次數,取值范圍:1-10次,默認為2次 | 2 | |
| httpMethod | 否 | String | 僅當protocol為HTTP時必填且生效,HTTP請求的方法默認GET,{GET/HEAD/POST/PUT/DELETE/TRACE/OPTIONS/CONNECT/PATCH} | ||
| httpUrlPath | 否 | String | 僅當protocol為HTTP時必填且生效,默認為'/',支持的最大字符長度:80 | ||
| httpExpectedCodes | 否 | Array of Strings | 僅當protocol為HTTP時必填且生效,支持http_2xx/http_3xx/http_4xx/http_5xx,一個或者多個的列表, 當 protocol 為 HTTP 時, 不填默認為 http_2xx |
響應參數
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| statusCode | Integer | 返回狀態碼(800為成功,900為失敗) | 800 | |
| message | String | statusCode為900時的錯誤信息; statusCode為800時為success, 英文 | success | |
| description | String | statusCode為900時的錯誤信息; statusCode為800時為成功, 中文 | 成功 | |
| errorCode | String | statusCode為900時為業務細分錯誤碼,三段式:product.module.code; statusCode為800時為SUCCESS | SUCCESS | |
| returnObj | Array of Objects | 返回結果 | 見下表 | returnObj |
| error | String | statusCode為900時為業務細分錯誤碼,三段式:product.module.code; statusCode為800時為SUCCESS |
表 returnObj
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| ID | String | 健康檢查ID | hc-4xvz5g2y5h |
枚舉參數
無
請求示例
請求url
POST /v4/elb/create-health-check
請求頭header
無
請求體body
{
"regionID": "81f7728662dd11ec810800155d307d5b",
"name": "tianyi-2-http",
"protocol": "HTTP",
"timeout": 3,
"interval": 1,
"maxRetry": 1,
"httpMethod": "GET",
"httpUrlPath": "",
"httpExpectedCodes": [
"http_2xx"
],
"description": "tianyi-2",
"clientToken": "123e4567-b89b-12d3-a456-62665544001"
}
響應示例
{
"statusCode": 800,
"errorCode": "SUCCESS",
"message": "success",
"description": "成功",
"returnObj": {
"ID": "hc-4xvz5g2y5h"
}
}
狀態碼
請參考
錯誤碼
請參考