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

/// <p>Describes a stateless rule.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct FirewallStatelessRule {
    /// <p>The ARN of the stateless rule group.</p>
    pub rule_group_arn: ::std::option::Option<::std::string::String>,
    /// <p>The source IP addresses, in CIDR notation.</p>
    pub sources: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>The destination IP addresses, in CIDR notation.</p>
    pub destinations: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>The source ports.</p>
    pub source_ports: ::std::option::Option<::std::vec::Vec<crate::types::PortRange>>,
    /// <p>The destination ports.</p>
    pub destination_ports: ::std::option::Option<::std::vec::Vec<crate::types::PortRange>>,
    /// <p>The protocols.</p>
    pub protocols: ::std::option::Option<::std::vec::Vec<i32>>,
    /// <p>The rule action. The possible values are <code>pass</code>, <code>drop</code>, and <code>forward_to_site</code>.</p>
    pub rule_action: ::std::option::Option<::std::string::String>,
    /// <p>The rule priority.</p>
    pub priority: ::std::option::Option<i32>,
}
impl FirewallStatelessRule {
    /// <p>The ARN of the stateless rule group.</p>
    pub fn rule_group_arn(&self) -> ::std::option::Option<&str> {
        self.rule_group_arn.as_deref()
    }
    /// <p>The source IP addresses, in CIDR notation.</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 `.sources.is_none()`.
    pub fn sources(&self) -> &[::std::string::String] {
        self.sources.as_deref().unwrap_or_default()
    }
    /// <p>The destination IP addresses, in CIDR notation.</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 `.destinations.is_none()`.
    pub fn destinations(&self) -> &[::std::string::String] {
        self.destinations.as_deref().unwrap_or_default()
    }
    /// <p>The source ports.</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 `.source_ports.is_none()`.
    pub fn source_ports(&self) -> &[crate::types::PortRange] {
        self.source_ports.as_deref().unwrap_or_default()
    }
    /// <p>The destination ports.</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 `.destination_ports.is_none()`.
    pub fn destination_ports(&self) -> &[crate::types::PortRange] {
        self.destination_ports.as_deref().unwrap_or_default()
    }
    /// <p>The protocols.</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 `.protocols.is_none()`.
    pub fn protocols(&self) -> &[i32] {
        self.protocols.as_deref().unwrap_or_default()
    }
    /// <p>The rule action. The possible values are <code>pass</code>, <code>drop</code>, and <code>forward_to_site</code>.</p>
    pub fn rule_action(&self) -> ::std::option::Option<&str> {
        self.rule_action.as_deref()
    }
    /// <p>The rule priority.</p>
    pub fn priority(&self) -> ::std::option::Option<i32> {
        self.priority
    }
}
impl FirewallStatelessRule {
    /// Creates a new builder-style object to manufacture [`FirewallStatelessRule`](crate::types::FirewallStatelessRule).
    pub fn builder() -> crate::types::builders::FirewallStatelessRuleBuilder {
        crate::types::builders::FirewallStatelessRuleBuilder::default()
    }
}

