GetUserWafRuleset - 获取用户WAF规则集

更新时间:
复制 MD 格式

API用于查询指定实例下的WAF规则集详情。

接口说明

请求说明

通过调用GetUserWafRuleset接口,您可以根据提供的实例 ID 和规则集 ID 来获取特定的 WAF(Web 应用防火墙)规则集信息。该接口返回的信息包括但不限于规则集的位置、名称、描述、状态以及包含的具体规则等详细内容。请确保在请求时正确填写必需参数以避免请求失败。

调试

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

调试

授权信息

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

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

esa:GetUserWafRuleset

get

*全部资源

*

请求参数

名称

类型

必填

描述

示例值

InstanceId

string

实例 ID。

esa-xxxxxxx

Id

integer

WAF 规则集 ID。

10000001

返回参数

名称

类型

描述

示例值

object

Schema of Response

RequestId

string

请求 ID。

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

Ruleset

object

WAF 规则集。

{}

Id

integer

WAF 规则集 ID。

10000001

Position

integer

WAF 规则集位置。

1

Name

string

WAF 规则集名称。

example

Description

string

WAF 规则集描述。

example

Status

string

WAF 规则集状态。

on

Expression

string

WAF 规则集表达式。

ip.src == 1.1.1.1

Phase

string

WAF 规则运行阶段。

  • http_whitelist:白名单规则

  • http_custom:自定义规则

  • http_managed:托管规则

  • http_anti_scan:扫描防护规则

  • http_ratelimit:频次控制规则

http_custom

Shared WafBatchRuleShared

WAF 规则集共享配置。

{}

Rules

array<object>

WAF 规则集下的规则配置列表。

[{}]

object

WAF 规则集下的规则配置。

{}

UpdateTime

string

WAF 规则更新时间。

格式:RFC 3339 / ISO 8601,UTC 标准时区(以 Z 结尾)。

示例:2025-07-07T15:00:00Z

2025-07-07T15:00:00Z

RulesetId

integer

WAF 规则集 ID。

10000001

Id

integer

WAF 规则 ID。

20000001

Position

integer

WAF 规则位置。

1

Phase

string

WAF 规则运行阶段。

  • http_whitelist:白名单规则

  • http_custom:自定义规则

  • http_managed:托管规则

  • http_anti_scan:扫描防护规则

  • http_ratelimit:频次控制规则

http_custom

Type

string

WAF 规则类型。

http_ratelimit

Name

string

WAF 规则名称。

example

Status

string

WAF 规则状态。

on

Fields

array

WAF 规则匹配域列表。

["ip.src"]

string

WA 规则匹配域。

ip.src

CharacteristicsFields

array

WAF 规则统计域列表。

["http.host"]

string

WAF 规则统计域。

http.host

Action

string

规则对应的动作。

  • deny:拦截

  • monitor:观察

  • js:JS 挑战

  • captcha:滑块挑战

deny

Skip

string

WAF 规则跳过方式。

all

Tags

array

WAF 规则跳过阶段列表。

["http_custom"]

string

WAF 规则跳过阶段。

http_custom

Config WafRuleConfig

WAF 规则配置。

{ "Id": 20000001, "Name": "rule1", "Expression": "ip.src eq 1.1.1.1", "Action": "deny" }

示例

正常返回示例

JSON格式

{
  "RequestId": "36af3fcc-43d0-441c-86b1-428951dc8225",
  "Ruleset": {
    "Id": 10000001,
    "Position": 1,
    "Name": "example",
    "Description": "example",
    "Status": "on",
    "Expression": "ip.src == 1.1.1.1",
    "Phase": "http_custom",
    "Shared": {
      "Target": "web",
      "Mode": "automatic",
      "CrossSiteId": 10000001,
      "Name": "example",
      "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
          }
        ],
        "MatchType": "ip.src",
        "MatchOperator": "eq",
        "MatchValue": "1.1.1.1",
        "Negate": true,
        "ConvertToLower": true
      },
      "Action": "deny",
      "Actions": {
        "Response": {
          "Id": 50000001,
          "Code": 403
        }
      },
      "Expression": "ip.src eq 1.1.1.1"
    },
    "Rules": [
      {
        "UpdateTime": "2025-07-07T15:00:00Z",
        "RulesetId": 10000001,
        "Id": 20000001,
        "Position": 1,
        "Phase": "http_custom",
        "Type": "http_ratelimit",
        "Name": "example",
        "Status": "on",
        "Fields": [
          "ip.src"
        ],
        "CharacteristicsFields": [
          "http.host"
        ],
        "Action": "deny",
        "Skip": "all",
        "Tags": [
          "http_custom"
        ],
        "Config": {
          "Status": "on",
          "Action": "deny",
          "Actions": {
            "Response": {
              "Id": 50000001,
              "Code": 403
            },
            "Bypass": {
              "Skip": "part",
              "RegularRules": [
                100001
              ],
              "CustomRules": [
                20000001
              ],
              "RegularTypes": [
                "sqli"
              ],
              "Tags": [
                "http_custom"
              ]
            }
          },
          "ManagedList": "intelligence_crawler",
          "ManagedRulesets": [
            {
              "ProtectionLevel": 4,
              "Action": "deny",
              "ManagedRules": [
                {
                  "Status": "on",
                  "Action": "deny",
                  "Id": 100001
                }
              ],
              "AttackType": 11,
              "NumberTotal": 100,
              "NumberEnabled": 50
            }
          ],
          "Sigchl": [
            "sig"
          ],
          "Name": "example",
          "AppSdk": {
            "CustomSign": {
              "Value": "examplesignvalue",
              "Key": "sign"
            },
            "CustomSignStatus": "on",
            "FeatureAbnormal": [
              "wxbb_invalid_sign"
            ]
          },
          "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
            },
            "OnHit": true,
            "TTL": 10,
            "Threshold": {
              "ManagedRulesBlocked": 10,
              "DistinctManagedRules": 10,
              "ResponseStatus": {
                "Ratio": 10,
                "Count": 10,
                "Code": 404
              },
              "Traffic": "10Gb",
              "Request": 10
            },
            "Interval": 10
          },
          "Type": "http_custom",
          "AppPackage": {
            "PackageSigns": [
              {
                "Sign": "sign",
                "Name": "name"
              }
            ]
          },
          "ManagedGroupId": 30000001,
          "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"
                  }
                ]
              }
            ]
          },
          "Expression": "ip.src eq 10.0.0.1",
          "SecurityLevel": {
            "Value": "low"
          },
          "Value": "10.0.0.1",
          "Id": 20000001,
          "Notes": "example notes"
        }
      }
    ]
  }
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidParameter The specified parameter is invalid. 输入参数规范校验失败。
400 InternalException Failed to call the service. Try again later or contact technical support. 调用服务失败,请稍后重试或联系客服咨询详情。

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

变更历史

更多信息,参考变更详情