创建VPN
更新时间:2024-08-08
描述
创建VPN。
请求结构
POST /v{version}/vpn?clientToken={clientToken} HTTP/1.1
Host: bcc.bj.baidubce.com
Authorization: authorization string
{
"vpcId": vpcId,
"vpnName": vpnName,
"description": description,
"eip": eip,
"billing": {
"paymentTiming": paymentTiming,
"reservation": {
"reservationLength": reservationLength,
"reservationTimeUnit": reservationTimeUnit
}
},
"tags": [
{
"tagKey": tagKey,
"tagValue": tagValue
}
],
"resourceGroupId": resourceGroupId,
"deleteProtect": deleteProtect
}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必选 | 参数位置 | 描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号 |
clientToken | String | 否 | Query参数 | 幂等性Token,是一个长度不超过64位的ASCII字符串,详见ClientToken幂等性。 |
vpcId | String | 是 | Request Body参数 | 所属VPC的ID |
subnetId | String | 否 | Request Body参数 | 所属SUBNET的ID |
vpnName | String | 是 | Request Body参数 | VPN的名称,大小写字母、数字以及-_/.特殊字符,必须以字母开头,长度1-65 |
type | String | 否 | Request Body参数 | VPN网关类型,值“IPSec”表示IPSec-VPN网关,值“SSL”表示SSL-VPN网关,默认为“IPSec” |
description | String | 否 | Request Body参数 | VPN的描述 |
eip | String | 否 | Request Body参数 | VPN绑定的eip |
tag | List |
是 | Request Body参数 | vpn绑定的标签 |
resourceGroupId | String | 是 | Request Body参数 | vpn绑定的资源组 |
billing | Billing | 是 | Request Body参数 | 计费信息,支持预付费和后付费方式 |
maxConnection | Integer | 否 | Request Body参数 | SSL-VPN最大客户端连接数。可选 [5, 10, 20, 50, 100, 200, 500, 1000]。仅SSL-VPN需要选这个参数。 |
deleteProtect | Boolean | 否 | RequestBody参数 | 是否开启释放保护。缺省值为false,代表允许删除 |
返回头域
除公共头域,无其它特殊头域。
返回参数
参数名称 | 类型 | 描述 |
---|---|---|
vpnId | String | VPN的id |
请求示例
预付费
POST /v1/vpn?clientToken=1849ef6b-f73c-4f5d-b88b-259ca47af849 HTTP/1.1
Host: bcc.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
"vpcId": "vpc-IyWRtII7",
"vpnName": "vpnName",
"description": "description",
"eip": "",
"billing":{
"reservation":{
"reservationLength":1,
"reservationTimeUnit":"month"
},
"paymentTiming":"Prepaid"
},
"tags": [
{
"tagKey": "hikwnf",
"tagValue": "nwklwmflk"
},
{
"tagKey": "whfooef",
"tagValue": "haiwnwejf"
}
],
"resourceGroupId": "RESG-UoMgbkuLNjj",
"deleteProtect":true
}
后付费
POST /v1/vpn?clientToken=1849ef6b-f73c-4f5d-b88b-259ca47af849 HTTP/1.1
Host: bcc.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
"vpcId": "vpc-IyWRtII7",
"vpnName": "vpnName",
"description": "description",
"eip": "",
"billing":{
"paymentTiming":"Postpaid"
},
"tags": [
{
"tagKey": "hikwnf",
"tagValue": "nwklwmflk"
},
{
"tagKey": "whfooef",
"tagValue": "haiwnwejf"
}
],
"resourceGroupId": "RESG-UoMgbkuLNjj",
"deleteProtect":true
}
返回示例
HTTP/1.1 200 OK
x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
Date: Thu, 16 Mar 2017 06:29:48 GMT
Content-Type: application/json;charset=UTF-8
Server: BWS
{
"vpnId": "vpn-ku4cxya6nisq"
}