GetRules【获取防火墙规则】¶
获取防火墙规则信息:可根据安全组ID来获取防火墙规则列表。 如果不指定任何过滤条件,则会返回错误信息。
Request Parameters
Parameter name | Type | Description | Required |
---|---|---|---|
action | String | API 标识符 | Yes |
obj_id | String | 安全组 ID | Yes |
Response Elements
Name | Type | Description |
---|---|---|
message | String | 执行结果信息 |
code | Integer | HTTP Resonpe响应状态码 |
data | Array | JSON 格式的防火墙策略列表,每项参数可见下面 Data Item |
Data Item
Name | Type | Description |
---|---|---|
direction | String | 方向 |
from_port | Integer | 端口起点(端口范围) |
group | Dict | 策略组信息 |
ip_protocol | String | IP 协议 |
to_port | Integer | 端口终点(端口范围) |
ethertype | String | 输入类型 |
parent_group_id | String | 安全组 ID |
id | String | 策略 ID |
ip_range | Dict | 远程 IP 范围 cidr:路由信息
|
Example
Example Request:
Request Headers:
POST /api/ HTTP/1.1
Origin: https://console.plcloud.com
X-CSRFToken: 6An6xEuOJqW6dVDtlgzZr6FqgkSbJmqp
Content-Type: application/x-www-form-urlencoded
Form Data:
action: GetRules
obj_id: 232676da-6c3a-4733-b649-e1d2894ba872
Example Response:
{
"message": "成功获取规则",
"code": 200,
"data": [
{
"direction": "ingress",
"from_port": null,
"group": {},
"ip_protocol": "icmp",
"to_port": null,
"ethertype": "IPv4",
"parent_group_id": "232676da-6c3a-4733-b649-e1d2894ba872",
"id": "17815195-2eaa-4fa8-a5ff-750c74ad908a",
"ip_range": {
"cidr": "0.0.0.0/0"
}
},
{
"direction": "egress",
"from_port": null,
"group": {},
"ip_protocol": null,
"to_port": null,
"ethertype": "IPv6",
"parent_group_id": "232676da-6c3a-4733-b649-e1d2894ba872",
"id": "25f858b8-2788-4d5c-b283-ce2081bfa3ad",
"ip_range": {
"cidr": "::/0"
}
},
{
"direction": "ingress",
"from_port": 80,
"group": {},
"ip_protocol": "tcp",
"to_port": 80,
"ethertype": "IPv4",
"parent_group_id": "232676da-6c3a-4733-b649-e1d2894ba872",
"id": "2fed3aa0-d75c-4e76-9f6b-26b633f3552d",
"ip_range": {
"cidr": "0.0.0.0/0"
}
},
{
"direction": "ingress",
"from_port": null,
"group": {
"name": "default"
},
"ip_protocol": null,
"to_port": null,
"ethertype": "IPv6",
"parent_group_id": "232676da-6c3a-4733-b649-e1d2894ba872",
"id": "4ebc7475-1c35-42e7-9492-cf959d768bee",
"ip_range": {}
},
{
"direction": "ingress",
"from_port": 22,
"group": {},
"ip_protocol": "tcp",
"to_port": 22,
"ethertype": "IPv4",
"parent_group_id": "232676da-6c3a-4733-b649-e1d2894ba872",
"id": "5ca82ff5-7589-4b12-83a9-2e46ef11334b",
"ip_range": {
"cidr": "0.0.0.0/0"
}
},
{
"direction": "ingress",
"from_port": null,
"group": {
"name": "default"
},
"ip_protocol": null,
"to_port": null,
"ethertype": "IPv4",
"parent_group_id": "232676da-6c3a-4733-b649-e1d2894ba872",
"id": "6e2ce0a5-48eb-47d0-9166-a47e9398f41a",
"ip_range": {}
},
{
"direction": "ingress",
"from_port": 3389,
"group": {},
"ip_protocol": "tcp",
"to_port": 3389,
"ethertype": "IPv4",
"parent_group_id": "232676da-6c3a-4733-b649-e1d2894ba872",
"id": "72676110-464b-4519-8e57-b247e72b0bf4",
"ip_range": {
"cidr": "0.0.0.0/0"
}
},
{
"direction": "egress",
"from_port": null,
"group": {},
"ip_protocol": null,
"to_port": null,
"ethertype": "IPv4",
"parent_group_id": "232676da-6c3a-4733-b649-e1d2894ba872",
"id": "8cf79de7-5964-4bf1-94bf-610aebc7a458",
"ip_range": {
"cidr": "0.0.0.0/0"
}
},
{
"direction": "ingress",
"from_port": 443,
"group": {},
"ip_protocol": "tcp",
"to_port": 443,
"ethertype": "IPv4",
"parent_group_id": "232676da-6c3a-4733-b649-e1d2894ba872",
"id": "a7978e6f-0688-46eb-ae94-fe1eeb74d739",
"ip_range": {
"cidr": "0.0.0.0/0"
}
}
]
}