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

/// <p>Information about a public virtual interface.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct NewPublicVirtualInterface {
    /// <p>The name of the virtual interface assigned by the customer network. The name has a maximum of 100 characters. The following are valid characters: a-z, 0-9 and a hyphen (-).</p>
    pub virtual_interface_name: ::std::string::String,
    /// <p>The ID of the VLAN.</p>
    pub vlan: i32,
    /// <p>The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.</p>
    /// <p>The valid values are 1-2147483647.</p>
    pub asn: i32,
    /// <p>The authentication key for BGP configuration. This string has a minimum length of 6 characters and and a maximun lenth of 80 characters.</p>
    pub auth_key: ::std::option::Option<::std::string::String>,
    /// <p>The IP address assigned to the Amazon interface.</p>
    pub amazon_address: ::std::option::Option<::std::string::String>,
    /// <p>The IP address assigned to the customer interface.</p>
    pub customer_address: ::std::option::Option<::std::string::String>,
    /// <p>The address family for the BGP peer.</p>
    pub address_family: ::std::option::Option<crate::types::AddressFamily>,
    /// <p>The routes to be advertised to the Amazon Web Services network in this Region. Applies to public virtual interfaces.</p>
    pub route_filter_prefixes: ::std::option::Option<::std::vec::Vec<crate::types::RouteFilterPrefix>>,
    /// <p>The tags associated with the public virtual interface.</p>
    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
}
impl NewPublicVirtualInterface {
    /// <p>The name of the virtual interface assigned by the customer network. The name has a maximum of 100 characters. The following are valid characters: a-z, 0-9 and a hyphen (-).</p>
    pub fn virtual_interface_name(&self) -> &str {
        use std::ops::Deref;
        self.virtual_interface_name.deref()
    }
    /// <p>The ID of the VLAN.</p>
    pub fn vlan(&self) -> i32 {
        self.vlan
    }
    /// <p>The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.</p>
    /// <p>The valid values are 1-2147483647.</p>
    pub fn asn(&self) -> i32 {
        self.asn
    }
    /// <p>The authentication key for BGP configuration. This string has a minimum length of 6 characters and and a maximun lenth of 80 characters.</p>
    pub fn auth_key(&self) -> ::std::option::Option<&str> {
        self.auth_key.as_deref()
    }
    /// <p>The IP address assigned to the Amazon interface.</p>
    pub fn amazon_address(&self) -> ::std::option::Option<&str> {
        self.amazon_address.as_deref()
    }
    /// <p>The IP address assigned to the customer interface.</p>
    pub fn customer_address(&self) -> ::std::option::Option<&str> {
        self.customer_address.as_deref()
    }
    /// <p>The address family for the BGP peer.</p>
    pub fn address_family(&self) -> ::std::option::Option<&crate::types::AddressFamily> {
        self.address_family.as_ref()
    }
    /// <p>The routes to be advertised to the Amazon Web Services network in this Region. Applies to public virtual interfaces.</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 `.route_filter_prefixes.is_none()`.
    pub fn route_filter_prefixes(&self) -> &[crate::types::RouteFilterPrefix] {
        self.route_filter_prefixes.as_deref().unwrap_or_default()
    }
    /// <p>The tags associated with the public virtual interface.</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 `.tags.is_none()`.
    pub fn tags(&self) -> &[crate::types::Tag] {
        self.tags.as_deref().unwrap_or_default()
    }
}
impl NewPublicVirtualInterface {
    /// Creates a new builder-style object to manufacture [`NewPublicVirtualInterface`](crate::types::NewPublicVirtualInterface).
    pub fn builder() -> crate::types::builders::NewPublicVirtualInterfaceBuilder {
        crate::types::builders::NewPublicVirtualInterfaceBuilder::default()
    }
}