/// A builder for [`FirewallStatelessRule`](crate::types::FirewallStatelessRule).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct FirewallStatelessRuleBuilder {
    pub(crate) rule_group_arn: ::std::option::Option<::std::string::String>,
    pub(crate) sources: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) destinations: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) source_ports: ::std::option::Option<::std::vec::Vec<crate::types::PortRange>>,
    pub(crate) destination_ports: ::std::option::Option<::std::vec::Vec<crate::types::PortRange>>,
    pub(crate) protocols: ::std::option::Option<::std::vec::Vec<i32>>,
    pub(crate) rule_action: ::std::option::Option<::std::string::String>,
    pub(crate) priority: ::std::option::Option<i32>,
}
impl FirewallStatelessRuleBuilder {
    /// <p>The ARN of the stateless rule group.</p>
    pub fn rule_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.rule_group_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ARN of the stateless rule group.</p>
    pub fn set_rule_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.rule_group_arn = input;
        self
    }
    /// <p>The ARN of the stateless rule group.</p>
    pub fn get_rule_group_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.rule_group_arn
    }
    /// Appends an item to `sources`.
    ///
    /// To override the contents of this collection use [`set_sources`](Self::set_sources).
    ///
    /// <p>The source IP addresses, in CIDR notation.</p>
    pub fn sources(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.sources.unwrap_or_default();
        v.push(input.into());
        self.sources = ::std::option::Option::Some(v);
        self
    }
    /// <p>The source IP addresses, in CIDR notation.</p>
    pub fn set_sources(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.sources = input;
        self
    }
    /// <p>The source IP addresses, in CIDR notation.</p>
    pub fn get_sources(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.sources
    }
    /// Appends an item to `destinations`.
    ///
    /// To override the contents of this collection use [`set_destinations`](Self::set_destinations).
    ///
    /// <p>The destination IP addresses, in CIDR notation.</p>
    pub fn destinations(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.destinations.unwrap_or_default();
        v.push(input.into());
        self.destinations = ::std::option::Option::Some(v);
        self
    }
    /// <p>The destination IP addresses, in CIDR notation.</p>
    pub fn set_destinations(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.destinations = input;
        self
    }
    /// <p>The destination IP addresses, in CIDR notation.</p>
    pub fn get_destinations(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.destinations
    }
    /// Appends an item to `source_ports`.
    ///
    /// To override the contents of this collection use [`set_source_ports`](Self::set_source_ports).
    ///
    /// <p>The source ports.</p>
    pub fn source_ports(mut self, input: crate::types::PortRange) -> Self {
        let mut v = self.source_ports.unwrap_or_default();
        v.push(input);
        self.source_ports = ::std::option::Option::Some(v);
        self
    }
    /// <p>The source ports.</p>
    pub fn set_source_ports(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PortRange>>) -> Self {
        self.source_ports = input;
        self
    }
    /// <p>The source ports.</p>
    pub fn get_source_ports(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PortRange>> {
        &self.source_ports
    }
    /// Appends an item to `destination_ports`.
    ///
    /// To override the contents of this collection use [`set_destination_ports`](Self::set_destination_ports).
    ///
    /// <p>The destination ports.</p>
    pub fn destination_ports(mut self, input: crate::types::PortRange) -> Self {
        let mut v = self.destination_ports.unwrap_or_default();
        v.push(input);
        self.destination_ports = ::std::option::Option::Some(v);
        self
    }
    /// <p>The destination ports.</p>
    pub fn set_destination_ports(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PortRange>>) -> Self {
        self.destination_ports = input;
        self
    }
    /// <p>The destination ports.</p>
    pub fn get_destination_ports(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PortRange>> {
        &self.destination_ports
    }
    /// Appends an item to `protocols`.
    ///
    /// To override the contents of this collection use [`set_protocols`](Self::set_protocols).
    ///
    /// <p>The protocols.</p>
    pub fn protocols(mut self, input: i32) -> Self {
        let mut v = self.protocols.unwrap_or_default();
        v.push(input);
        self.protocols = ::std::option::Option::Some(v);
        self
    }
    /// <p>The protocols.</p>
    pub fn set_protocols(mut self, input: ::std::option::Option<::std::vec::Vec<i32>>) -> Self {
        self.protocols = input;
        self
    }
    /// <p>The protocols.</p>
    pub fn get_protocols(&self) -> &::std::option::Option<::std::vec::Vec<i32>> {
        &self.protocols
    }
    /// <p>The rule action. The possible values are <code>pass</code>, <code>drop</code>, and <code>forward_to_site</code>.</p>
    pub fn rule_action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.rule_action = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The rule action. The possible values are <code>pass</code>, <code>drop</code>, and <code>forward_to_site</code>.</p>
    pub fn set_rule_action(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.rule_action = input;
        self
    }
    /// <p>The rule action. The possible values are <code>pass</code>, <code>drop</code>, and <code>forward_to_site</code>.</p>
    pub fn get_rule_action(&self) -> &::std::option::Option<::std::string::String> {
        &self.rule_action
    }
    /// <p>The rule priority.</p>
    pub fn priority(mut self, input: i32) -> Self {
        self.priority = ::std::option::Option::Some(input);
        self
    }
    /// <p>The rule priority.</p>
    pub fn set_priority(mut self, input: ::std::option::Option<i32>) -> Self {
        self.priority = input;
        self
    }
    /// <p>The rule priority.</p>
    pub fn get_priority(&self) -> &::std::option::Option<i32> {
        &self.priority
    }
    /// Consumes the builder and constructs a [`FirewallStatelessRule`](crate::types::FirewallStatelessRule).
    pub fn build(self) -> crate::types::FirewallStatelessRule {
        crate::types::FirewallStatelessRule {
            rule_group_arn: self.rule_group_arn,
            sources: self.sources,
            destinations: self.destinations,
            source_ports: self.source_ports,
            destination_ports: self.destination_ports,
            protocols: self.protocols,
            rule_action: self.rule_action,
            priority: self.priority,
        }
    }
}