网络ACL插入规则
功能介绍
网络ACL插入规则
该接口在华北-北京四,华东-上海一,华南-广州,华南-深圳,西南-贵阳一,亚太-新加坡区域上线。
URI
PUT /v3/{project_id}/vpc/firewalls/{firewall_id}/insert-rules
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
firewall_id |
是 |
String |
网络ACL的唯一标识 |
project_id |
是 |
String |
项目ID |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
firewall |
是 |
FirewallInsertRuleOption object |
插入ACL的入方向、出方向规则 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
ingress_rules |
否 |
Array of FirewallInsertRuleItemOption objects |
功能说明:ACL添加入方向规则列表 |
egress_rules |
否 |
Array of FirewallInsertRuleItemOption objects |
功能说明:ACL添加出方向规则列表 |
insert_after_rule |
否 |
String |
功能说明:插入ACL的规则在入方向或者出方向某条规则位置后,不指定则在入方向或者出方向规则列表最前面插入规则 约束:指定了insert_after_rule,ingress_rules和egress_rules只能同时设置一个,且该规则在入方向或者出方向规则中存在 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
name |
否 |
String |
功能说明:ACL规则名称 取值范围:0-64个字符,支持数字、字母、中文、_(下划线)、-(中划线)、.(点) |
description |
否 |
String |
功能说明:ACL规则描述信息 取值范围:0-255个字符 约束:不能包含“<”和“>”。 |
action |
是 |
String |
功能说明:ACL规则对流量执行的操作放通或拒绝 取值范围:allow放通;deny拒绝 |
protocol |
是 |
String |
功能说明:ACL规则协议 取值范围:支持tcp,udp,icmp,icmpv6或者协议号(0-255),any表示全部协议 |
ip_version |
是 |
Integer |
功能说明:ACL规则的ip版本 取值范围:4, 表示ipv4;6, 表示ipv6 |
source_ip_address |
否 |
String |
功能说明:ACL规则源IP地址或者CIDR 约束:source_ip_address和source_address_group_id不能同时设置 |
destination_ip_address |
否 |
String |
功能说明:ACL规则目的IP地址或者CIDR 约束:destination_ip_address和destination_address_group_id不能同时设置 |
source_port |
否 |
String |
功能说明:ACL规则的源端口 取值范围:支持端口号,一段端口范围,多个以逗号分隔 约束:支持的端口组的数量默认为20 |
destination_port |
否 |
String |
功能说明:ACL规则的目的端口 取值范围:支持端口号,一段端口范围,多个以逗号分隔 约束:支持的端口组的数量默认为20 |
source_address_group_id |
否 |
String |
功能说明:ACL规则的源地址组ID 约束:source_ip_address和source_address_group_id不能同时设置 |
destination_address_group_id |
否 |
String |
功能说明:ACL规则的目的地址组ID 约束:destination_ip_address和destination_address_group_id不能同时设置 |
enabled |
否 |
Boolean |
功能说明:是否启用ACL规则 取值范围:true,表示启用;false,表示停用 默认值:true |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
firewall |
FirewallDetail object |
ACL插入规则后的详情 |
request_id |
String |
请求ID |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
功能说明:ACL唯一标识 取值范围:合法UUID的字符串 |
name |
String |
功能说明:ACL名称 取值范围:0-64个字符,支持数字、字母、中文、_(下划线)、-(中划线)、.(点) |
description |
String |
功能说明:地址组描述信息 取值范围:0-255个字符 约束:不能包含“<”和“>”。 |
project_id |
String |
功能说明:资源所属项目ID |
created_at |
String |
功能说明:ACL创建时间 取值范围:UTC时间格式:yyyy-MM-ddTHH:mm:ssZ;系统自动生成 |
updated_at |
String |
功能描述:ACL最近一次更新资源的时间 取值范围:UTC时间格式:yyyy-MM-ddTHH:mm:ssZ;系统自动生成 |
admin_state_up |
Boolean |
功能说明:ACL是否开启 取值范围:true表示ACL开启;false表示ACL关闭 |
status |
String |
功能说明:网络ACL的状态 |
enterprise_project_id |
String |
功能说明:ACL企业项目ID。 取值范围:最大长度36字节,带“-”连字符的UUID格式,或者是字符串“0”。“0”表示默认企业项目。 |
tags |
Array of ResourceTag objects |
功能描述:ACL资源标签 |
associations |
Array of FirewallAssociation objects |
功能说明:ACL绑定的子网列表 |
ingress_rules |
Array of FirewallRuleDetail objects |
功能说明:ACL入方向规则列表 |
egress_rules |
Array of FirewallRuleDetail objects |
功能说明:ACL出方向规则列表 |
参数 |
参数类型 |
描述 |
---|---|---|
key |
String |
功能说明:标签键 约束:同一资源的key值不能重复。 最小长度:1 最大长度:128 |
value |
String |
功能说明:标签值 最大长度:255 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
功能说明:ACL规则唯一标识 取值范围:合法UUID的字符串 |
name |
String |
功能说明:ACL规则名称 取值范围:0-64个字符,支持数字、字母、中文、_(下划线)、-(中划线)、.(点) |
description |
String |
功能说明:ACL规则描述信息 取值范围:0-255个字符 约束:不能包含“<”和“>”。 |
action |
String |
功能说明:ACL规则对流量执行的操作放通或拒绝 取值范围:allow放通;deny拒绝 |
project_id |
String |
功能说明:资源所属项目ID |
protocol |
String |
功能说明:ACL规则协议 取值范围:支持TCP,UDP,ICMP, ICMPV6或者IP协议号(0-255) |
ip_version |
Integer |
功能说明:ACL规则的ip版本 取值范围:4, 表示ipv4;6, 表示ipv6 |
source_ip_address |
String |
功能说明:ACL规则源IP地址或者CIDR 约束:source_ip_address和source_address_group_id不能同时设置 |
destination_ip_address |
String |
功能说明:ACL规则目的IP地址或者CIDR 约束:destination_ip_address和destination_address_group_id不能同时设置 |
source_port |
String |
功能说明:ACL规则的源端口 取值范围:支持端口号,一段端口范围,多个以逗号分隔 约束:支持的端口组的数量默认为20 |
destination_port |
String |
功能说明:ACL规则的目的端口 取值范围:支持端口号,一段端口范围,多个以逗号分隔 约束:支持的端口组的数量默认为20 |
source_address_group_id |
String |
功能说明:ACL规则的源地址组ID 约束:source_ip_address和source_address_group_id不能同时设置 |
destination_address_group_id |
String |
功能说明:ACL规则的目的地址组ID 约束:destination_ip_address和destination_address_group_id不能同时设置 |
enabled |
Boolean |
功能说明:是否启用ACL规则 取值范围:true,表示启用;false,表示停用 默认值:true |
请求示例
- 插入两条入方向规则到id为e9a7731d-5bd9-4250-a524-b9a076fd5629的网络ACL中,插入到规则a2a7731d-5bd9-4250-a524-b9a076fd5630之后。
PUT https://{Endpoint}/v3/{project_id}/vpc/firewalls/e9a7731d-5bd9-4250-a524-b9a076fd5629/insert-rules { "firewall" : { "ingress_rules" : [ { "name" : "network_acl_rule ipv4 test", "description" : "network_acl_rule ipv4 test", "action" : "allow", "protocol" : "tcp", "ip_version" : "4", "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null },{ "name" : "network_acl_rule ipv6 test", "description" : "network_acl_rule ipv6 test", "action" : "allow", "protocol" : "tcp", "ip_version" : "6", "source_ip_address" : "2002:50::44", "destination_ip_address" : "2002:51::44", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null } ], "insert_after_rule" : "a2a7731d-5bd9-4250-a524-b9a076fd5630" } }
- 插入两条出方向规则到id为e9a7731d-5bd9-4250-a524-b9a076fd5629的网络ACL中,插入到规则a3a7731d-5bd9-4250-a524-b9a076fd5630之后。
PUT https://{Endpoint}/v3/{project_id}/vpc/firewalls/e9a7731d-5bd9-4250-a524-b9a076fd5629/insert-rules { "firewall" : { "egress_rules" : [ { "name" : "network_acl_rule ipv4 test", "description" : "network_acl_rule ipv4 test", "action" : "allow", "protocol" : "tcp", "ip_version" : "4", "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null },{ "name" : "network_acl_rule ipv6 test", "description" : "network_acl_rule ipv6 test", "action" : "allow", "protocol" : "tcp", "ip_version" : "6", "source_ip_address" : "2002:50::44", "destination_ip_address" : "2002:51::44", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null }], "insert_after_rule" : "a3a7731d-5bd9-4250-a524-b9a076fd5630" } }
响应示例
状态码: 200
OK
{ "firewall" : { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_test1", "description" : "network_acl_test1", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "created_at" : "2022-04-07T07:30:46Z", "updated_at" : "2022-04-07T07:30:46Z", "admin_state_up" : true, "enterprise_project_id" : "158ad39a-dab7-45a3-9b5a-2836b3cf93f9", "status" : "ACTIVE", "tags" : [ ], "ingress_rules" : [{ "id" : "a2a7731d-5bd9-4250-a524-b9a076fd5630", "name" : "network_acl_rule", "description" : "network_acl_rule", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : "4", "source_ip_address" : "192.168.13.0/24", "destination_ip_address" : "192.168.16.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null },{ "id" : "4afc959f-5380-dd94-8082-5701f6bc3f1c", "name" : "network_acl_rule ipv4 test", "description" : "network_acl_rule ipv4 test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : "4", "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null },{ "id" : "b49dcd4c-508e-4b99-9093-2680616f2a7e", "name" : "network_acl_rule ipv6 test", "description" : "network_acl_rule ipv6 test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : "6", "source_ip_address" : "2002:50::44", "destination_ip_address" : "2002:51::44", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null }], "egress_rules" : [{ "id" : "a3a7731d-5bd9-4250-a524-b9a076fd5630", "name" : "network_acl_rule", "description" : "network_acl_rule", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : "4", "source_ip_address" : "192.168.13.0/24", "destination_ip_address" : "192.168.16.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null },{ "id" : "f9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule ipv4 test", "description" : "network_acl_rule ipv4 test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : "4", "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null }, { "id" : "bbbc1cd1-b8e1-45d3-b3bc-7bc360f8860d", "name" : "network_acl_rule ipv6 test", "description" : "network_acl_rule ipv6 test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : "6", "source_ip_address" : "2002:50::44", "destination_ip_address" : "2002:51::44", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null }], "associations" : [ { "virsubnet_id" : "8359e5b0-353f-4ef3-a071-98e67a34a143" } ] } }
状态码
请参见状态码。
错误码
请参见错误码。