java.lang.Object
software.amazon.awssdk.services.wafv2.model.RuleGroup
All Implemented Interfaces:
Serializable, SdkPojo, ToCopyableBuilder<RuleGroup.Builder,RuleGroup>

@Generated("software.amazon.awssdk:codegen") public final class RuleGroup extends Object implements SdkPojo, Serializable, ToCopyableBuilder<RuleGroup.Builder,RuleGroup>

A rule group defines a collection of rules to inspect and control web requests that you can use in a WebACL. When you create a rule group, you define an immutable capacity limit. If you update a rule group, you must stay within the capacity. This allows others to reuse the rule group with confidence in its capacity requirements.

See Also:
  • Method Details

    • name

      public final String name()

      The name of the rule group. You cannot change the name of a rule group after you create it.

      Returns:
      The name of the rule group. You cannot change the name of a rule group after you create it.
    • id

      public final String id()

      A unique identifier for the rule group. This ID is returned in the responses to create and list commands. You provide it to operations like update and delete.

      Returns:
      A unique identifier for the rule group. This ID is returned in the responses to create and list commands. You provide it to operations like update and delete.
    • capacity

      public final Long capacity()

      The web ACL capacity units (WCUs) required for this rule group.

      When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, WAF enforces this limit. You can check the capacity for a set of rules using CheckCapacity.

      WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. For more information, see WAF web ACL capacity units (WCU) in the WAF Developer Guide.

      Returns:
      The web ACL capacity units (WCUs) required for this rule group.

      When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, WAF enforces this limit. You can check the capacity for a set of rules using CheckCapacity.

      WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. For more information, see WAF web ACL capacity units (WCU) in the WAF Developer Guide.

    • arn

      public final String arn()

      The Amazon Resource Name (ARN) of the entity.

      Returns:
      The Amazon Resource Name (ARN) of the entity.
    • description

      public final String description()

      A description of the rule group that helps with identification.

      Returns:
      A description of the rule group that helps with identification.
    • hasRules

      public final boolean hasRules()
      For responses, this returns true if the service returned a value for the Rules property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
    • rules

      public final List<Rule> rules()

      The Rule statements used to identify the web requests that you want to manage. Each rule includes one top-level statement that WAF uses to identify matching web requests, and parameters that govern how WAF handles them.

      Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

      This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasRules() method.

      Returns:
      The Rule statements used to identify the web requests that you want to manage. Each rule includes one top-level statement that WAF uses to identify matching web requests, and parameters that govern how WAF handles them.
    • visibilityConfig

      public final VisibilityConfig visibilityConfig()

      Defines and enables Amazon CloudWatch metrics and web request sample collection.

      Returns:
      Defines and enables Amazon CloudWatch metrics and web request sample collection.
    • labelNamespace

      public final String labelNamespace()

      The label namespace prefix for this rule group. All labels added by rules in this rule group have this prefix.

      • The syntax for the label namespace prefix for your rule groups is the following:

        awswaf:<account ID>:rulegroup:<rule group name>:

      • When a rule with a label matches a web request, WAF adds the fully qualified label to the request. A fully qualified label is made up of the label namespace from the rule group or web ACL where the rule is defined and the label from the rule, separated by a colon:

        <label namespace>:<label from rule>

      Returns:
      The label namespace prefix for this rule group. All labels added by rules in this rule group have this prefix.

      • The syntax for the label namespace prefix for your rule groups is the following:

        awswaf:<account ID>:rulegroup:<rule group name>:

      • When a rule with a label matches a web request, WAF adds the fully qualified label to the request. A fully qualified label is made up of the label namespace from the rule group or web ACL where the rule is defined and the label from the rule, separated by a colon:

        <label namespace>:<label from rule>

    • hasCustomResponseBodies

      public final boolean hasCustomResponseBodies()
      For responses, this returns true if the service returned a value for the CustomResponseBodies property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
    • customResponseBodies

      public final Map<String,CustomResponseBody> customResponseBodies()

      A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group.

      For information about customizing web requests and responses, see Customizing web requests and responses in WAF in the WAF Developer Guide.

      For information about the limits on count and size for custom request and response settings, see WAF quotas in the WAF Developer Guide.

      Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

      This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasCustomResponseBodies() method.

      Returns:
      A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group.

      For information about customizing web requests and responses, see Customizing web requests and responses in WAF in the WAF Developer Guide.

      For information about the limits on count and size for custom request and response settings, see WAF quotas in the WAF Developer Guide.

    • hasAvailableLabels

      public final boolean hasAvailableLabels()
      For responses, this returns true if the service returned a value for the AvailableLabels property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
    • availableLabels

      public final List<LabelSummary> availableLabels()

      The labels that one or more rules in this rule group add to matching web requests. These labels are defined in the RuleLabels for a Rule.

      Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

      This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasAvailableLabels() method.

      Returns:
      The labels that one or more rules in this rule group add to matching web requests. These labels are defined in the RuleLabels for a Rule.
    • hasConsumedLabels

      public final boolean hasConsumedLabels()
      For responses, this returns true if the service returned a value for the ConsumedLabels property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
    • consumedLabels

      public final List<LabelSummary> consumedLabels()

      The labels that one or more rules in this rule group match against in label match statements. These labels are defined in a LabelMatchStatement specification, in the Statement definition of a rule.

      Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

      This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasConsumedLabels() method.

      Returns:
      The labels that one or more rules in this rule group match against in label match statements. These labels are defined in a LabelMatchStatement specification, in the Statement definition of a rule.
    • toBuilder

      public RuleGroup.Builder toBuilder()
      Description copied from interface: ToCopyableBuilder
      Take this object and create a builder that contains all of the current property values of this object.
      Specified by:
      toBuilder in interface ToCopyableBuilder<RuleGroup.Builder,RuleGroup>
      Returns:
      a builder for type T
    • builder

      public static RuleGroup.Builder builder()
    • serializableBuilderClass

      public static Class<? extends RuleGroup.Builder> serializableBuilderClass()
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

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

      public final boolean equalsBySdkFields(Object obj)
      Description copied from interface: SdkPojo
      Indicates whether some other object is "equal to" this one by SDK fields. An SDK field is a modeled, non-inherited field in an SdkPojo class, and is generated based on a service model.

      If an SdkPojo class does not have any inherited fields, equalsBySdkFields and equals are essentially the same.

      Specified by:
      equalsBySdkFields in interface SdkPojo
      Parameters:
      obj - the object to be compared with
      Returns:
      true if the other object equals to this object by sdk fields, false otherwise.
    • toString

      public final String toString()
      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.
      Overrides:
      toString in class Object
    • getValueForField

      public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
    • sdkFields

      public final List<SdkField<?>> sdkFields()
      Specified by:
      sdkFields in interface SdkPojo
      Returns:
      List of SdkField in this POJO. May be empty list but should never be null.