1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A single rule, which you can use in a <code>WebACL</code> or <code>RuleGroup</code> to identify web requests that you want to manage in some way. Each rule includes one top-level <code>Statement</code> that WAF uses to identify matching web requests, and parameters that govern how WAF handles them.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Rule {
/// <p>The name of the rule.</p>
/// <p>If you change the name of a <code>Rule</code> after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's <code>VisibilityConfig</code> settings. WAF doesn't automatically update the metric name when you update the rule name.</p>
pub name: ::std::string::String,
/// <p>If you define more than one <code>Rule</code> in a <code>WebACL</code>, WAF evaluates each request against the <code>Rules</code> in order based on the value of <code>Priority</code>. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.</p>
pub priority: i32,
/// <p>The WAF processing statement for the rule, for example <code>ByteMatchStatement</code> or <code>SizeConstraintStatement</code>.</p>
pub statement: ::std::option::Option<crate::types::Statement>,
/// <p>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.</p>
/// <p>This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p>
/// <p>You must specify either this <code>Action</code> setting or the rule <code>OverrideAction</code> setting, but not both:</p>
/// <ul>
/// <li>
/// <p>If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.</p></li>
/// <li>
/// <p>If the rule statement references a rule group, use the override action setting and not this action setting.</p></li>
/// </ul>
pub action: ::std::option::Option<crate::types::RuleAction>,
/// <p>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.</p>
/// <p>You can only use this for rule statements that reference a rule group, like <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p><note>
/// <p>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 <code>Count</code> action, in your rule group reference statement settings.</p>
/// </note>
pub override_action: ::std::option::Option<crate::types::OverrideAction>,
/// <p>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.</p>
/// <p>Rules that run after this rule in the web ACL can match against these labels using a <code>LabelMatchStatement</code>.</p>
/// <p>For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:</p>
/// <ul>
/// <li>
/// <p>Separate each component of the label with a colon.</p></li>
/// <li>
/// <p>Each namespace or name can have up to 128 characters.</p></li>
/// <li>
/// <p>You can specify up to 5 namespaces in a label.</p></li>
/// <li>
/// <p>Don't use the following reserved words in your label specification: <code>aws</code>, <code>waf</code>, <code>managed</code>, <code>rulegroup</code>, <code>webacl</code>, <code>regexpatternset</code>, or <code>ipset</code>.</p></li>
/// </ul>
/// <p>For example, <code>myLabelName</code> or <code>nameSpace1:nameSpace2:myLabelName</code>.</p>
pub rule_labels: ::std::option::Option<::std::vec::Vec<crate::types::Label>>,
/// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
/// <p>If you change the name of a <code>Rule</code> 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.</p>
pub visibility_config: ::std::option::Option<crate::types::VisibilityConfig>,
/// <p>Specifies how WAF should handle <code>CAPTCHA</code> evaluations. If you don't specify this, WAF uses the <code>CAPTCHA</code> configuration that's defined for the web ACL.</p>
pub captcha_config: ::std::option::Option<crate::types::CaptchaConfig>,
/// <p>Specifies how WAF should handle <code>Challenge</code> evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.</p>
pub challenge_config: ::std::option::Option<crate::types::ChallengeConfig>,
}
impl Rule {
/// <p>The name of the rule.</p>
/// <p>If you change the name of a <code>Rule</code> after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's <code>VisibilityConfig</code> settings. WAF doesn't automatically update the metric name when you update the rule name.</p>
pub fn name(&self) -> &str {
use std::ops::Deref;
self.name.deref()
}
/// <p>If you define more than one <code>Rule</code> in a <code>WebACL</code>, WAF evaluates each request against the <code>Rules</code> in order based on the value of <code>Priority</code>. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.</p>
pub fn priority(&self) -> i32 {
self.priority
}
/// <p>The WAF processing statement for the rule, for example <code>ByteMatchStatement</code> or <code>SizeConstraintStatement</code>.</p>
pub fn statement(&self) -> ::std::option::Option<&crate::types::Statement> {
self.statement.as_ref()
}
/// <p>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.</p>
/// <p>This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p>
/// <p>You must specify either this <code>Action</code> setting or the rule <code>OverrideAction</code> setting, but not both:</p>
/// <ul>
/// <li>
/// <p>If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.</p></li>
/// <li>
/// <p>If the rule statement references a rule group, use the override action setting and not this action setting.</p></li>
/// </ul>
pub fn action(&self) -> ::std::option::Option<&crate::types::RuleAction> {
self.action.as_ref()
}
/// <p>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.</p>
/// <p>You can only use this for rule statements that reference a rule group, like <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p><note>
/// <p>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 <code>Count</code> action, in your rule group reference statement settings.</p>
/// </note>
pub fn override_action(&self) -> ::std::option::Option<&crate::types::OverrideAction> {
self.override_action.as_ref()
}
/// <p>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.</p>
/// <p>Rules that run after this rule in the web ACL can match against these labels using a <code>LabelMatchStatement</code>.</p>
/// <p>For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:</p>
/// <ul>
/// <li>
/// <p>Separate each component of the label with a colon.</p></li>
/// <li>
/// <p>Each namespace or name can have up to 128 characters.</p></li>
/// <li>
/// <p>You can specify up to 5 namespaces in a label.</p></li>
/// <li>
/// <p>Don't use the following reserved words in your label specification: <code>aws</code>, <code>waf</code>, <code>managed</code>, <code>rulegroup</code>, <code>webacl</code>, <code>regexpatternset</code>, or <code>ipset</code>.</p></li>
/// </ul>
/// <p>For example, <code>myLabelName</code> or <code>nameSpace1:nameSpace2:myLabelName</code>.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.rule_labels.is_none()`.
pub fn rule_labels(&self) -> &[crate::types::Label] {
self.rule_labels.as_deref().unwrap_or_default()
}
/// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
/// <p>If you change the name of a <code>Rule</code> 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.</p>
pub fn visibility_config(&self) -> ::std::option::Option<&crate::types::VisibilityConfig> {
self.visibility_config.as_ref()
}
/// <p>Specifies how WAF should handle <code>CAPTCHA</code> evaluations. If you don't specify this, WAF uses the <code>CAPTCHA</code> configuration that's defined for the web ACL.</p>
pub fn captcha_config(&self) -> ::std::option::Option<&crate::types::CaptchaConfig> {
self.captcha_config.as_ref()
}
/// <p>Specifies how WAF should handle <code>Challenge</code> evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.</p>
pub fn challenge_config(&self) -> ::std::option::Option<&crate::types::ChallengeConfig> {
self.challenge_config.as_ref()
}
}
impl Rule {
/// Creates a new builder-style object to manufacture [`Rule`](crate::types::Rule).
pub fn builder() -> crate::types::builders::RuleBuilder {
crate::types::builders::RuleBuilder::default()
}
}
/// A builder for [`Rule`](crate::types::Rule).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct RuleBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) priority: ::std::option::Option<i32>,
pub(crate) statement: ::std::option::Option<crate::types::Statement>,
pub(crate) action: ::std::option::Option<crate::types::RuleAction>,
pub(crate) override_action: ::std::option::Option<crate::types::OverrideAction>,
pub(crate) rule_labels: ::std::option::Option<::std::vec::Vec<crate::types::Label>>,
pub(crate) visibility_config: ::std::option::Option<crate::types::VisibilityConfig>,
pub(crate) captcha_config: ::std::option::Option<crate::types::CaptchaConfig>,
pub(crate) challenge_config: ::std::option::Option<crate::types::ChallengeConfig>,
}
impl RuleBuilder {
/// <p>The name of the rule.</p>
/// <p>If you change the name of a <code>Rule</code> after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's <code>VisibilityConfig</code> settings. WAF doesn't automatically update the metric name when you update the rule name.</p>
/// This field is required.
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.name = ::std::option::Option::Some(input.into());
self
}
/// <p>The name of the rule.</p>
/// <p>If you change the name of a <code>Rule</code> after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's <code>VisibilityConfig</code> settings. WAF doesn't automatically update the metric name when you update the rule name.</p>
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
/// <p>The name of the rule.</p>
/// <p>If you change the name of a <code>Rule</code> after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's <code>VisibilityConfig</code> settings. WAF doesn't automatically update the metric name when you update the rule name.</p>
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
/// <p>If you define more than one <code>Rule</code> in a <code>WebACL</code>, WAF evaluates each request against the <code>Rules</code> in order based on the value of <code>Priority</code>. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.</p>
/// This field is required.
pub fn priority(mut self, input: i32) -> Self {
self.priority = ::std::option::Option::Some(input);
self
}
/// <p>If you define more than one <code>Rule</code> in a <code>WebACL</code>, WAF evaluates each request against the <code>Rules</code> in order based on the value of <code>Priority</code>. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.</p>
pub fn set_priority(mut self, input: ::std::option::Option<i32>) -> Self {
self.priority = input;
self
}
/// <p>If you define more than one <code>Rule</code> in a <code>WebACL</code>, WAF evaluates each request against the <code>Rules</code> in order based on the value of <code>Priority</code>. WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.</p>
pub fn get_priority(&self) -> &::std::option::Option<i32> {
&self.priority
}
/// <p>The WAF processing statement for the rule, for example <code>ByteMatchStatement</code> or <code>SizeConstraintStatement</code>.</p>
/// This field is required.
pub fn statement(mut self, input: crate::types::Statement) -> Self {
self.statement = ::std::option::Option::Some(input);
self
}
/// <p>The WAF processing statement for the rule, for example <code>ByteMatchStatement</code> or <code>SizeConstraintStatement</code>.</p>
pub fn set_statement(mut self, input: ::std::option::Option<crate::types::Statement>) -> Self {
self.statement = input;
self
}
/// <p>The WAF processing statement for the rule, for example <code>ByteMatchStatement</code> or <code>SizeConstraintStatement</code>.</p>
pub fn get_statement(&self) -> &::std::option::Option<crate::types::Statement> {
&self.statement
}
/// <p>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.</p>
/// <p>This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p>
/// <p>You must specify either this <code>Action</code> setting or the rule <code>OverrideAction</code> setting, but not both:</p>
/// <ul>
/// <li>
/// <p>If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.</p></li>
/// <li>
/// <p>If the rule statement references a rule group, use the override action setting and not this action setting.</p></li>
/// </ul>
pub fn action(mut self, input: crate::types::RuleAction) -> Self {
self.action = ::std::option::Option::Some(input);
self
}
/// <p>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.</p>
/// <p>This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p>
/// <p>You must specify either this <code>Action</code> setting or the rule <code>OverrideAction</code> setting, but not both:</p>
/// <ul>
/// <li>
/// <p>If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.</p></li>
/// <li>
/// <p>If the rule statement references a rule group, use the override action setting and not this action setting.</p></li>
/// </ul>
pub fn set_action(mut self, input: ::std::option::Option<crate::types::RuleAction>) -> Self {
self.action = input;
self
}
/// <p>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.</p>
/// <p>This is used only for rules whose statements do not reference a rule group. Rule statements that reference a rule group include <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p>
/// <p>You must specify either this <code>Action</code> setting or the rule <code>OverrideAction</code> setting, but not both:</p>
/// <ul>
/// <li>
/// <p>If the rule statement does not reference a rule group, use this rule action setting and not the rule override action setting.</p></li>
/// <li>
/// <p>If the rule statement references a rule group, use the override action setting and not this action setting.</p></li>
/// </ul>
pub fn get_action(&self) -> &::std::option::Option<crate::types::RuleAction> {
&self.action
}
/// <p>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.</p>
/// <p>You can only use this for rule statements that reference a rule group, like <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p><note>
/// <p>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 <code>Count</code> action, in your rule group reference statement settings.</p>
/// </note>
pub fn override_action(mut self, input: crate::types::OverrideAction) -> Self {
self.override_action = ::std::option::Option::Some(input);
self
}
/// <p>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.</p>
/// <p>You can only use this for rule statements that reference a rule group, like <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p><note>
/// <p>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 <code>Count</code> action, in your rule group reference statement settings.</p>
/// </note>
pub fn set_override_action(mut self, input: ::std::option::Option<crate::types::OverrideAction>) -> Self {
self.override_action = input;
self
}
/// <p>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.</p>
/// <p>You can only use this for rule statements that reference a rule group, like <code>RuleGroupReferenceStatement</code> and <code>ManagedRuleGroupStatement</code>.</p><note>
/// <p>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 <code>Count</code> action, in your rule group reference statement settings.</p>
/// </note>
pub fn get_override_action(&self) -> &::std::option::Option<crate::types::OverrideAction> {
&self.override_action
}
/// Appends an item to `rule_labels`.
///
/// To override the contents of this collection use [`set_rule_labels`](Self::set_rule_labels).
///
/// <p>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.</p>
/// <p>Rules that run after this rule in the web ACL can match against these labels using a <code>LabelMatchStatement</code>.</p>
/// <p>For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:</p>
/// <ul>
/// <li>
/// <p>Separate each component of the label with a colon.</p></li>
/// <li>
/// <p>Each namespace or name can have up to 128 characters.</p></li>
/// <li>
/// <p>You can specify up to 5 namespaces in a label.</p></li>
/// <li>
/// <p>Don't use the following reserved words in your label specification: <code>aws</code>, <code>waf</code>, <code>managed</code>, <code>rulegroup</code>, <code>webacl</code>, <code>regexpatternset</code>, or <code>ipset</code>.</p></li>
/// </ul>
/// <p>For example, <code>myLabelName</code> or <code>nameSpace1:nameSpace2:myLabelName</code>.</p>
pub fn rule_labels(mut self, input: crate::types::Label) -> Self {
let mut v = self.rule_labels.unwrap_or_default();
v.push(input);
self.rule_labels = ::std::option::Option::Some(v);
self
}
/// <p>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.</p>
/// <p>Rules that run after this rule in the web ACL can match against these labels using a <code>LabelMatchStatement</code>.</p>
/// <p>For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:</p>
/// <ul>
/// <li>
/// <p>Separate each component of the label with a colon.</p></li>
/// <li>
/// <p>Each namespace or name can have up to 128 characters.</p></li>
/// <li>
/// <p>You can specify up to 5 namespaces in a label.</p></li>
/// <li>
/// <p>Don't use the following reserved words in your label specification: <code>aws</code>, <code>waf</code>, <code>managed</code>, <code>rulegroup</code>, <code>webacl</code>, <code>regexpatternset</code>, or <code>ipset</code>.</p></li>
/// </ul>
/// <p>For example, <code>myLabelName</code> or <code>nameSpace1:nameSpace2:myLabelName</code>.</p>
pub fn set_rule_labels(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Label>>) -> Self {
self.rule_labels = input;
self
}
/// <p>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.</p>
/// <p>Rules that run after this rule in the web ACL can match against these labels using a <code>LabelMatchStatement</code>.</p>
/// <p>For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:</p>
/// <ul>
/// <li>
/// <p>Separate each component of the label with a colon.</p></li>
/// <li>
/// <p>Each namespace or name can have up to 128 characters.</p></li>
/// <li>
/// <p>You can specify up to 5 namespaces in a label.</p></li>
/// <li>
/// <p>Don't use the following reserved words in your label specification: <code>aws</code>, <code>waf</code>, <code>managed</code>, <code>rulegroup</code>, <code>webacl</code>, <code>regexpatternset</code>, or <code>ipset</code>.</p></li>
/// </ul>
/// <p>For example, <code>myLabelName</code> or <code>nameSpace1:nameSpace2:myLabelName</code>.</p>
pub fn get_rule_labels(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Label>> {
&self.rule_labels
}
/// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
/// <p>If you change the name of a <code>Rule</code> 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.</p>
/// This field is required.
pub fn visibility_config(mut self, input: crate::types::VisibilityConfig) -> Self {
self.visibility_config = ::std::option::Option::Some(input);
self
}
/// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
/// <p>If you change the name of a <code>Rule</code> 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.</p>
pub fn set_visibility_config(mut self, input: ::std::option::Option<crate::types::VisibilityConfig>) -> Self {
self.visibility_config = input;
self
}
/// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
/// <p>If you change the name of a <code>Rule</code> 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.</p>
pub fn get_visibility_config(&self) -> &::std::option::Option<crate::types::VisibilityConfig> {
&self.visibility_config
}
/// <p>Specifies how WAF should handle <code>CAPTCHA</code> evaluations. If you don't specify this, WAF uses the <code>CAPTCHA</code> configuration that's defined for the web ACL.</p>
pub fn captcha_config(mut self, input: crate::types::CaptchaConfig) -> Self {
self.captcha_config = ::std::option::Option::Some(input);
self
}
/// <p>Specifies how WAF should handle <code>CAPTCHA</code> evaluations. If you don't specify this, WAF uses the <code>CAPTCHA</code> configuration that's defined for the web ACL.</p>
pub fn set_captcha_config(mut self, input: ::std::option::Option<crate::types::CaptchaConfig>) -> Self {
self.captcha_config = input;
self
}
/// <p>Specifies how WAF should handle <code>CAPTCHA</code> evaluations. If you don't specify this, WAF uses the <code>CAPTCHA</code> configuration that's defined for the web ACL.</p>
pub fn get_captcha_config(&self) -> &::std::option::Option<crate::types::CaptchaConfig> {
&self.captcha_config
}
/// <p>Specifies how WAF should handle <code>Challenge</code> evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.</p>
pub fn challenge_config(mut self, input: crate::types::ChallengeConfig) -> Self {
self.challenge_config = ::std::option::Option::Some(input);
self
}
/// <p>Specifies how WAF should handle <code>Challenge</code> evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.</p>
pub fn set_challenge_config(mut self, input: ::std::option::Option<crate::types::ChallengeConfig>) -> Self {
self.challenge_config = input;
self
}
/// <p>Specifies how WAF should handle <code>Challenge</code> evaluations. If you don't specify this, WAF uses the challenge configuration that's defined for the web ACL.</p>
pub fn get_challenge_config(&self) -> &::std::option::Option<crate::types::ChallengeConfig> {
&self.challenge_config
}
/// Consumes the builder and constructs a [`Rule`](crate::types::Rule).
/// This method will fail if any of the following fields are not set:
/// - [`name`](crate::types::builders::RuleBuilder::name)
pub fn build(self) -> ::std::result::Result<crate::types::Rule, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Rule {
name: self.name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"name",
"name was not specified but it is required when building Rule",
)
})?,
priority: self.priority.unwrap_or_default(),
statement: self.statement,
action: self.action,
override_action: self.override_action,
rule_labels: self.rule_labels,
visibility_config: self.visibility_config,
captcha_config: self.captcha_config,
challenge_config: self.challenge_config,
})
}
}