添加ACL规则
更新时间:2022-05-17
接口描述
本接口用于添加ACL规则。
请求结构
Plain Text
1POST /v2/vpc/acl/rule?clientToken={clientToken} HTTP/1.1
2Host: bec.baidubce.com
3Authorization: authorization string
4
5{
6 "aclRules": [
7 {
8 "action": "allow、deny",
9 "description": "",
10 "destinationIpAddress": "",
11 "destinationPort": "",
12 "direction": "ingress、egress",
13 "position": 0,
14 "protocol": "tcp、udp、icmp、all",
15 "sourceIpAddress": "",
16 "sourcePort": "",
17 "subnetId": ""
18 }
19 ]
20}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 |
---|---|---|---|---|
request | 创建ACL规则请求 | body | 是 | CreateBecAclRequest |
aclRules | ACL规则列表 | 是 | List<BecAclRule> | |
action | 策略。允许allow,拒绝deny | 是 | string | |
description | 备注 | 否 | string | |
destinationIpAddress | 目的IP | 是 | string | |
destinationPort | 目的端口 | 否 | string | |
direction | 方向。入站ingress,出站egress | 是 | string | |
position | 优先级。数值越小,优先级越高,规则匹配顺序为按优先级由高到低匹配 | 是 | integer | |
protocol | 协议类型 | 是 | string | |
sourceIpAddress | 源IP | 是 | string | |
sourcePort | 源端口 | 否 | string | |
subnetId | 子网ID | 是 | string | |
clientToken | 幂等性Token,是一个长度不超过64位的ASCII字符串 | query | 否 | string |
响应头域
除公共头域外,无其它特殊头域。
响应参数
无
错误码
请参照错误返回章节的内容。
请求示例
Plain Text
1POST /v2/vpc/acl/rule HTTP/1.1
2Host: bec.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4
5{
6 "aclRules": [
7 {
8 "description": "",
9 "protocol": "tcp",
10 "sourceIpAddress": "0.0.0.0/0",
11 "destinationIpAddress": "10.0.1.0/24",
12 "sourcePort": "0-65535",
13 "destinationPort": "8080",
14 "position": 3,
15 "direction": "ingress",
16 "action": "allow",
17 "subnetId": "sbn-qstqimne"
18 }
19 ]
20}
响应示例
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3Date: Wed, 08 Jul 2015 03:28:11 GMT
4x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
5Server: BWS