#[non_exhaustive]pub struct RateBasedStatementBuilder { /* private fields */ }
Expand description
A builder for RateBasedStatement
.
Implementations§
Source§impl RateBasedStatementBuilder
impl RateBasedStatementBuilder
Sourcepub fn limit(self, input: i64) -> Self
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.
Sourcepub fn set_limit(self, input: Option<i64>) -> Self
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.
Sourcepub fn get_limit(&self) -> &Option<i64>
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.
Sourcepub fn evaluation_window_sec(self, input: i64) -> Self
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)
Sourcepub fn set_evaluation_window_sec(self, input: Option<i64>) -> Self
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)
Sourcepub fn get_evaluation_window_sec(&self) -> &Option<i64>
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)
Sourcepub fn aggregate_key_type(
self,
input: RateBasedStatementAggregateKeyType,
) -> Self
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
orFORWARDED_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
.
Sourcepub fn set_aggregate_key_type(
self,
input: Option<RateBasedStatementAggregateKeyType>,
) -> Self
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
orFORWARDED_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
.
Sourcepub fn get_aggregate_key_type(
&self,
) -> &Option<RateBasedStatementAggregateKeyType>
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
orFORWARDED_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
.
Sourcepub fn scope_down_statement(self, input: impl Into<Box<Statement>>) -> Self
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.
Sourcepub fn set_scope_down_statement(self, input: Option<Box<Statement>>) -> Self
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.
Sourcepub fn get_scope_down_statement(&self) -> &Option<Box<Statement>>
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.
Sourcepub fn forwarded_ip_config(self, input: ForwardedIpConfig) -> Self
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.
Sourcepub fn set_forwarded_ip_config(self, input: Option<ForwardedIpConfig>) -> Self
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.
Sourcepub fn get_forwarded_ip_config(&self) -> &Option<ForwardedIpConfig>
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.
Sourcepub fn custom_keys(self, input: RateBasedStatementCustomKey) -> Self
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.
Sourcepub fn set_custom_keys(
self,
input: Option<Vec<RateBasedStatementCustomKey>>,
) -> Self
pub fn set_custom_keys( self, input: Option<Vec<RateBasedStatementCustomKey>>, ) -> Self
Specifies the aggregate keys to use in a rate-base rule.
Sourcepub fn get_custom_keys(&self) -> &Option<Vec<RateBasedStatementCustomKey>>
pub fn get_custom_keys(&self) -> &Option<Vec<RateBasedStatementCustomKey>>
Specifies the aggregate keys to use in a rate-base rule.
Sourcepub fn build(self) -> Result<RateBasedStatement, BuildError>
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
impl Clone for RateBasedStatementBuilder
Source§fn clone(&self) -> RateBasedStatementBuilder
fn clone(&self) -> RateBasedStatementBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RateBasedStatementBuilder
impl Debug for RateBasedStatementBuilder
Source§impl Default for RateBasedStatementBuilder
impl Default for RateBasedStatementBuilder
Source§fn default() -> RateBasedStatementBuilder
fn default() -> RateBasedStatementBuilder
impl StructuralPartialEq for RateBasedStatementBuilder
Auto Trait Implementations§
impl Freeze for RateBasedStatementBuilder
impl RefUnwindSafe for RateBasedStatementBuilder
impl Send for RateBasedStatementBuilder
impl Sync for RateBasedStatementBuilder
impl Unpin for RateBasedStatementBuilder
impl UnwindSafe for RateBasedStatementBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightBlack
.
§Example
println!("{}", value.bright_black());
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightGreen
.
§Example
println!("{}", value.bright_green());
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightYellow
.
§Example
println!("{}", value.bright_yellow());
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightMagenta
.
§Example
println!("{}", value.bright_magenta());
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightWhite
.
§Example
println!("{}", value.bright_white());
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightBlack
.
§Example
println!("{}", value.on_bright_black());
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightGreen
.
§Example
println!("{}", value.on_bright_green());
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightYellow
.
§Example
println!("{}", value.on_bright_yellow());
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightBlue
.
§Example
println!("{}", value.on_bright_blue());
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightMagenta
.
§Example
println!("{}", value.on_bright_magenta());
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightCyan
.
§Example
println!("{}", value.on_bright_cyan());
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightWhite
.
§Example
println!("{}", value.on_bright_white());
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn underline(&self) -> Painted<&T>
fn underline(&self) -> Painted<&T>
Returns self
with the
attr()
set to
Attribute::Underline
.
§Example
println!("{}", value.underline());
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Returns self
with the
attr()
set to
Attribute::RapidBlink
.
§Example
println!("{}", value.rapid_blink());
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);