NetworkCreate【新建交换机】¶
新建交换机:可输入交换机名称,子网名称和子网网段来创建交换机。 如果不指定必要新建条件,则会返回错误信息。
Request Parameters
Parameter name | Type | Description | Required |
---|---|---|---|
action | String | API 标识符 | Yes |
name | String | 交换机名称 | Yes |
network_id | String | 网络 ID | No |
subnet_id | String | 子网 ID | No |
subnet_name | String | 子网名称 | Yes |
cidr | String | 子网网段 | Yes |
ip_version | Integer | IP 协议版本(默认值:4) | Yes |
no_gateway | Integer | 是否需要网关(默认值:0) | Yes |
gateway_ip | String | 网关 IP(和no_gateway配合使用,默认值:空) | Yes |
enable_dhcp | Integer | 是否使用 DHCP 获取 IP(默认值:1) | Yes |
allocation_pools | String | IP 地指池分配 | No |
host_routers | String | 主机路由 | No |
dns_nameservers | String | DNS 服务器 | Yes |
is_create | Integer | 是否新建(默认值:1) | Yes |
ip_1 | String | IPV4 地址左起第一个数值 | Yes |
ip_2 | String | IPV4 地址左起第二个数值 | Yes |
ip_2 | String | IPV4 地址左起第三个数值 | Yes |
ip_5 | String | 子网掩码位数 | Yes |
Response Elements
Name | Type | Description |
---|---|---|
message | String | 执行结果信息 |
code | Integer | HTTP Resonpe响应状态码 |
Example
Example Request:
Request Headers:
POST /api/ HTTP/1.1
Origin: https://console.plcloud.com
X-CSRFToken: 6An6xEuOJqW6dVDtlgzZr6FqgkSbJmqp
Content-Type: application/json
JSON Data:
{
"action": "NetworkCreate",
"name": "kevin_test",
"network_id": "",
"subnet_id": "",
"subnet_name": "kevin_subnet",
"cidr": "10.3.3.0/24",
"ip_version": 4,
"no_gateway": 0,
"gateway_ip": "",
"enable_dhcp": 1,
"allocation_pools": "",
"host_routers": "",
"dns_nameservers": "114.114.114.114",
"is_create": 1,
"ip_1": "10",
"ip_2": "3",
"ip_3": "3",
"ip_5": "24"
}
Example Response:
{
"message": "成功",
"code": 200
}