RuleCreate【新建防火墙规则】¶
新建防火墙规则:指定IP协议和开放端口来新建防火墙规则,制定自己的访问规则。
Request Parameters
Parameter name | Type | Description | Required |
---|---|---|---|
action | String | API 标识符 | Yes |
cidr | String | 无类别路由(默认值:0.0.0.0/0) | Yes |
direction | String | 方向 | Yes |
ethertype | String | 输入类型 | Yes |
from_port | String | 端口起点(端口范围) | Yes |
ip_protocol | String | IP 协议 | Yes |
name | String | 规则名称 | No |
obj_id | String | 安全组 ID | Yes |
to_port | 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": "RuleCreate",
"obj_id": "7845b23d-b6ff-440a-a214-bd8e4c9147b7",
"direction": "ingress",
"ethertype": "IPv4",
"ip_protocol": "tcp",
"from_port": "9556",
"to_port": "9556",
"cidr": "0.0.0.0/0",
"name": null
}
Example Response:
{
"message": "角色创建成功。",
"code": 200
}