創建DNAT規則
更新時間 2024-09-18 17:28:48
最近更新時間: 2024-09-18 17:28:48
分享文章
接口功能介紹
創建 dnat 規則
接口約束
需要先創建 NAT 網關
URI
POST /v4/vpc/create-dnat-entry
請求參數
請求體Body參數
| 參數 | 參數類型 | 是否必填 | 說明 | 示例 |
|---|---|---|---|---|
| regionID | String | 是 | 區域id | 79fa97e3-c48b-xxxx-9f46-6a13d8163678 |
| natGatewayID | String | 是 | natgw-1o5sdqb7i2 | nat 網關 ID |
| externalID | String | 是 | 彈性公網id | eip-3ubjeszr3a |
| externalPort | Integer | 是 | 彈性IP公網端口, 1 - 65535 | 80 |
| serverType | String | 否 | 當 virtualMachineType 為 1 是,serverType 必傳,支持: VM / BM (僅支持大寫) | VM |
| virtualMachineID | String | 否 | 云主機 | 62dab755-1f54-b961-307e-4a0c84274a09 |
| virtualMachineType | Integer | 是 | 云主機類型1-選擇云主機,virtualMachineID字段必傳 2-自定義,internalIp必傳 | 1 |
| internalIp | String | 否 | 內部 IP | 0.0.0.0 |
| internalPort | Integer | 是 | 主機內網端口 | 80 |
| protocol | String | 是 | 支持協議:tcp/udp | tcp |
| clientToken | String | 是 | 客戶端存根,用于保證訂單冪等性, 長度 1 - 64 | 79fa97e3-c48b-xxxx-9f46-6a13d8163678 |
| description | String | 否 | 支持拉丁字母、中文、數字, 特殊字符:~!@#$%^&*()_-+= <>?:"{} | ,./;'[]·~!@#¥%……&*() ——-+={} |
響應參數
| 參數 | 參數類型 | 說明 | 示例 |
|---|---|---|---|
| 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 | Object | 業務數據 | 見下表 |
表 returnObj
| 參數 | 參數類型 | 說明 | 示例 |
|---|---|---|---|
| dnat | Object | 業務數據 | 見下表 |
表 dnat
| 參數 | 參數類型 | 說明 | 示例 |
|---|---|---|---|
| status | String | 綁定狀態,取值 in_progress / done | in_progress |
| message | String | 綁定狀態提示信息 | 請使用相同請求,進行重試 |
| dnatID | String | dnat id, 當 status != done 時,dnatID 為 null | null |
請求示例
POST /v4/vpc/create-dnat-entry
請求體Body
{
"externalID":"eip-3ubjeszr3a",
"internalPort":100,
"externalPort":200,
"virtualMachineID":"62dab755-1f54-b961-307e-4a0c84274a09",
"virtualMachineType":1,
"protocol":"tcp",
"natGatewayID":"natgw-1o5sdqb7i2",
"internalIp":"192.168.58.128",
"desc":"aaa",
"regionId": "81f7728662dd11ec810800155d307d5b",
"clientToken": "xxxxxx"
}
響應示例
{
"statusCode": 800,
"errorCode": "SUCCESS",
"message": "success",
"description": "成功",
"returnObj": {
"dnat": {
"status": "in_progress",
"message": "請使用相同請求,進行重試",
"dnatID": null
}
}
}
狀態碼
| 狀態碼 | 描述 |
|---|---|
| 200 | 表示請求成功。 |
錯誤碼
請參考 錯誤碼說明。