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 address 192.0.2.44
  • A ByteMatchSet that causes AWS WAF to search for web requests for which the value of the User-Agent header is BadBot.

To match the settings in this Rule, a request must originate from 192.0.2.44 AND include a User-Agent header for which the value is BadBot.

See Also:
  • Constructor Details

    • Rule

      public Rule()
  • Method Details

    • setRuleId

      public void setRuleId(String ruleId)

      A unique identifier for a Rule. You use RuleId to get more information about a Rule (see GetRule), update a Rule (see UpdateRule), insert a Rule into a WebACL or delete a one from a WebACL (see UpdateWebACL), or delete a Rule from AWS WAF (see DeleteRule).

      RuleId is returned by CreateRule and by ListRules.

      Parameters:
      ruleId - A unique identifier for a Rule. You use RuleId to get more information about a Rule (see GetRule), update a Rule (see UpdateRule), insert a Rule into a WebACL or delete a one from a WebACL (see UpdateWebACL), or delete a Rule from AWS WAF (see DeleteRule).

      RuleId is returned by CreateRule and by ListRules.

    • getRuleId

      public String getRuleId()

      A unique identifier for a Rule. You use RuleId to get more information about a Rule (see GetRule), update a Rule (see UpdateRule), insert a Rule into a WebACL or delete a one from a WebACL (see UpdateWebACL), or delete a Rule from AWS WAF (see DeleteRule).

      RuleId is returned by CreateRule and by ListRules.

      Returns:
      A unique identifier for a Rule. You use RuleId to get more information about a Rule (see GetRule), update a Rule (see UpdateRule), insert a Rule into a WebACL or delete a one from a WebACL (see UpdateWebACL), or delete a Rule 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 use RuleId to get more information about a Rule (see GetRule), update a Rule (see UpdateRule), insert a Rule into a WebACL or delete a one from a WebACL (see UpdateWebACL), or delete a Rule from AWS WAF (see DeleteRule).

      RuleId is returned by CreateRule and by ListRules.

      Parameters:
      ruleId - A unique identifier for a Rule. You use RuleId to get more information about a Rule (see GetRule), update a Rule (see UpdateRule), insert a Rule into a WebACL or delete a one from a WebACL (see UpdateWebACL), or delete a Rule 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 a Rule after you create it.

      Parameters:
      name - The friendly name or description for the Rule. You can't change the name of a Rule after you create it.
    • getName

      public String getName()

      The friendly name or description for the Rule. You can't change the name of a Rule after you create it.

      Returns:
      The friendly name or description for the Rule. You can't change the name of a Rule 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 a Rule after you create it.

      Parameters:
      name - The friendly name or description for the Rule. You can't change the name of a Rule 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 one Predicate element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a Rule.

      Returns:
      The Predicates object contains one Predicate element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a Rule.
    • setPredicates

      public void setPredicates(Collection<Predicate> predicates)

      The Predicates object contains one Predicate element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a Rule.

      Parameters:
      predicates - The Predicates object contains one Predicate element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a Rule.
    • withPredicates

      public Rule withPredicates(Predicate... predicates)

      The Predicates object contains one Predicate element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a Rule.

      NOTE: This method appends the values to the existing list (if any). Use setPredicates(java.util.Collection) or withPredicates(java.util.Collection) if you want to override the existing values.

      Parameters:
      predicates - The Predicates object contains one Predicate element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a Rule.
      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 one Predicate element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a Rule.

      Parameters:
      predicates - The Predicates object contains one Predicate element for each ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a Rule.
      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 class Object
      Returns:
      A string representation of this object.
      See Also:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public Rule clone()
      Overrides:
      clone in class Object