/// A builder for [`NewPublicVirtualInterface`](crate::types::NewPublicVirtualInterface).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct NewPublicVirtualInterfaceBuilder {
    pub(crate) virtual_interface_name: ::std::option::Option<::std::string::String>,
    pub(crate) vlan: ::std::option::Option<i32>,
    pub(crate) asn: ::std::option::Option<i32>,
    pub(crate) auth_key: ::std::option::Option<::std::string::String>,
    pub(crate) amazon_address: ::std::option::Option<::std::string::String>,
    pub(crate) customer_address: ::std::option::Option<::std::string::String>,
    pub(crate) address_family: ::std::option::Option<crate::types::AddressFamily>,
    pub(crate) route_filter_prefixes: ::std::option::Option<::std::vec::Vec<crate::types::RouteFilterPrefix>>,
    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
}
impl NewPublicVirtualInterfaceBuilder {
    /// <p>The name of the virtual interface assigned by the customer network. The name has a maximum of 100 characters. The following are valid characters: a-z, 0-9 and a hyphen (-).</p>
    /// This field is required.
    pub fn virtual_interface_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.virtual_interface_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the virtual interface assigned by the customer network. The name has a maximum of 100 characters. The following are valid characters: a-z, 0-9 and a hyphen (-).</p>
    pub fn set_virtual_interface_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.virtual_interface_name = input;
        self
    }
    /// <p>The name of the virtual interface assigned by the customer network. The name has a maximum of 100 characters. The following are valid characters: a-z, 0-9 and a hyphen (-).</p>
    pub fn get_virtual_interface_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.virtual_interface_name
    }
    /// <p>The ID of the VLAN.</p>
    /// This field is required.
    pub fn vlan(mut self, input: i32) -> Self {
        self.vlan = ::std::option::Option::Some(input);
        self
    }
    /// <p>The ID of the VLAN.</p>
    pub fn set_vlan(mut self, input: ::std::option::Option<i32>) -> Self {
        self.vlan = input;
        self
    }
    /// <p>The ID of the VLAN.</p>
    pub fn get_vlan(&self) -> &::std::option::Option<i32> {
        &self.vlan
    }
    /// <p>The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.</p>
    /// <p>The valid values are 1-2147483647.</p>
    /// This field is required.
    pub fn asn(mut self, input: i32) -> Self {
        self.asn = ::std::option::Option::Some(input);
        self
    }
    /// <p>The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.</p>
    /// <p>The valid values are 1-2147483647.</p>
    pub fn set_asn(mut self, input: ::std::option::Option<i32>) -> Self {
        self.asn = input;
        self
    }
    /// <p>The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.</p>
    /// <p>The valid values are 1-2147483647.</p>
    pub fn get_asn(&self) -> &::std::option::Option<i32> {
        &self.asn
    }
    /// <p>The authentication key for BGP configuration. This string has a minimum length of 6 characters and and a maximun lenth of 80 characters.</p>
    pub fn auth_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.auth_key = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The authentication key for BGP configuration. This string has a minimum length of 6 characters and and a maximun lenth of 80 characters.</p>
    pub fn set_auth_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.auth_key = input;
        self
    }
    /// <p>The authentication key for BGP configuration. This string has a minimum length of 6 characters and and a maximun lenth of 80 characters.</p>
    pub fn get_auth_key(&self) -> &::std::option::Option<::std::string::String> {
        &self.auth_key
    }
    /// <p>The IP address assigned to the Amazon interface.</p>
    pub fn amazon_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.amazon_address = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The IP address assigned to the Amazon interface.</p>
    pub fn set_amazon_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.amazon_address = input;
        self
    }
    /// <p>The IP address assigned to the Amazon interface.</p>
    pub fn get_amazon_address(&self) -> &::std::option::Option<::std::string::String> {
        &self.amazon_address
    }
    /// <p>The IP address assigned to the customer interface.</p>
    pub fn customer_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.customer_address = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The IP address assigned to the customer interface.</p>
    pub fn set_customer_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.customer_address = input;
        self
    }
    /// <p>The IP address assigned to the customer interface.</p>
    pub fn get_customer_address(&self) -> &::std::option::Option<::std::string::String> {
        &self.customer_address
    }
    /// <p>The address family for the BGP peer.</p>
    pub fn address_family(mut self, input: crate::types::AddressFamily) -> Self {
        self.address_family = ::std::option::Option::Some(input);
        self
    }
    /// <p>The address family for the BGP peer.</p>
    pub fn set_address_family(mut self, input: ::std::option::Option<crate::types::AddressFamily>) -> Self {
        self.address_family = input;
        self
    }
    /// <p>The address family for the BGP peer.</p>
    pub fn get_address_family(&self) -> &::std::option::Option<crate::types::AddressFamily> {
        &self.address_family
    }
    /// Appends an item to `route_filter_prefixes`.
    ///
    /// To override the contents of this collection use [`set_route_filter_prefixes`](Self::set_route_filter_prefixes).
    ///
    /// <p>The routes to be advertised to the Amazon Web Services network in this Region. Applies to public virtual interfaces.</p>
    pub fn route_filter_prefixes(mut self, input: crate::types::RouteFilterPrefix) -> Self {
        let mut v = self.route_filter_prefixes.unwrap_or_default();
        v.push(input);
        self.route_filter_prefixes = ::std::option::Option::Some(v);
        self
    }
    /// <p>The routes to be advertised to the Amazon Web Services network in this Region. Applies to public virtual interfaces.</p>
    pub fn set_route_filter_prefixes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RouteFilterPrefix>>) -> Self {
        self.route_filter_prefixes = input;
        self
    }
    /// <p>The routes to be advertised to the Amazon Web Services network in this Region. Applies to public virtual interfaces.</p>
    pub fn get_route_filter_prefixes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RouteFilterPrefix>> {
        &self.route_filter_prefixes
    }
    /// Appends an item to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// <p>The tags associated with the public virtual interface.</p>
    pub fn tags(mut self, input: crate::types::Tag) -> Self {
        let mut v = self.tags.unwrap_or_default();
        v.push(input);
        self.tags = ::std::option::Option::Some(v);
        self
    }
    /// <p>The tags associated with the public virtual interface.</p>
    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
        self.tags = input;
        self
    }
    /// <p>The tags associated with the public virtual interface.</p>
    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
        &self.tags
    }
    /// Consumes the builder and constructs a [`NewPublicVirtualInterface`](crate::types::NewPublicVirtualInterface).
    /// This method will fail if any of the following fields are not set:
    /// - [`virtual_interface_name`](crate::types::builders::NewPublicVirtualInterfaceBuilder::virtual_interface_name)
    pub fn build(self) -> ::std::result::Result<crate::types::NewPublicVirtualInterface, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::NewPublicVirtualInterface {
            virtual_interface_name: self.virtual_interface_name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "virtual_interface_name",
                    "virtual_interface_name was not specified but it is required when building NewPublicVirtualInterface",
                )
            })?,
            vlan: self.vlan.unwrap_or_default(),
            asn: self.asn.unwrap_or_default(),
            auth_key: self.auth_key,
            amazon_address: self.amazon_address,
            customer_address: self.customer_address,
            address_family: self.address_family,
            route_filter_prefixes: self.route_filter_prefixes,
            tags: self.tags,
        })
    }
}