Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.amazonaws.services.wafv2.model.Rule Maven / Gradle / Ivy
Go to download
The AWS Java SDK for AWS WAFV2 module holds the client classes that are used for communicating with AWS WAFV2 Service
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.wafv2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* 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.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Rule implements Serializable, Cloneable, StructuredPojo {
/**
*
* 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.
*
*/
private String name;
/**
*
* 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.
*
*/
private Integer priority;
/**
*
* The WAF processing statement for the rule, for example ByteMatchStatement or
* SizeConstraintStatement .
*
*/
private Statement statement;
/**
*
* 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.
*
*
*
*/
private RuleAction action;
/**
*
* 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.
*
*
*/
private OverrideAction overrideAction;
/**
*
* 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
.
*
*/
private java.util.List ruleLabels;
/**
*
* 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.
*
*/
private VisibilityConfig visibilityConfig;
/**
*
* 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.
*
*/
private CaptchaConfig captchaConfig;
/**
*
* 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.
*
*/
private ChallengeConfig challengeConfig;
/**
*
* 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.
*
*
* @param 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.
*/
public void setName(String name) {
this.name = 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.
*
*
* @return 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.
*/
public String getName() {
return this.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.
*
*
* @param 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withName(String name) {
setName(name);
return this;
}
/**
*
* 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.
*
*
* @param 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.
*/
public void setPriority(Integer priority) {
this.priority = 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.
*
*
* @return 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.
*/
public Integer getPriority() {
return this.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.
*
*
* @param 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withPriority(Integer priority) {
setPriority(priority);
return this;
}
/**
*
* The WAF processing statement for the rule, for example ByteMatchStatement or
* SizeConstraintStatement .
*
*
* @param statement
* The WAF processing statement for the rule, for example ByteMatchStatement or
* SizeConstraintStatement .
*/
public void setStatement(Statement statement) {
this.statement = statement;
}
/**
*
* The WAF processing statement for the rule, for example ByteMatchStatement or
* SizeConstraintStatement .
*
*
* @return The WAF processing statement for the rule, for example ByteMatchStatement or
* SizeConstraintStatement .
*/
public Statement getStatement() {
return this.statement;
}
/**
*
* The WAF processing statement for the rule, for example ByteMatchStatement or
* SizeConstraintStatement .
*
*
* @param statement
* The WAF processing statement for the rule, for example ByteMatchStatement or
* SizeConstraintStatement .
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withStatement(Statement statement) {
setStatement(statement);
return this;
}
/**
*
* 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.
*
*
*
*
* @param 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.
*
*
*/
public void setAction(RuleAction action) {
this.action = 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.
*
*
*
*
* @return 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.
*
*
*/
public RuleAction getAction() {
return this.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.
*
*
*
*
* @param 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.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withAction(RuleAction action) {
setAction(action);
return this;
}
/**
*
* 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.
*
*
*
* @param 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.
*
*/
public void setOverrideAction(OverrideAction overrideAction) {
this.overrideAction = 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.
*
*
*
* @return 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.
*
*/
public OverrideAction getOverrideAction() {
return this.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.
*
*
*
* @param 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.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withOverrideAction(OverrideAction overrideAction) {
setOverrideAction(overrideAction);
return this;
}
/**
*
* 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
.
*
*
* @return 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
.
*/
public java.util.List getRuleLabels() {
return 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
.
*
*
* @param 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
.
*/
public void setRuleLabels(java.util.Collection ruleLabels) {
if (ruleLabels == null) {
this.ruleLabels = null;
return;
}
this.ruleLabels = new java.util.ArrayList(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
.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setRuleLabels(java.util.Collection)} or {@link #withRuleLabels(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param 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
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withRuleLabels(Label... ruleLabels) {
if (this.ruleLabels == null) {
setRuleLabels(new java.util.ArrayList(ruleLabels.length));
}
for (Label ele : ruleLabels) {
this.ruleLabels.add(ele);
}
return this;
}
/**
*
* 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
.
*
*
* @param 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
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withRuleLabels(java.util.Collection ruleLabels) {
setRuleLabels(ruleLabels);
return this;
}
/**
*
* 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.
*
*
* @param 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.
*/
public void setVisibilityConfig(VisibilityConfig visibilityConfig) {
this.visibilityConfig = 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.
*
*
* @return 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.
*/
public VisibilityConfig getVisibilityConfig() {
return this.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.
*
*
* @param 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withVisibilityConfig(VisibilityConfig visibilityConfig) {
setVisibilityConfig(visibilityConfig);
return this;
}
/**
*
* 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.
*
*
* @param 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.
*/
public void setCaptchaConfig(CaptchaConfig captchaConfig) {
this.captchaConfig = 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.
*
*
* @return 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.
*/
public CaptchaConfig getCaptchaConfig() {
return this.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.
*
*
* @param 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withCaptchaConfig(CaptchaConfig captchaConfig) {
setCaptchaConfig(captchaConfig);
return this;
}
/**
*
* 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.
*
*
* @param 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.
*/
public void setChallengeConfig(ChallengeConfig challengeConfig) {
this.challengeConfig = 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.
*
*
* @return 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.
*/
public ChallengeConfig getChallengeConfig() {
return this.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.
*
*
* @param 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Rule withChallengeConfig(ChallengeConfig challengeConfig) {
setChallengeConfig(challengeConfig);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getPriority() != null)
sb.append("Priority: ").append(getPriority()).append(",");
if (getStatement() != null)
sb.append("Statement: ").append(getStatement()).append(",");
if (getAction() != null)
sb.append("Action: ").append(getAction()).append(",");
if (getOverrideAction() != null)
sb.append("OverrideAction: ").append(getOverrideAction()).append(",");
if (getRuleLabels() != null)
sb.append("RuleLabels: ").append(getRuleLabels()).append(",");
if (getVisibilityConfig() != null)
sb.append("VisibilityConfig: ").append(getVisibilityConfig()).append(",");
if (getCaptchaConfig() != null)
sb.append("CaptchaConfig: ").append(getCaptchaConfig()).append(",");
if (getChallengeConfig() != null)
sb.append("ChallengeConfig: ").append(getChallengeConfig());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Rule == false)
return false;
Rule other = (Rule) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getPriority() == null ^ this.getPriority() == null)
return false;
if (other.getPriority() != null && other.getPriority().equals(this.getPriority()) == false)
return false;
if (other.getStatement() == null ^ this.getStatement() == null)
return false;
if (other.getStatement() != null && other.getStatement().equals(this.getStatement()) == false)
return false;
if (other.getAction() == null ^ this.getAction() == null)
return false;
if (other.getAction() != null && other.getAction().equals(this.getAction()) == false)
return false;
if (other.getOverrideAction() == null ^ this.getOverrideAction() == null)
return false;
if (other.getOverrideAction() != null && other.getOverrideAction().equals(this.getOverrideAction()) == false)
return false;
if (other.getRuleLabels() == null ^ this.getRuleLabels() == null)
return false;
if (other.getRuleLabels() != null && other.getRuleLabels().equals(this.getRuleLabels()) == false)
return false;
if (other.getVisibilityConfig() == null ^ this.getVisibilityConfig() == null)
return false;
if (other.getVisibilityConfig() != null && other.getVisibilityConfig().equals(this.getVisibilityConfig()) == false)
return false;
if (other.getCaptchaConfig() == null ^ this.getCaptchaConfig() == null)
return false;
if (other.getCaptchaConfig() != null && other.getCaptchaConfig().equals(this.getCaptchaConfig()) == false)
return false;
if (other.getChallengeConfig() == null ^ this.getChallengeConfig() == null)
return false;
if (other.getChallengeConfig() != null && other.getChallengeConfig().equals(this.getChallengeConfig()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getPriority() == null) ? 0 : getPriority().hashCode());
hashCode = prime * hashCode + ((getStatement() == null) ? 0 : getStatement().hashCode());
hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode());
hashCode = prime * hashCode + ((getOverrideAction() == null) ? 0 : getOverrideAction().hashCode());
hashCode = prime * hashCode + ((getRuleLabels() == null) ? 0 : getRuleLabels().hashCode());
hashCode = prime * hashCode + ((getVisibilityConfig() == null) ? 0 : getVisibilityConfig().hashCode());
hashCode = prime * hashCode + ((getCaptchaConfig() == null) ? 0 : getCaptchaConfig().hashCode());
hashCode = prime * hashCode + ((getChallengeConfig() == null) ? 0 : getChallengeConfig().hashCode());
return hashCode;
}
@Override
public Rule clone() {
try {
return (Rule) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.wafv2.model.transform.RuleMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}