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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A rule group that's defined for an Firewall Manager WAF policy.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct FirewallManagerRuleGroup {
    /// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
    pub name: ::std::string::String,
    /// <p>If you define more than one rule group in the first or last Firewall Manager rule groups, WAF evaluates each request against the rule groups in order, starting from the lowest priority setting. The priorities don't need to be consecutive, but they must all be different.</p>
    pub priority: i32,
    /// <p>The processing guidance for an Firewall Manager rule. This is like a regular rule <code>Statement</code>, but it can only contain a rule group reference.</p>
    pub firewall_manager_statement: ::std::option::Option<crate::types::FirewallManagerStatement>,
    /// <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>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
    pub visibility_config: ::std::option::Option<crate::types::VisibilityConfig>,
}
impl FirewallManagerRuleGroup {
    /// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
    pub fn name(&self) -> &str {
        use std::ops::Deref;
        self.name.deref()
    }
    /// <p>If you define more than one rule group in the first or last Firewall Manager rule groups, WAF evaluates each request against the rule groups in order, starting from the lowest priority setting. The priorities don't need to be consecutive, but they must all be different.</p>
    pub fn priority(&self) -> i32 {
        self.priority
    }
    /// <p>The processing guidance for an Firewall Manager rule. This is like a regular rule <code>Statement</code>, but it can only contain a rule group reference.</p>
    pub fn firewall_manager_statement(&self) -> ::std::option::Option<&crate::types::FirewallManagerStatement> {
        self.firewall_manager_statement.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>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
    pub fn visibility_config(&self) -> ::std::option::Option<&crate::types::VisibilityConfig> {
        self.visibility_config.as_ref()
    }
}
impl FirewallManagerRuleGroup {
    /// Creates a new builder-style object to manufacture [`FirewallManagerRuleGroup`](crate::types::FirewallManagerRuleGroup).
    pub fn builder() -> crate::types::builders::FirewallManagerRuleGroupBuilder {
        crate::types::builders::FirewallManagerRuleGroupBuilder::default()
    }
}

/// A builder for [`FirewallManagerRuleGroup`](crate::types::FirewallManagerRuleGroup).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct FirewallManagerRuleGroupBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) priority: ::std::option::Option<i32>,
    pub(crate) firewall_manager_statement: ::std::option::Option<crate::types::FirewallManagerStatement>,
    pub(crate) override_action: ::std::option::Option<crate::types::OverrideAction>,
    pub(crate) visibility_config: ::std::option::Option<crate::types::VisibilityConfig>,
}
impl FirewallManagerRuleGroupBuilder {
    /// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</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 group. You cannot change the name of a rule group after you create it.</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 group. You cannot change the name of a rule group after you create it.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>If you define more than one rule group in the first or last Firewall Manager rule groups, WAF evaluates each request against the rule groups in order, starting from the lowest priority setting. 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 rule group in the first or last Firewall Manager rule groups, WAF evaluates each request against the rule groups in order, starting from the lowest priority setting. 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 rule group in the first or last Firewall Manager rule groups, WAF evaluates each request against the rule groups in order, starting from the lowest priority setting. 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 processing guidance for an Firewall Manager rule. This is like a regular rule <code>Statement</code>, but it can only contain a rule group reference.</p>
    /// This field is required.
    pub fn firewall_manager_statement(mut self, input: crate::types::FirewallManagerStatement) -> Self {
        self.firewall_manager_statement = ::std::option::Option::Some(input);
        self
    }
    /// <p>The processing guidance for an Firewall Manager rule. This is like a regular rule <code>Statement</code>, but it can only contain a rule group reference.</p>
    pub fn set_firewall_manager_statement(mut self, input: ::std::option::Option<crate::types::FirewallManagerStatement>) -> Self {
        self.firewall_manager_statement = input;
        self
    }
    /// <p>The processing guidance for an Firewall Manager rule. This is like a regular rule <code>Statement</code>, but it can only contain a rule group reference.</p>
    pub fn get_firewall_manager_statement(&self) -> &::std::option::Option<crate::types::FirewallManagerStatement> {
        &self.firewall_manager_statement
    }
    /// <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>
    /// This field is required.
    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
    }
    /// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</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>
    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>
    pub fn get_visibility_config(&self) -> &::std::option::Option<crate::types::VisibilityConfig> {
        &self.visibility_config
    }
    /// Consumes the builder and constructs a [`FirewallManagerRuleGroup`](crate::types::FirewallManagerRuleGroup).
    /// This method will fail if any of the following fields are not set:
    /// - [`name`](crate::types::builders::FirewallManagerRuleGroupBuilder::name)
    pub fn build(self) -> ::std::result::Result<crate::types::FirewallManagerRuleGroup, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::FirewallManagerRuleGroup {
            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 FirewallManagerRuleGroup",
                )
            })?,
            priority: self.priority.unwrap_or_default(),
            firewall_manager_statement: self.firewall_manager_statement,
            override_action: self.override_action,
            visibility_config: self.visibility_config,
        })
    }
}