#[non_exhaustive]
pub struct RateBasedStatementBuilder { /* private fields */ }
Expand description

A builder for RateBasedStatement.

Implementations§

source§

impl RateBasedStatementBuilder

source

pub fn limit(self, input: i64) -> Self

The limit on requests per 5-minute period 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.

This field is required.
source

pub fn set_limit(self, input: Option<i64>) -> Self

The limit on requests per 5-minute period 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.

source

pub fn get_limit(&self) -> &Option<i64>

The limit on requests per 5-minute period 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.

source

pub fn evaluation_window_sec(self, input: i64) -> Self

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)

source

pub fn set_evaluation_window_sec(self, input: Option<i64>) -> Self

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)

source

pub fn get_evaluation_window_sec(&self) -> &Option<i64>

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)

source

pub fn aggregate_key_type( self, input: RateBasedStatementAggregateKeyType ) -> Self

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.

This field is required.
source

pub fn set_aggregate_key_type( self, input: Option<RateBasedStatementAggregateKeyType> ) -> Self

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.

source

pub fn get_aggregate_key_type( &self ) -> &Option<RateBasedStatementAggregateKeyType>

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.

source

pub fn scope_down_statement(self, input: impl Into<Box<Statement>>) -> Self

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.

source

pub fn set_scope_down_statement(self, input: Option<Box<Statement>>) -> Self

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.

source

pub fn get_scope_down_statement(&self) -> &Option<Box<Statement>>

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.

source

pub fn forwarded_ip_config(self, input: ForwardedIpConfig) -> Self

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.

source

pub fn set_forwarded_ip_config(self, input: Option<ForwardedIpConfig>) -> Self

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.

source

pub fn get_forwarded_ip_config(&self) -> &Option<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.

source

pub fn custom_keys(self, input: RateBasedStatementCustomKey) -> Self

Appends an item to custom_keys.

To override the contents of this collection use set_custom_keys.

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

source

pub fn set_custom_keys( self, input: Option<Vec<RateBasedStatementCustomKey>> ) -> Self

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

source

pub fn get_custom_keys(&self) -> &Option<Vec<RateBasedStatementCustomKey>>

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

source

pub fn build(self) -> Result<RateBasedStatement, BuildError>

Consumes the builder and constructs a RateBasedStatement. This method will fail if any of the following fields are not set:

Trait Implementations§

source§

impl Clone for RateBasedStatementBuilder

source§

fn clone(&self) -> RateBasedStatementBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RateBasedStatementBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for RateBasedStatementBuilder

source§

fn default() -> RateBasedStatementBuilder

Returns the “default value” for a type. Read more
source§

impl PartialEq for RateBasedStatementBuilder

source§

fn eq(&self, other: &RateBasedStatementBuilder) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for RateBasedStatementBuilder

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more