@Generated(value="com.amazonaws:aws-java-sdk-code-generator") public class Rule extends Object implements Serializable, Cloneable, StructuredPojo
A single rule, which you can use in a WebACL or RuleGroup to identify web requests that you want to allow, block, or count. Each rule includes one top-level Statement that AWS WAF uses to identify matching web requests, and parameters that govern how AWS WAF handles them.
Constructor and Description |
---|
Rule() |
Modifier and Type | Method and Description |
---|---|
Rule |
clone() |
boolean |
equals(Object obj) |
RuleAction |
getAction()
The action that AWS WAF should take on a web request when it matches the rule statement.
|
String |
getName()
The name of the rule.
|
OverrideAction |
getOverrideAction()
The override action to apply to the rules in a rule group.
|
Integer |
getPriority()
If you define more than one
Rule in a WebACL , AWS WAF evaluates each request against
the Rules in order based on the value of Priority . |
List<Label> |
getRuleLabels()
Labels to apply to web requests that match the rule match statement.
|
Statement |
getStatement()
The AWS WAF processing statement for the rule, for example ByteMatchStatement or
SizeConstraintStatement.
|
VisibilityConfig |
getVisibilityConfig()
Defines and enables Amazon CloudWatch metrics and web request sample collection.
|
int |
hashCode() |
void |
marshall(ProtocolMarshaller protocolMarshaller)
Marshalls this structured data using the given
ProtocolMarshaller . |
void |
setAction(RuleAction action)
The action that AWS WAF should take on a web request when it matches the rule statement.
|
void |
setName(String name)
The name of the rule.
|
void |
setOverrideAction(OverrideAction overrideAction)
The override action to apply to the rules in a rule group.
|
void |
setPriority(Integer priority)
If you define more than one
Rule in a WebACL , AWS WAF evaluates each request against
the Rules in order based on the value of Priority . |
void |
setRuleLabels(Collection<Label> ruleLabels)
Labels to apply to web requests that match the rule match statement.
|
void |
setStatement(Statement statement)
The AWS WAF processing statement for the rule, for example ByteMatchStatement or
SizeConstraintStatement.
|
void |
setVisibilityConfig(VisibilityConfig visibilityConfig)
Defines and enables Amazon CloudWatch metrics and web request sample collection.
|
String |
toString()
Returns a string representation of this object.
|
Rule |
withAction(RuleAction action)
The action that AWS WAF should take on a web request when it matches the rule statement.
|
Rule |
withName(String name)
The name of the rule.
|
Rule |
withOverrideAction(OverrideAction overrideAction)
The override action to apply to the rules in a rule group.
|
Rule |
withPriority(Integer priority)
If you define more than one
Rule in a WebACL , AWS WAF evaluates each request against
the Rules in order based on the value of Priority . |
Rule |
withRuleLabels(Collection<Label> ruleLabels)
Labels to apply to web requests that match the rule match statement.
|
Rule |
withRuleLabels(Label... ruleLabels)
Labels to apply to web requests that match the rule match statement.
|
Rule |
withStatement(Statement statement)
The AWS WAF processing statement for the rule, for example ByteMatchStatement or
SizeConstraintStatement.
|
Rule |
withVisibilityConfig(VisibilityConfig visibilityConfig)
Defines and enables Amazon CloudWatch metrics and web request sample collection.
|
public void setName(String name)
The name of the rule. You can't change the name of a Rule
after you create it.
name
- The name of the rule. You can't change the name of a Rule
after you create it.public String getName()
The name of the rule. You can't change the name of a Rule
after you create it.
Rule
after you create it.public Rule withName(String name)
The name of the rule. You can't change the name of a Rule
after you create it.
name
- The name of the rule. You can't change the name of a Rule
after you create it.public void setPriority(Integer priority)
If you define more than one Rule
in a WebACL
, AWS WAF evaluates each request against
the Rules
in order based on the value of Priority
. AWS WAF processes rules with lower
priority first. The priorities don't need to be consecutive, but they must all be different.
priority
- If you define more than one Rule
in a WebACL
, AWS WAF evaluates each request
against the Rules
in order based on the value of Priority
. AWS WAF processes
rules with lower priority first. The priorities don't need to be consecutive, but they must all be
different.public Integer getPriority()
If you define more than one Rule
in a WebACL
, AWS WAF evaluates each request against
the Rules
in order based on the value of Priority
. AWS WAF processes rules with lower
priority first. The priorities don't need to be consecutive, but they must all be different.
Rule
in a WebACL
, AWS WAF evaluates each request
against the Rules
in order based on the value of Priority
. AWS WAF processes
rules with lower priority first. The priorities don't need to be consecutive, but they must all be
different.public Rule withPriority(Integer priority)
If you define more than one Rule
in a WebACL
, AWS WAF evaluates each request against
the Rules
in order based on the value of Priority
. AWS WAF processes rules with lower
priority first. The priorities don't need to be consecutive, but they must all be different.
priority
- If you define more than one Rule
in a WebACL
, AWS WAF evaluates each request
against the Rules
in order based on the value of Priority
. AWS WAF processes
rules with lower priority first. The priorities don't need to be consecutive, but they must all be
different.public void setStatement(Statement statement)
The AWS WAF processing statement for the rule, for example ByteMatchStatement or SizeConstraintStatement.
statement
- The AWS WAF processing statement for the rule, for example ByteMatchStatement or
SizeConstraintStatement.public Statement getStatement()
The AWS WAF processing statement for the rule, for example ByteMatchStatement or SizeConstraintStatement.
public Rule withStatement(Statement statement)
The AWS WAF processing statement for the rule, for example ByteMatchStatement or SizeConstraintStatement.
statement
- The AWS WAF processing statement for the rule, for example ByteMatchStatement or
SizeConstraintStatement.public void setAction(RuleAction action)
The action that AWS 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.
action
- The action that AWS 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.
public RuleAction getAction()
The action that AWS 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.
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.
public Rule withAction(RuleAction action)
The action that AWS 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.
action
- The action that AWS 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.
public void setOverrideAction(OverrideAction overrideAction)
The override action to apply to the rules in a rule group. Used only for rule statements that reference a rule
group, like RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
Set the override action to none to leave the rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
In a Rule, you must specify either this OverrideAction
setting or the rule
Action
setting, but not both:
If the rule statement references a rule group, use this override action setting and not the action setting.
If the rule statement does not reference a rule group, use the rule action setting and not this rule override action setting.
overrideAction
- The override action to apply to the rules in a rule group. Used only for rule statements that reference a
rule group, like RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
Set the override action to none to leave the rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
In a Rule, you must specify either this OverrideAction
setting or the rule
Action
setting, but not both:
If the rule statement references a rule group, use this override action setting and not the action setting.
If the rule statement does not reference a rule group, use the rule action setting and not this rule override action setting.
public OverrideAction getOverrideAction()
The override action to apply to the rules in a rule group. Used only for rule statements that reference a rule
group, like RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
Set the override action to none to leave the rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
In a Rule, you must specify either this OverrideAction
setting or the rule
Action
setting, but not both:
If the rule statement references a rule group, use this override action setting and not the action setting.
If the rule statement does not reference a rule group, use the rule action setting and not this rule override action setting.
RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
Set the override action to none to leave the rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
In a Rule, you must specify either this OverrideAction
setting or the rule
Action
setting, but not both:
If the rule statement references a rule group, use this override action setting and not the action setting.
If the rule statement does not reference a rule group, use the rule action setting and not this rule override action setting.
public Rule withOverrideAction(OverrideAction overrideAction)
The override action to apply to the rules in a rule group. Used only for rule statements that reference a rule
group, like RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
Set the override action to none to leave the rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
In a Rule, you must specify either this OverrideAction
setting or the rule
Action
setting, but not both:
If the rule statement references a rule group, use this override action setting and not the action setting.
If the rule statement does not reference a rule group, use the rule action setting and not this rule override action setting.
overrideAction
- The override action to apply to the rules in a rule group. Used only for rule statements that reference a
rule group, like RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
Set the override action to none to leave the rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
In a Rule, you must specify either this OverrideAction
setting or the rule
Action
setting, but not both:
If the rule statement references a rule group, use this override action setting and not the action setting.
If the rule statement does not reference a rule group, use the rule action setting and not this rule override action setting.
public List<Label> getRuleLabels()
Labels to apply to web requests that match the rule match statement. AWS 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
.
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
.
public void setRuleLabels(Collection<Label> ruleLabels)
Labels to apply to web requests that match the rule match statement. AWS 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
.
ruleLabels
- Labels to apply to web requests that match the rule match statement. AWS 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
.
public Rule withRuleLabels(Label... ruleLabels)
Labels to apply to web requests that match the rule match statement. AWS 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
.
NOTE: This method appends the values to the existing list (if any). Use
setRuleLabels(java.util.Collection)
or withRuleLabels(java.util.Collection)
if you want to
override the existing values.
ruleLabels
- Labels to apply to web requests that match the rule match statement. AWS 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
.
public Rule withRuleLabels(Collection<Label> ruleLabels)
Labels to apply to web requests that match the rule match statement. AWS 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
.
ruleLabels
- Labels to apply to web requests that match the rule match statement. AWS 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
.
public void setVisibilityConfig(VisibilityConfig visibilityConfig)
Defines and enables Amazon CloudWatch metrics and web request sample collection.
visibilityConfig
- Defines and enables Amazon CloudWatch metrics and web request sample collection.public VisibilityConfig getVisibilityConfig()
Defines and enables Amazon CloudWatch metrics and web request sample collection.
public Rule withVisibilityConfig(VisibilityConfig visibilityConfig)
Defines and enables Amazon CloudWatch metrics and web request sample collection.
visibilityConfig
- Defines and enables Amazon CloudWatch metrics and web request sample collection.public String toString()
toString
in class Object
Object.toString()
public void marshall(ProtocolMarshaller protocolMarshaller)
StructuredPojo
ProtocolMarshaller
.marshall
in interface StructuredPojo
protocolMarshaller
- Implementation of ProtocolMarshaller
used to marshall this object's data.