ListWafRules - 列举WAF规则

更新时间:2025-04-14 02:52:34

列出Web应用防火墙(WAF)下的所有规则或根据特定条件筛选规则,用户可以使用此接口以分页形式查询WAF规则的详细信息。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用前面加 * 表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
操作访问级别资源类型条件关键字关联操作
esa:ListWafRuleslist
*Site
acs:esa:{#regionId}:{#accountId}:site/{#SiteId}

请求参数

名称类型必填描述示例值
名称类型必填描述示例值
SiteIdlong

站点 ID,可通过调用 ListSites 接口获取。

1
SiteVersioninteger

站点版本。

0
Phasestring

WAF 规则类型。取值:

  • http_anti_scan:扫描防护
  • http_bot:Bots
http_custom
RulesetIdlong

规则集 ID。

10000001
QueryArgsobject

查询过滤条件。

Idlong

精确查询 WAF 规则 ID。

20000001
NameLikestring

模糊查询 WAF 规则名称。

example
IdNameLikestring

模糊查询 WAF 规则 ID 或名称。

example
Statusstring

精确查询 WAF 规则状态。

on
ConfigValueLikestring

模糊搜索 IP 访问控制中的值。

10.0.0.1
OrderBystring

根据指定的列对返回列表排序。

position
Descboolean

是否对排序结果取反。

true
PageNumberinteger

查询页号,用于分页。

1
PageSizeinteger

查询页大小,用于分页。

20

返回参数

名称类型描述示例值
名称类型描述示例值
object

Schema of Response

RequestIdstring

请求 ID。

36af3fcc-43d0-441c-86b1-428951dc8225
SiteUsagelong

站点使用量。

5
InstanceUsagelong

站点对应实例中该 WAF 阶段已使用规则数量。

10
TotalCountlong

过滤后总规则数。

20
Rulesarray<object>

返回规则列表。

Ruleobject

规则详情。

UpdateTimestring

修改时间。

2024-01-01T00:00:00Z
RulesetIdlong

规则集 ID。

10000001
Idlong

规则 ID。

20000001
Positionlong

规则在对应规则集中所处的位置顺序。

1
Phasestring

WAF 阶段。

http_custom
Typestring

规则类型。

http_custom
Namestring

规则名称。

example
Statusstring

规则状态。

on
Fieldsarray

规则的匹配字段列表。

fieldstring

规则的匹配字段值。

ip.geoip.asnum
CharacteristicsFieldsarray

频次控制类规则的统计对象列表。

characteristicsFieldstring

频次控制类规则的统计对象。

ip.src
Actionstring

规则对应的动作。

deny
Skipstring

白名单类规则的跳过属性。

part
Tagsarray

白名单类规则的跳过 WAF 阶段列表。

tagstring

白名单类规则的跳过 WAF 阶段值。

http_custom
TimerWafTimer

规则生效时间配置。

ConfigWafRuleConfig

规则配置。

PageNumberinteger

页面号码。

1
PageSizeinteger

页面大小。

20

示例

正常返回示例

JSON格式

{
  "RequestId": "36af3fcc-43d0-441c-86b1-428951dc8225",
  "SiteUsage": 5,
  "InstanceUsage": 10,
  "TotalCount": 20,
  "Rules": [
    {
      "UpdateTime": "2024-01-01T00:00:00Z",
      "RulesetId": 10000001,
      "Id": 20000001,
      "Position": 1,
      "Phase": "http_custom",
      "Type": "http_custom",
      "Name": "example",
      "Status": "on",
      "Fields": [
        "ip.geoip.asnum"
      ],
      "CharacteristicsFields": [
        "ip.src"
      ],
      "Action": "deny",
      "Skip": "part",
      "Tags": [
        "http_custom"
      ],
      "Timer": {
        "Scopes": "permanent",
        "Zone": 8,
        "Periods": [
          {
            "Start": "2025-01-01T00:00:00Z",
            "End": "2025-01-01T01:00:00Z"
          }
        ],
        "WeeklyPeriods": [
          {
            "Days": "1",
            "DailyPeriods": [
              {
                "Start": "00:00:00",
                "End": "01:00:00"
              }
            ]
          }
        ]
      },
      "Config": {
        "Id": 20000001,
        "Name": "example",
        "Status": "on",
        "Type": "http_custom",
        "Match": {
          "Logic": "and",
          "Criteria": [
            {
              "Logic": "and",
              "Criteria": [
                {
                  "Logic": "and",
                  "Criteria": [],
                  "MatchType": "ip.src",
                  "MatchOperator": "eq",
                  "MatchValue": "1.1.1.1",
                  "Negate": true,
                  "ConvertToLower": true
                }
              ],
              "MatchType": "ip.src",
              "MatchOperator": "eq",
              "MatchValue": "1.1.1.1",
              "Negate": true,
              "ConvertToLower": true
            }
          ],
          "MatchType": "ip.src",
          "MatchOperator": "eq",
          "MatchValue": "1.1.1.1",
          "Negate": true,
          "ConvertToLower": true
        },
        "Action": "deny",
        "Actions": {
          "Response": {
            "Id": 50000001,
            "Code": 403
          },
          "Bypass": {
            "Skip": "part",
            "Tags": [
              "http_custom"
            ],
            "RegularTypes": [
              "sqli"
            ],
            "RegularRules": [
              100001
            ],
            "CustomRules": [
              20000001
            ]
          }
        },
        "ManagedGroupId": 30000001,
        "RateLimit": {
          "Characteristics": {
            "Logic": "and",
            "Criteria": [
              {
                "Logic": "and",
                "Criteria": [
                  {
                    "Logic": "and",
                    "Criteria": [
                      {
                        "MatchType": "ip.src",
                        "MatchOperator": "eq",
                        "MatchValue": "1.1.1.1",
                        "Negate": true,
                        "ConvertToLower": true
                      }
                    ],
                    "MatchType": "ip.src",
                    "MatchOperator": "eq",
                    "MatchValue": "1.1.1.1",
                    "Negate": true,
                    "ConvertToLower": true
                  }
                ],
                "MatchType": "ip.src",
                "MatchOperator": "eq",
                "MatchValue": "1.1.1.1",
                "Negate": true,
                "ConvertToLower": true
              }
            ],
            "MatchType": "ip.src",
            "MatchOperator": "eq",
            "MatchValue": "1.1.1.1",
            "Negate": true,
            "ConvertToLower": true
          },
          "Threshold": {
            "Request": 10,
            "Traffic": "10Gb",
            "ManagedRulesBlocked": 10,
            "DistinctManagedRules": 10,
            "ResponseStatus": {
              "Code": 404,
              "Count": 10,
              "Ratio": 10
            }
          },
          "Interval": 10,
          "TTL": 10,
          "OnHit": true
        },
        "ManagedList": "intelligence_crawler",
        "Timer": {
          "Scopes": "permanent",
          "Zone": 8,
          "Periods": [
            {
              "Start": "2025-01-01T00:00:00Z",
              "End": "2025-01-01T01:00:00Z"
            }
          ],
          "WeeklyPeriods": [
            {
              "Days": "1",
              "DailyPeriods": [
                {
                  "Start": "00:00:00",
                  "End": "01:00:00"
                }
              ]
            }
          ]
        },
        "Sigchl": [
          "sig"
        ],
        "AppSdk": {
          "FeatureAbnormal": [
            "wxbb_invalid_sign"
          ],
          "CustomSignStatus": "on",
          "CustomSign": {
            "Key": "sign",
            "Value": "examplesignvalue"
          }
        },
        "AppPackage": {
          "PackageSigns": [
            {
              "Name": "name",
              "Sign": "sign"
            }
          ]
        },
        "Expression": "ip.src eq 10.0.0.1",
        "ManagedRulesets": [
          {
            "AttackType": 11,
            "NumberTotal": 100,
            "NumberEnabled": 50,
            "ProtectionLevel": 4,
            "Action": "deny",
            "ManagedRules": [
              {
                "Id": 100001,
                "Status": "on",
                "Action": "deny"
              }
            ]
          }
        ],
        "Value": "10.0.0.1",
        "Notes": "example notes",
        "SecurityLevel": {
          "Value": "low"
        }
      }
    }
  ],
  "PageNumber": 1,
  "PageSize": 20
}

错误码

HTTP status code错误码错误信息描述
HTTP status code错误码错误信息描述
400InvalidParameterThe specified parameter is invalid.输入参数规范校验失败。
400InternalExceptionFailed to call the service. Try again later or contact technical support.调用服务失败,请稍后重试或联系客服咨询详情。

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
变更时间变更内容概要操作
2024-12-12OpenAPI 错误码发生变更查看变更详情
2024-09-25OpenAPI 错误码发生变更查看变更详情
  • 本页导读
  • 调试
  • 授权信息
  • 请求参数
  • 返回参数
  • 示例
  • 错误码
  • 变更历史