更新監聽器
更新時間 2025-10-22 18:25:39
最近更新時間: 2025-10-22 18:25:39
分享文章
接口功能介紹
更新監聽器
接口約束
無
URI
POST /v4/elb/update-listener
路徑參數 無
Query參數 無
請求參數
請求頭header參數 無
請求體body參數
| 參數 | 是否必填 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|---|
| clientToken | 否 | String | 客戶端存根,用于保證訂單冪等性, 長度 1 - 64 | 79fa97e3-c48b-xxxx-9f46-6a13d8163678 | |
| regionID | 是 | String | 區域ID | 81f7728662dd11ec810800155d307d5b | |
| ID | 否 | String | 監聽器ID, 該字段后續廢棄 | xxx | |
| listenerID | 是 | String | 監聽器ID, 推薦使用該字段, 當同時使用 ID 和 listenerID 時,優先使用 listenerID | xxx | |
| name | 否 | String | 唯一。支持拉丁字母、中文、數字,下劃線,連字符,中文 / 英文字母開頭,不能以 http: / https: 開頭,長度 2 - 32 | test | |
| description | 否 | String | 支持拉丁字母、中文、數字, 特殊字符:~!@#$%^&()_-+= <>?:{},./;'[]·!@#¥%……&() —— -+={} | 《》?:“”【】、;‘',。、,不能以 http: / https: 開頭,長度 0 - 128 | desc |
| certificateID | 否 | String | 證書ID | cert-xxx | |
| caEnabled | 否 | Boolean | 是否開啟雙向認證。false(不開啟)、true(開啟) | true | |
| clientCertificateID | 否 | String | 雙向認證的證書ID,如果caEnabled為true,此項必填 | xxx | |
| defaultAction | 否 | Object | 默認規則動作 | defaultAction | |
| accessControlID | 否 | String | 訪問控制ID,如果accessControlType有值,此項必填 | xxx | |
| accessControlType | 否 | String | 訪問控制類型。Close(未啟用)、White(白名單)、Black(黑名單) | Close | |
| forwardedForEnabled | 否 | Boolean | x forward for功能。false(未開啟)、true(開) | true | |
| 表 defaultAction |
| 參數 | 是否必填 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|---|
| type | 是 | String | 默認規則動作類型。取值范圍: forward、redirect、deny(目前暫不支持配置為deny) | forward | |
| forwardConfig | 否 | Object | 轉發配置,當type為forward時,此字段必填 | forwardConfig | |
| redirectListenerID | 否 | String | 重定向監聽器ID,當type為redirect時,此字段必填 | xxx | |
| 表 forwardConfig |
| 參數 | 是否必填 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|---|
| targetGroups | 否 | Array of Objects | 后端服務組 | targetGroup | |
| 表 targetGroup |
| 參數 | 是否必填 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|---|
| targetGroupID | 是 | String | 后端服務組ID | tg-xxx | |
| weight | 否 | Integer | 權重,取值范圍:1-256。默認為100 | 100 |
響應參數
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| 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 |
| 表 returnObj |
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| ID | String | 監聽器 ID | xxxx |
枚舉參數
無
請求示例
請求url
POST /v4/elb/update-listener
請求頭header
無
請求體body
{
"regionID": "81f7728662dd11ec810800155d307d5b",
"listenerID": "Xxxx",
"name": "yacos-test-tmp",
"description": "yacos-test-tmp",
"protocol": "HTTP",
"protocolPort": 8080,
"defaultAction": {
"type": "forward",
"forwardConfig": {
"targetGroups": [
{
"targetGroupID": "tg-td6uhtxhso",
"weight": 20
}
]
},
"redirectListenerID": null
},
"certificateID": null,
"caEnabled": false,
"accessControlID": "ac-or6bz91ihq",
"accessControlType": "White",
"forwardedForEnabled": true,
"clientToken": "123e4567-b89b-12d3-a456-62665544001"
}
響應示例
#### 成功響應示例
{
"statusCode": 800,
"errorCode": "SUCCESS",
"message": "success",
"description": "成功",
"returnObj": [
{
"ID": "listener-4xvz5g2y5h"
}
]
}
#### 失敗響應示例
{
"statusCode": 900,
"message": "request param error",
"description": "參數錯誤",
"errorCode": "Openapi.Parameter.Error"
}
狀態碼
請參考
錯誤碼
請參考