#[non_exhaustive]pub struct RuleBuilder { /* private fields */ }
Expand description
A builder for Rule
.
Implementations§
Source§impl RuleBuilder
impl RuleBuilder
Sourcepub fn name(self, input: impl Into<String>) -> Self
pub fn name(self, input: impl Into<String>) -> Self
The name of the rule.
If you change the name of a Rule
after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's VisibilityConfig
settings. WAF doesn't automatically update the metric name when you update the rule name.
Sourcepub fn set_name(self, input: Option<String>) -> Self
pub fn set_name(self, input: Option<String>) -> Self
The name of the rule.
If you change the name of a Rule
after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's VisibilityConfig
settings. WAF doesn't automatically update the metric name when you update the rule name.
Sourcepub fn get_name(&self) -> &Option<String>
pub fn get_name(&self) -> &Option<String>
The name of the rule.
If you change the name of a Rule
after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's VisibilityConfig
settings. WAF doesn't automatically update the metric name when you update the rule name.
Sourcepub fn priority(self, input: i32) -> Self
pub fn priority(self, input: i32) -> Self
If you define more than one Rule
in a WebACL
, WAF evaluates each request against the Rules
in order based on the value of Priority
. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.
Sourcepub fn set_priority(self, input: Option<i32>) -> Self
pub fn set_priority(self, input: Option<i32>) -> Self
If you define more than one Rule
in a WebACL
, WAF evaluates each request against the Rules
in order based on the value of Priority
. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.
Sourcepub fn get_priority(&self) -> &Option<i32>
pub fn get_priority(&self) -> &Option<i32>
If you define more than one Rule
in a WebACL
, WAF evaluates each request against the Rules
in order based on the value of Priority
. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.
Sourcepub fn statement(self, input: Statement) -> Self
pub fn statement(self, input: Statement) -> Self
The WAF processing statement for the rule, for example ByteMatchStatement
or SizeConstraintStatement
.
Sourcepub fn set_statement(self, input: Option<Statement>) -> Self
pub fn set_statement(self, input: Option<Statement>) -> Self
The WAF processing statement for the rule, for example ByteMatchStatement
or SizeConstraintStatement
.
Sourcepub fn get_statement(&self) -> &Option<Statement>
pub fn get_statement(&self) -> &Option<Statement>
The WAF processing statement for the rule, for example ByteMatchStatement
or SizeConstraintStatement
.
Sourcepub fn action(self, input: RuleAction) -> Self
pub fn action(self, input: RuleAction) -> Self
The action that WAF should take on a web request when it matches the rule statement. Settings at the web ACL level can override the rule action setting.
This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
You must specify either this Action
setting or the rule OverrideAction
setting, but not both:
-
If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.
-
If the rule statement references a rule group, use the override action setting and not this action setting.
Sourcepub fn set_action(self, input: Option<RuleAction>) -> Self
pub fn set_action(self, input: Option<RuleAction>) -> Self
The action that WAF should take on a web request when it matches the rule statement. Settings at the web ACL level can override the rule action setting.
This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
You must specify either this Action
setting or the rule OverrideAction
setting, but not both:
-
If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.
-
If the rule statement references a rule group, use the override action setting and not this action setting.
Sourcepub fn get_action(&self) -> &Option<RuleAction>
pub fn get_action(&self) -> &Option<RuleAction>
The action that WAF should take on a web request when it matches the rule statement. Settings at the web ACL level can override the rule action setting.
This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
You must specify either this Action
setting or the rule OverrideAction
setting, but not both:
-
If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.
-
If the rule statement references a rule group, use the override action setting and not this action setting.
Sourcepub fn override_action(self, input: OverrideAction) -> Self
pub fn override_action(self, input: OverrideAction) -> Self
The action to use in the place of the action that results from the rule group evaluation. Set the override action to none to leave the result of the rule group alone. Set it to count to override the result to count only.
You can only use this for rule statements that reference a rule group, like RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
This option is usually set to none. It does not affect how the rules in the rule group are evaluated. If you want the rules in the rule group to only count matches, do not use this and instead use the rule action override option, with Count
action, in your rule group reference statement settings.
Sourcepub fn set_override_action(self, input: Option<OverrideAction>) -> Self
pub fn set_override_action(self, input: Option<OverrideAction>) -> Self
The action to use in the place of the action that results from the rule group evaluation. Set the override action to none to leave the result of the rule group alone. Set it to count to override the result to count only.
You can only use this for rule statements that reference a rule group, like RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
This option is usually set to none. It does not affect how the rules in the rule group are evaluated. If you want the rules in the rule group to only count matches, do not use this and instead use the rule action override option, with Count
action, in your rule group reference statement settings.
Sourcepub fn get_override_action(&self) -> &Option<OverrideAction>
pub fn get_override_action(&self) -> &Option<OverrideAction>
The action to use in the place of the action that results from the rule group evaluation. Set the override action to none to leave the result of the rule group alone. Set it to count to override the result to count only.
You can only use this for rule statements that reference a rule group, like RuleGroupReferenceStatement
and ManagedRuleGroupStatement
.
This option is usually set to none. It does not affect how the rules in the rule group are evaluated. If you want the rules in the rule group to only count matches, do not use this and instead use the rule action override option, with Count
action, in your rule group reference statement settings.
Sourcepub fn rule_labels(self, input: Label) -> Self
pub fn rule_labels(self, input: Label) -> Self
Appends an item to rule_labels
.
To override the contents of this collection use set_rule_labels
.
Labels to apply to web requests that match the rule match statement. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.
Rules that run after this rule in the web ACL can match against these labels using a LabelMatchStatement
.
For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:
-
Separate each component of the label with a colon.
-
Each namespace or name can have up to 128 characters.
-
You can specify up to 5 namespaces in a label.
-
Don't use the following reserved words in your label specification:
aws
,waf
,managed
,rulegroup
,webacl
,regexpatternset
, oripset
.
For example, myLabelName
or nameSpace1:nameSpace2:myLabelName
.
Sourcepub fn set_rule_labels(self, input: Option<Vec<Label>>) -> Self
pub fn set_rule_labels(self, input: Option<Vec<Label>>) -> Self
Labels to apply to web requests that match the rule match statement. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.
Rules that run after this rule in the web ACL can match against these labels using a LabelMatchStatement
.
For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:
-
Separate each component of the label with a colon.
-
Each namespace or name can have up to 128 characters.
-
You can specify up to 5 namespaces in a label.
-
Don't use the following reserved words in your label specification:
aws
,waf
,managed
,rulegroup
,webacl
,regexpatternset
, oripset
.
For example, myLabelName
or nameSpace1:nameSpace2:myLabelName
.
Sourcepub fn get_rule_labels(&self) -> &Option<Vec<Label>>
pub fn get_rule_labels(&self) -> &Option<Vec<Label>>
Labels to apply to web requests that match the rule match statement. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.
Rules that run after this rule in the web ACL can match against these labels using a LabelMatchStatement
.
For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:
-
Separate each component of the label with a colon.
-
Each namespace or name can have up to 128 characters.
-
You can specify up to 5 namespaces in a label.
-
Don't use the following reserved words in your label specification:
aws
,waf
,managed
,rulegroup
,webacl
,regexpatternset
, oripset
.
For example, myLabelName
or nameSpace1:nameSpace2:myLabelName
.
Sourcepub fn visibility_config(self, input: VisibilityConfig) -> Self
pub fn visibility_config(self, input: VisibilityConfig) -> Self
Defines and enables Amazon CloudWatch metrics and web request sample collection.
If you change the name of a Rule
after you create it and you want the rule's metric name to reflect the change, update the metric name as well. WAF doesn't automatically update the metric name.
Sourcepub fn set_visibility_config(self, input: Option<VisibilityConfig>) -> Self
pub fn set_visibility_config(self, input: Option<VisibilityConfig>) -> Self
Defines and enables Amazon CloudWatch metrics and web request sample collection.
If you change the name of a Rule
after you create it and you want the rule's metric name to reflect the change, update the metric name as well. WAF doesn't automatically update the metric name.
Sourcepub fn get_visibility_config(&self) -> &Option<VisibilityConfig>
pub fn get_visibility_config(&self) -> &Option<VisibilityConfig>
Defines and enables Amazon CloudWatch metrics and web request sample collection.
If you change the name of a Rule
after you create it and you want the rule's metric name to reflect the change, update the metric name as well. WAF doesn't automatically update the metric name.
Sourcepub fn captcha_config(self, input: CaptchaConfig) -> Self
pub fn captcha_config(self, input: CaptchaConfig) -> Self
Specifies how WAF should handle CAPTCHA
evaluations. If you don't specify this, WAF uses the CAPTCHA
configuration that's defined for the web ACL.
Sourcepub fn set_captcha_config(self, input: Option<CaptchaConfig>) -> Self
pub fn set_captcha_config(self, input: Option<CaptchaConfig>) -> Self
Specifies how WAF should handle CAPTCHA
evaluations. If you don't specify this, WAF uses the CAPTCHA
configuration that's defined for the web ACL.
Sourcepub fn get_captcha_config(&self) -> &Option<CaptchaConfig>
pub fn get_captcha_config(&self) -> &Option<CaptchaConfig>
Specifies how WAF should handle CAPTCHA
evaluations. If you don't specify this, WAF uses the CAPTCHA
configuration that's defined for the web ACL.
Sourcepub fn challenge_config(self, input: ChallengeConfig) -> Self
pub fn challenge_config(self, input: ChallengeConfig) -> Self
Specifies how WAF should handle Challenge
evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.
Sourcepub fn set_challenge_config(self, input: Option<ChallengeConfig>) -> Self
pub fn set_challenge_config(self, input: Option<ChallengeConfig>) -> Self
Specifies how WAF should handle Challenge
evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.
Sourcepub fn get_challenge_config(&self) -> &Option<ChallengeConfig>
pub fn get_challenge_config(&self) -> &Option<ChallengeConfig>
Specifies how WAF should handle Challenge
evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.
Trait Implementations§
Source§impl Clone for RuleBuilder
impl Clone for RuleBuilder
Source§fn clone(&self) -> RuleBuilder
fn clone(&self) -> RuleBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RuleBuilder
impl Debug for RuleBuilder
Source§impl Default for RuleBuilder
impl Default for RuleBuilder
Source§fn default() -> RuleBuilder
fn default() -> RuleBuilder
Source§impl PartialEq for RuleBuilder
impl PartialEq for RuleBuilder
impl StructuralPartialEq for RuleBuilder
Auto Trait Implementations§
impl Freeze for RuleBuilder
impl RefUnwindSafe for RuleBuilder
impl Send for RuleBuilder
impl Sync for RuleBuilder
impl Unpin for RuleBuilder
impl UnwindSafe for RuleBuilder
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);