批量创建CFW规则
更新时间:2022-04-25
描述
批量创建CFW中防护规则。
- 五元组(protocol/sourceAddress/destAddress/sourcePort/destPort) + 方向(direction)不能全部相同。
- 一次最多创建100条规则。
请求结构
Plain Text
1POST /v{version}/cfw/{cfwId}/rule HTTP/1.1
2Host: cfw.baidubce.com
3Authorization: authorization string
4{
5 "cfwRules": [
6 {
7 "ipVersion": 4,
8 "priority": "1",
9 ......
10 }
11 ]
12}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必选 | 参数位置 | 描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号 |
cfwId | String | 是 | URL参数 | CFW的id |
cfwRules | List<CreateRule> | 是 | RequestBody参数 | CFW规则列表 |
返回头域
除公共头域,无其它特殊头域。
返回参数
无返回参数
请求示例
Plain Text
1POST /v1/cfw/cfw-84r4j7baiq0x/rule HTTP/1.1
2Host: cfw.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2022-03-23T06:27:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4{
5 "cfwRules": [
6 {
7 "ipVersion": 4,
8 "priority": "1",
9 "protocol": "TCP",
10 "direction": "in",
11 "sourceAddress": "192.168.0.1",
12 "destAddress": "192.168.0.2",
13 "sourcePort": "80",
14 "destPort": "88",
15 "action": "allow",
16 "description": "cfw_rule_desc"
17 }
18 ]
19}
返回示例
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: Thu, 23 Mar 2022 06:29:48 GMT
4Content-Type: application/json;charset=UTF-8
5Server: BWS