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
Rulethat includes the following predicates:- An
IPSetthat causes AWS WAF to search for web requests that originate from the IP address192.0.2.44 - A
ByteMatchSetthat causes AWS WAF to search for web requests for which the value of theUser-Agentheader isBadBot.
To match the settings in this
Rule, a request must originate from192.0.2.44AND include aUser-Agentheader 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 Ruleclone()booleanequals(Object obj)StringgetMetricName()StringgetName()The friendly name or description for theRule.List<Predicate>getPredicates()ThePredicatesobject contains onePredicateelement for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule.StringgetRuleId()A unique identifier for aRule.inthashCode()voidsetMetricName(String metricName)voidsetName(String name)The friendly name or description for theRule.voidsetPredicates(Collection<Predicate> predicates)ThePredicatesobject contains onePredicateelement for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule.voidsetRuleId(String ruleId)A unique identifier for aRule.StringtoString()Returns a string representation of this object; useful for testing and debugging.RulewithMetricName(String metricName)RulewithName(String name)The friendly name or description for theRule.RulewithPredicates(Predicate... predicates)ThePredicatesobject contains onePredicateelement for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule.RulewithPredicates(Collection<Predicate> predicates)ThePredicatesobject contains onePredicateelement for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule.RulewithRuleId(String ruleId)A unique identifier for aRule.
-
-
-
Method Detail
-
setRuleId
public void setRuleId(String ruleId)
A unique identifier for a
Rule. You useRuleIdto get more information about aRule(see GetRule), update aRule(see UpdateRule), insert aRuleinto aWebACLor delete a one from aWebACL(see UpdateWebACL), or delete aRulefrom AWS WAF (see DeleteRule).RuleIdis returned by CreateRule and by ListRules.- Parameters:
ruleId- A unique identifier for aRule. You useRuleIdto get more information about aRule(see GetRule), update aRule(see UpdateRule), insert aRuleinto aWebACLor delete a one from aWebACL(see UpdateWebACL), or delete aRulefrom AWS WAF (see DeleteRule).RuleIdis returned by CreateRule and by ListRules.
-
getRuleId
public String getRuleId()
A unique identifier for a
Rule. You useRuleIdto get more information about aRule(see GetRule), update aRule(see UpdateRule), insert aRuleinto aWebACLor delete a one from aWebACL(see UpdateWebACL), or delete aRulefrom AWS WAF (see DeleteRule).RuleIdis returned by CreateRule and by ListRules.- Returns:
- A unique identifier for a
Rule. You useRuleIdto get more information about aRule(see GetRule), update aRule(see UpdateRule), insert aRuleinto aWebACLor delete a one from aWebACL(see UpdateWebACL), or delete aRulefrom AWS WAF (see DeleteRule).RuleIdis returned by CreateRule and by ListRules.
-
withRuleId
public Rule withRuleId(String ruleId)
A unique identifier for a
Rule. You useRuleIdto get more information about aRule(see GetRule), update aRule(see UpdateRule), insert aRuleinto aWebACLor delete a one from aWebACL(see UpdateWebACL), or delete aRulefrom AWS WAF (see DeleteRule).RuleIdis returned by CreateRule and by ListRules.- Parameters:
ruleId- A unique identifier for aRule. You useRuleIdto get more information about aRule(see GetRule), update aRule(see UpdateRule), insert aRuleinto aWebACLor delete a one from aWebACL(see UpdateWebACL), or delete aRulefrom AWS WAF (see DeleteRule).RuleIdis 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 aRuleafter you create it.- Parameters:
name- The friendly name or description for theRule. You can't change the name of aRuleafter you create it.
-
getName
public String getName()
The friendly name or description for the
Rule. You can't change the name of aRuleafter you create it.- Returns:
- The friendly name or description for the
Rule. You can't change the name of aRuleafter you create it.
-
withName
public Rule withName(String name)
The friendly name or description for the
Rule. You can't change the name of aRuleafter you create it.- Parameters:
name- The friendly name or description for theRule. You can't change the name of aRuleafter 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
Predicatesobject contains onePredicateelement for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule.- Returns:
- The
Predicatesobject contains onePredicateelement for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule.
-
setPredicates
public void setPredicates(Collection<Predicate> predicates)
The
Predicatesobject contains onePredicateelement for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule.- Parameters:
predicates- ThePredicatesobject contains onePredicateelement for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule.
-
withPredicates
public Rule withPredicates(Predicate... predicates)
The
Predicatesobject contains onePredicateelement 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- ThePredicatesobject contains onePredicateelement 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
Predicatesobject contains onePredicateelement for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in aRule.- Parameters:
predicates- ThePredicatesobject contains onePredicateelement 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:
toStringin classObject- Returns:
- A string representation of this object.
- See Also:
Object.toString()
-
-