Class Rule
- java.lang.Object
-
- com.amazonaws.services.waf.model.Rule
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class Rule extends Object implements Serializable, Cloneable
A combination of ByteMatchSet, IPSet, and/or SqlInjectionMatchSet objects that identify the web requests that you want to allow, block, or count. For example, you might create a
Rule
that includes the following predicates:- An
IPSet
that causes AWS WAF to search for web requests that originate from the IP address192.0.2.44
- A
ByteMatchSet
that causes AWS WAF to search for web requests for which the value of theUser-Agent
header isBadBot
.
To match the settings in this
Rule
, a request must originate from192.0.2.44
AND include aUser-Agent
header for which the value isBadBot
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Rule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rule
clone()
boolean
equals(Object obj)
String
getMetricName()
String
getName()
The friendly name or description for theRule
.List<Predicate>
getPredicates()
ThePredicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.String
getRuleId()
A unique identifier for aRule
.int
hashCode()
void
setMetricName(String metricName)
void
setName(String name)
The friendly name or description for theRule
.void
setPredicates(Collection<Predicate> predicates)
ThePredicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.void
setRuleId(String ruleId)
A unique identifier for aRule
.String
toString()
Returns a string representation of this object; useful for testing and debugging.Rule
withMetricName(String metricName)
Rule
withName(String name)
The friendly name or description for theRule
.Rule
withPredicates(Predicate... predicates)
ThePredicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.Rule
withPredicates(Collection<Predicate> predicates)
ThePredicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.Rule
withRuleId(String ruleId)
A unique identifier for aRule
.
-
-
-
Method Detail
-
setRuleId
public void setRuleId(String ruleId)
A unique identifier for a
Rule
. You useRuleId
to get more information about aRule
(see GetRule), update aRule
(see UpdateRule), insert aRule
into aWebACL
or delete a one from aWebACL
(see UpdateWebACL), or delete aRule
from AWS WAF (see DeleteRule).RuleId
is returned by CreateRule and by ListRules.- Parameters:
ruleId
- A unique identifier for aRule
. You useRuleId
to get more information about aRule
(see GetRule), update aRule
(see UpdateRule), insert aRule
into aWebACL
or delete a one from aWebACL
(see UpdateWebACL), or delete aRule
from AWS WAF (see DeleteRule).RuleId
is returned by CreateRule and by ListRules.
-
getRuleId
public String getRuleId()
A unique identifier for a
Rule
. You useRuleId
to get more information about aRule
(see GetRule), update aRule
(see UpdateRule), insert aRule
into aWebACL
or delete a one from aWebACL
(see UpdateWebACL), or delete aRule
from AWS WAF (see DeleteRule).RuleId
is returned by CreateRule and by ListRules.- Returns:
- A unique identifier for a
Rule
. You useRuleId
to get more information about aRule
(see GetRule), update aRule
(see UpdateRule), insert aRule
into aWebACL
or delete a one from aWebACL
(see UpdateWebACL), or delete aRule
from AWS WAF (see DeleteRule).RuleId
is returned by CreateRule and by ListRules.
-
withRuleId
public Rule withRuleId(String ruleId)
A unique identifier for a
Rule
. You useRuleId
to get more information about aRule
(see GetRule), update aRule
(see UpdateRule), insert aRule
into aWebACL
or delete a one from aWebACL
(see UpdateWebACL), or delete aRule
from AWS WAF (see DeleteRule).RuleId
is returned by CreateRule and by ListRules.- Parameters:
ruleId
- A unique identifier for aRule
. You useRuleId
to get more information about aRule
(see GetRule), update aRule
(see UpdateRule), insert aRule
into aWebACL
or delete a one from aWebACL
(see UpdateWebACL), or delete aRule
from AWS WAF (see DeleteRule).RuleId
is returned by CreateRule and by ListRules.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setName
public void setName(String name)
The friendly name or description for the
Rule
. You can't change the name of aRule
after you create it.- Parameters:
name
- The friendly name or description for theRule
. You can't change the name of aRule
after you create it.
-
getName
public String getName()
The friendly name or description for the
Rule
. You can't change the name of aRule
after you create it.- Returns:
- The friendly name or description for the
Rule
. You can't change the name of aRule
after you create it.
-
withName
public Rule withName(String name)
The friendly name or description for the
Rule
. You can't change the name of aRule
after you create it.- Parameters:
name
- The friendly name or description for theRule
. You can't change the name of aRule
after you create it.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setMetricName
public void setMetricName(String metricName)
- Parameters:
metricName
-
-
getMetricName
public String getMetricName()
- Returns:
-
withMetricName
public Rule withMetricName(String metricName)
- Parameters:
metricName
-- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
getPredicates
public List<Predicate> getPredicates()
The
Predicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.- Returns:
- The
Predicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.
-
setPredicates
public void setPredicates(Collection<Predicate> predicates)
The
Predicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.- Parameters:
predicates
- ThePredicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.
-
withPredicates
public Rule withPredicates(Predicate... predicates)
The
Predicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.NOTE: This method appends the values to the existing list (if any). Use
setPredicates(java.util.Collection)
orwithPredicates(java.util.Collection)
if you want to override the existing values.- Parameters:
predicates
- ThePredicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
withPredicates
public Rule withPredicates(Collection<Predicate> predicates)
The
Predicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.- Parameters:
predicates
- ThePredicates
object contains onePredicate
element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule
.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
toString
public String toString()
Returns a string representation of this object; useful for testing and debugging.- Overrides:
toString
in classObject
- Returns:
- A string representation of this object.
- See Also:
Object.toString()
-
-