列出Web应用防火墙(WAF)下的所有托管规则或根据特定条件筛选规则,用户可以使用此接口以分页形式查询WAF托管规则的详细信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
esa:ListWafManagedRules |
list |
*Site
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| SiteId |
integer |
否 |
站点 ID,可通过调用 ListSites 接口获取。 |
1 |
| InstanceId |
string |
否 |
WAF 实例 ID。 |
esa-site-awmmx25y2igw |
| Id |
integer |
否 |
WAF 规则的 ID。 |
10000001 |
| ManagedRuleset |
object |
否 |
托管规则集配置,JSON 字符串格式。 包含 AttackType、ProtectionLevel、Action 及 ManagedRules 子字段。当 ProtectionLevel 为 -1(自定义模式)时,需通过 ManagedRules 数组逐条指定规则状态和动作。 |
|
| AttackType |
integer |
否 |
攻击类型编码,不可为 0。 取值示例:11(SQL 注入)、12(XSS)、13(代码执行)、14(CRLF)、15(本地文件包含)、16(远程文件包含)、17(WebShell)、22(命令注入)、26(SSRF)、27(路径穿越)、28(协议违规)、31(扫描器行为)等。 |
11 |
| ProtectionLevel |
integer |
否 |
规则集内的防护等级。 取值:-1(自定义模式,通过 ManagedRules 逐条指定)、1(宽松)、2(中等)、3(严格)、4(超严格)。 当值为 -1 时,ManagedRules 不能为空;当值 > 0 时,Action 不能为空。 |
-1 |
| Action |
string |
否 |
当 ProtectionLevel > 0 时的统一处置动作,此时不可为空。 常用取值:monitor、deny、js、captcha 等,实际可用值取决于实例配额。 |
monitor |
| ManagedRules |
array<object> |
否 |
自定义模式下的规则配置列表,仅当 ProtectionLevel 为 -1 时使用。 每个元素包含 Id、Status 和 Action,用于逐条指定托管规则的启用状态和处置动作。 |
|
|
object |
否 |
|||
| Id |
integer |
否 |
单条托管规则的唯一标识 ID。 |
20611349 |
| Status |
string |
否 |
规则启用状态。 取值:on(启用)、off(禁用)。 |
on |
| Action |
string |
否 |
单条规则的处置动作,仅在自定义模式(ProtectionLevel = -1)下生效。 常用取值:monitor、deny、js、captcha 等,实际可用值取决于实例配额。 |
js |
| AttackType |
integer |
是 |
漏洞防护事件的攻击类型。取值:
|
11 |
| ProtectionLevel |
integer |
否 |
当前已保存的防护等级,代表数据库中已存在的配置状态。 取值:-1(自定义模式)、1(宽松)、2(中等)、3(严格)、4(超严格)。 与 ManagedRuleset.ProtectionLevel 的区别:本字段是当前已生效的配置,ManagedRuleset.ProtectionLevel 是传入的目标值。 |
1 |
| Language |
string |
否 |
语言类型,将以此语言返回。取值范围:
|
zh |
| QueryArgs |
object |
否 |
查询条件。 |
{\"Status\":\"\",\"ProtectionLevels\":[2,1],\"Action\":\"\",\"IdNameLike\":\"\"} |
| IdNameLike |
string |
否 |
模糊查询规则 id 或规则名称。 |
example |
| ProtectionLevels |
array |
否 |
规则防护等级列表。 |
|
|
integer |
否 |
规则防护等级。取值:
|
1 |
|
| Action |
string |
否 |
动作。 |
deny |
| Status |
string |
否 |
状态。 |
on |
| PageNumber |
integer |
否 |
查询页号。 |
1 |
| PageSize |
integer |
否 |
查询页大小。 |
20 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| RequestId |
string |
请求 ID。 |
36af3fcc-43d0-441c-86b1-428951dc8225 |
| TotalCount |
integer |
过滤后总规则数。 |
20 |
| Rules |
array<object> |
托管规则列表。 |
|
|
object |
托管规则详情。 |
||
| Id |
integer |
托管规则 ID。 |
100001 |
| Name |
string |
托管规则名称。 |
SQL injection |
| ProtectionLevel |
integer |
托管规则防护等级。 |
1 |
| Action |
string |
托管规则防护动作。 |
deny |
| Status |
string |
托管规则防护状态。 |
on |
| PageNumber |
integer |
页面号码。 |
1 |
| PageSize |
integer |
页面大小。 |
20 |
示例
正常返回示例
JSON格式
{
"RequestId": "36af3fcc-43d0-441c-86b1-428951dc8225",
"TotalCount": 20,
"Rules": [
{
"Id": 100001,
"Name": "SQL injection ",
"ProtectionLevel": 1,
"Action": "deny",
"Status": "on"
}
],
"PageNumber": 1,
"PageSize": 20
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid. | 输入参数规范校验失败。 |
| 400 | InternalException | Failed to call the service. Try again later or contact technical support. | 调用服务失败,请稍后重试或联系客服咨询详情。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。