Skip to content

/AWS1/CL_WA2RULE

A single rule, which you can use in a WebACL or RuleGroup to identify web requests that you want to manage in some way. Each rule includes one top-level Statement that WAF uses to identify matching web requests, and parameters that govern how WAF handles them.

CONSTRUCTOR

IMPORTING

Required arguments:

IV_NAME TYPE /AWS1/WA2ENTITYNAME /AWS1/WA2ENTITYNAME

The name of the rule.

If you change the name of a Rule after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's VisibilityConfig settings. WAF doesn't automatically update the metric name when you update the rule name.

IV_PRIORITY TYPE /AWS1/WA2RULEPRIORITY /AWS1/WA2RULEPRIORITY

If you define more than one Rule in a WebACL, WAF evaluates each request against the Rules in order based on the value of Priority. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.

IO_STATEMENT TYPE REF TO /AWS1/CL_WA2STATEMENT /AWS1/CL_WA2STATEMENT

The WAF processing statement for the rule, for example ByteMatchStatement or SizeConstraintStatement.

IO_VISIBILITYCONFIG TYPE REF TO /AWS1/CL_WA2VISIBILITYCONFIG /AWS1/CL_WA2VISIBILITYCONFIG

Defines and enables Amazon CloudWatch metrics and web request sample collection.

If you change the name of a Rule after you create it and you want the rule's metric name to reflect the change, update the metric name as well. WAF doesn't automatically update the metric name.

Optional arguments:

IO_ACTION TYPE REF TO /AWS1/CL_WA2RULEACTION /AWS1/CL_WA2RULEACTION

The action that WAF should take on a web request when it matches the rule statement. Settings at the web ACL level can override the rule action setting.

This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include RuleGroupReferenceStatement and ManagedRuleGroupStatement.

You must specify either this Action setting or the rule OverrideAction setting, but not both:

  • If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.

  • If the rule statement references a rule group, use the override action setting and not this action setting.

IO_OVERRIDEACTION TYPE REF TO /AWS1/CL_WA2OVERRIDEACTION /AWS1/CL_WA2OVERRIDEACTION

The action to use in the place of the action that results from the rule group evaluation. Set the override action to none to leave the result of the rule group alone. Set it to count to override the result to count only.

You can only use this for rule statements that reference a rule group, like RuleGroupReferenceStatement and ManagedRuleGroupStatement.

This option is usually set to none. It does not affect how the rules in the rule group are evaluated. If you want the rules in the rule group to only count
matches, do not use this and instead use the rule action override option, with Count action, in your rule group reference statement settings.

IT_RULELABELS TYPE /AWS1/CL_WA2LABEL=>TT_LABELS TT_LABELS

Labels to apply to web requests that match the rule match statement. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.

Rules that run after this rule in the web ACL can match against these labels using a LabelMatchStatement.

For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:

  • Separate each component of the label with a colon.

  • Each namespace or name can have up to 128 characters.

  • You can specify up to 5 namespaces in a label.

  • Don't use the following reserved words in your label specification: aws, waf, managed, rulegroup, webacl, regexpatternset, or ipset.

For example, myLabelName or nameSpace1:nameSpace2:myLabelName.

IO_CAPTCHACONFIG TYPE REF TO /AWS1/CL_WA2CAPTCHACONFIG /AWS1/CL_WA2CAPTCHACONFIG

Specifies how WAF should handle CAPTCHA evaluations. If you don't specify this, WAF uses the CAPTCHA configuration that's defined for the web ACL.

IO_CHALLENGECONFIG TYPE REF TO /AWS1/CL_WA2CHALLENGECONFIG /AWS1/CL_WA2CHALLENGECONFIG

Specifies how WAF should handle Challenge evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.


Queryable Attributes

Name

The name of the rule.

If you change the name of a Rule after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's VisibilityConfig settings. WAF doesn't automatically update the metric name when you update the rule name.

Accessible with the following methods

Method Description
GET_NAME() Getter for NAME, with configurable default
ASK_NAME() Getter for NAME w/ exceptions if field has no value
HAS_NAME() Determine if NAME has a value

Priority

If you define more than one Rule in a WebACL, WAF evaluates each request against the Rules in order based on the value of Priority. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.

Accessible with the following methods

Method Description
GET_PRIORITY() Getter for PRIORITY

Statement

The WAF processing statement for the rule, for example ByteMatchStatement or SizeConstraintStatement.

Accessible with the following methods

Method Description
GET_STATEMENT() Getter for STATEMENT

Action

The action that WAF should take on a web request when it matches the rule statement. Settings at the web ACL level can override the rule action setting.

This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include RuleGroupReferenceStatement and ManagedRuleGroupStatement.

You must specify either this Action setting or the rule OverrideAction setting, but not both:

  • If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.

  • If the rule statement references a rule group, use the override action setting and not this action setting.

Accessible with the following methods

Method Description
GET_ACTION() Getter for ACTION

OverrideAction

The action to use in the place of the action that results from the rule group evaluation. Set the override action to none to leave the result of the rule group alone. Set it to count to override the result to count only.

You can only use this for rule statements that reference a rule group, like RuleGroupReferenceStatement and ManagedRuleGroupStatement.

This option is usually set to none. It does not affect how the rules in the rule group are evaluated. If you want the rules in the rule group to only count
matches, do not use this and instead use the rule action override option, with Count action, in your rule group reference statement settings.

Accessible with the following methods

Method Description
GET_OVERRIDEACTION() Getter for OVERRIDEACTION

RuleLabels

Labels to apply to web requests that match the rule match statement. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.

Rules that run after this rule in the web ACL can match against these labels using a LabelMatchStatement.

For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:

  • Separate each component of the label with a colon.

  • Each namespace or name can have up to 128 characters.

  • You can specify up to 5 namespaces in a label.

  • Don't use the following reserved words in your label specification: aws, waf, managed, rulegroup, webacl, regexpatternset, or ipset.

For example, myLabelName or nameSpace1:nameSpace2:myLabelName.

Accessible with the following methods

Method Description
GET_RULELABELS() Getter for RULELABELS, with configurable default
ASK_RULELABELS() Getter for RULELABELS w/ exceptions if field has no value
HAS_RULELABELS() Determine if RULELABELS has a value

VisibilityConfig

Defines and enables Amazon CloudWatch metrics and web request sample collection.

If you change the name of a Rule after you create it and you want the rule's metric name to reflect the change, update the metric name as well. WAF doesn't automatically update the metric name.

Accessible with the following methods

Method Description
GET_VISIBILITYCONFIG() Getter for VISIBILITYCONFIG

CaptchaConfig

Specifies how WAF should handle CAPTCHA evaluations. If you don't specify this, WAF uses the CAPTCHA configuration that's defined for the web ACL.

Accessible with the following methods

Method Description
GET_CAPTCHACONFIG() Getter for CAPTCHACONFIG

ChallengeConfig

Specifies how WAF should handle Challenge evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.

Accessible with the following methods

Method Description
GET_CHALLENGECONFIG() Getter for CHALLENGECONFIG

Public Local Types In This Class

Internal table types, representing arrays and maps of this class, are defined as local types:

TT_RULES

TYPES TT_RULES TYPE STANDARD TABLE OF REF TO /AWS1/CL_WA2RULE WITH DEFAULT KEY
.