Interface RateBasedStatement.Builder

  • Method Details

    • limit

      The limit on requests during the specified evaluation window for a single aggregation instance for the rate-based rule. If the rate-based statement includes a ScopeDownStatement, this limit is applied only to the requests that match the statement.

      Examples:

      • If you aggregate on just the IP address, this is the limit on requests from any single IP address.

      • If you aggregate on the HTTP method and the query argument name "city", then this is the limit on requests for any single method, city pair.

      Parameters:
      limit - The limit on requests during the specified evaluation window for a single aggregation instance for the rate-based rule. If the rate-based statement includes a ScopeDownStatement, this limit is applied only to the requests that match the statement.

      Examples:

      • If you aggregate on just the IP address, this is the limit on requests from any single IP address.

      • If you aggregate on the HTTP method and the query argument name "city", then this is the limit on requests for any single method, city pair.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • evaluationWindowSec

      RateBasedStatement.Builder evaluationWindowSec(Long evaluationWindowSec)

      The amount of time, in seconds, that WAF should include in its request counts, looking back from the current time. For example, for a setting of 120, when WAF checks the rate, it counts the requests for the 2 minutes immediately preceding the current time. Valid settings are 60, 120, 300, and 600.

      This setting doesn't determine how often WAF checks the rate, but how far back it looks each time it checks. WAF checks the rate about every 10 seconds.

      Default: 300 (5 minutes)

      Parameters:
      evaluationWindowSec - The amount of time, in seconds, that WAF should include in its request counts, looking back from the current time. For example, for a setting of 120, when WAF checks the rate, it counts the requests for the 2 minutes immediately preceding the current time. Valid settings are 60, 120, 300, and 600.

      This setting doesn't determine how often WAF checks the rate, but how far back it looks each time it checks. WAF checks the rate about every 10 seconds.

      Default: 300 (5 minutes)

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • aggregateKeyType

      RateBasedStatement.Builder aggregateKeyType(String aggregateKeyType)

      Setting that indicates how to aggregate the request counts.

      Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling.

      • CONSTANT - Count and limit the requests that match the rate-based rule's scope-down statement. With this option, the counted requests aren't further aggregated. The scope-down statement is the only specification used. When the count of all requests that satisfy the scope-down statement goes over the limit, WAF applies the rule action to all requests that satisfy the scope-down statement.

        With this option, you must configure the ScopeDownStatement property.

      • CUSTOM_KEYS - Aggregate the request counts using one or more web request components as the aggregate keys.

        With this option, you must specify the aggregate keys in the CustomKeys property.

        To aggregate on only the IP address or only the forwarded IP address, don't use custom keys. Instead, set the aggregate key type to IP or FORWARDED_IP.

      • FORWARDED_IP - Aggregate the request counts on the first IP address in an HTTP header.

        With this option, you must specify the header to use in the ForwardedIPConfig property.

        To aggregate on a combination of the forwarded IP address with other aggregate keys, use CUSTOM_KEYS.

      • IP - Aggregate the request counts on the IP address from the web request origin.

        To aggregate on a combination of the IP address with other aggregate keys, use CUSTOM_KEYS.

      Parameters:
      aggregateKeyType - Setting that indicates how to aggregate the request counts.

      Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling.

      • CONSTANT - Count and limit the requests that match the rate-based rule's scope-down statement. With this option, the counted requests aren't further aggregated. The scope-down statement is the only specification used. When the count of all requests that satisfy the scope-down statement goes over the limit, WAF applies the rule action to all requests that satisfy the scope-down statement.

        With this option, you must configure the ScopeDownStatement property.

      • CUSTOM_KEYS - Aggregate the request counts using one or more web request components as the aggregate keys.

        With this option, you must specify the aggregate keys in the CustomKeys property.

        To aggregate on only the IP address or only the forwarded IP address, don't use custom keys. Instead, set the aggregate key type to IP or FORWARDED_IP.

      • FORWARDED_IP - Aggregate the request counts on the first IP address in an HTTP header.

        With this option, you must specify the header to use in the ForwardedIPConfig property.

        To aggregate on a combination of the forwarded IP address with other aggregate keys, use CUSTOM_KEYS.

      • IP - Aggregate the request counts on the IP address from the web request origin.

        To aggregate on a combination of the IP address with other aggregate keys, use CUSTOM_KEYS.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • aggregateKeyType

      Setting that indicates how to aggregate the request counts.

      Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling.

      • CONSTANT - Count and limit the requests that match the rate-based rule's scope-down statement. With this option, the counted requests aren't further aggregated. The scope-down statement is the only specification used. When the count of all requests that satisfy the scope-down statement goes over the limit, WAF applies the rule action to all requests that satisfy the scope-down statement.

        With this option, you must configure the ScopeDownStatement property.

      • CUSTOM_KEYS - Aggregate the request counts using one or more web request components as the aggregate keys.

        With this option, you must specify the aggregate keys in the CustomKeys property.

        To aggregate on only the IP address or only the forwarded IP address, don't use custom keys. Instead, set the aggregate key type to IP or FORWARDED_IP.

      • FORWARDED_IP - Aggregate the request counts on the first IP address in an HTTP header.

        With this option, you must specify the header to use in the ForwardedIPConfig property.

        To aggregate on a combination of the forwarded IP address with other aggregate keys, use CUSTOM_KEYS.

      • IP - Aggregate the request counts on the IP address from the web request origin.

        To aggregate on a combination of the IP address with other aggregate keys, use CUSTOM_KEYS.

      Parameters:
      aggregateKeyType - Setting that indicates how to aggregate the request counts.

      Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling.

      • CONSTANT - Count and limit the requests that match the rate-based rule's scope-down statement. With this option, the counted requests aren't further aggregated. The scope-down statement is the only specification used. When the count of all requests that satisfy the scope-down statement goes over the limit, WAF applies the rule action to all requests that satisfy the scope-down statement.

        With this option, you must configure the ScopeDownStatement property.

      • CUSTOM_KEYS - Aggregate the request counts using one or more web request components as the aggregate keys.

        With this option, you must specify the aggregate keys in the CustomKeys property.

        To aggregate on only the IP address or only the forwarded IP address, don't use custom keys. Instead, set the aggregate key type to IP or FORWARDED_IP.

      • FORWARDED_IP - Aggregate the request counts on the first IP address in an HTTP header.

        With this option, you must specify the header to use in the ForwardedIPConfig property.

        To aggregate on a combination of the forwarded IP address with other aggregate keys, use CUSTOM_KEYS.

      • IP - Aggregate the request counts on the IP address from the web request origin.

        To aggregate on a combination of the IP address with other aggregate keys, use CUSTOM_KEYS.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • scopeDownStatement

      RateBasedStatement.Builder scopeDownStatement(Statement scopeDownStatement)

      An optional nested statement that narrows the scope of the web requests that are evaluated and managed by the rate-based statement. When you use a scope-down statement, the rate-based rule only tracks and rate limits requests that match the scope-down statement. You can use any nestable Statement in the scope-down statement, and you can nest statements at any level, the same as you can for a rule statement.

      Parameters:
      scopeDownStatement - An optional nested statement that narrows the scope of the web requests that are evaluated and managed by the rate-based statement. When you use a scope-down statement, the rate-based rule only tracks and rate limits requests that match the scope-down statement. You can use any nestable Statement in the scope-down statement, and you can nest statements at any level, the same as you can for a rule statement.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • scopeDownStatement

      default RateBasedStatement.Builder scopeDownStatement(Consumer<Statement.Builder> scopeDownStatement)

      An optional nested statement that narrows the scope of the web requests that are evaluated and managed by the rate-based statement. When you use a scope-down statement, the rate-based rule only tracks and rate limits requests that match the scope-down statement. You can use any nestable Statement in the scope-down statement, and you can nest statements at any level, the same as you can for a rule statement.

      This is a convenience method that creates an instance of the Statement.Builder avoiding the need to create one manually via Statement.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to scopeDownStatement(Statement).

      Parameters:
      scopeDownStatement - a consumer that will call methods on Statement.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • forwardedIPConfig

      RateBasedStatement.Builder forwardedIPConfig(ForwardedIPConfig forwardedIPConfig)

      The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.

      If the specified header isn't present in the request, WAF doesn't apply the rule to the web request at all.

      This is required if you specify a forwarded IP in the rule's aggregate key settings.

      Parameters:
      forwardedIPConfig - The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.

      If the specified header isn't present in the request, WAF doesn't apply the rule to the web request at all.

      This is required if you specify a forwarded IP in the rule's aggregate key settings.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • forwardedIPConfig

      default RateBasedStatement.Builder forwardedIPConfig(Consumer<ForwardedIPConfig.Builder> forwardedIPConfig)

      The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.

      If the specified header isn't present in the request, WAF doesn't apply the rule to the web request at all.

      This is required if you specify a forwarded IP in the rule's aggregate key settings.

      This is a convenience method that creates an instance of the ForwardedIPConfig.Builder avoiding the need to create one manually via ForwardedIPConfig.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to forwardedIPConfig(ForwardedIPConfig).

      Parameters:
      forwardedIPConfig - a consumer that will call methods on ForwardedIPConfig.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • customKeys

      Specifies the aggregate keys to use in a rate-base rule.

      Parameters:
      customKeys - Specifies the aggregate keys to use in a rate-base rule.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • customKeys

      Specifies the aggregate keys to use in a rate-base rule.

      Parameters:
      customKeys - Specifies the aggregate keys to use in a rate-base rule.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • customKeys

      Specifies the aggregate keys to use in a rate-base rule.

      This is a convenience method that creates an instance of the RateBasedStatementCustomKey.Builder avoiding the need to create one manually via RateBasedStatementCustomKey.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to customKeys(List<RateBasedStatementCustomKey>).

      Parameters:
      customKeys - a consumer that will call methods on RateBasedStatementCustomKey.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also: