aws_sdk_ec2/operation/create_subnet/
_create_subnet_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateSubnetInput {
6    /// <p>The tags to assign to the subnet.</p>
7    pub tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
8    /// <p>The Availability Zone or Local Zone for the subnet.</p>
9    /// <p>Default: Amazon Web Services selects one for you. If you create more than one subnet in your VPC, we do not necessarily select a different zone for each subnet.</p>
10    /// <p>To create a subnet in a Local Zone, set this value to the Local Zone ID, for example <code>us-west-2-lax-1a</code>. For information about the Regions that support Local Zones, see <a href="https://docs.aws.amazon.com/local-zones/latest/ug/available-local-zones.html">Available Local Zones</a>.</p>
11    /// <p>To create a subnet in an Outpost, set this value to the Availability Zone for the Outpost and specify the Outpost ARN.</p>
12    pub availability_zone: ::std::option::Option<::std::string::String>,
13    /// <p>The AZ ID or the Local Zone ID of the subnet.</p>
14    pub availability_zone_id: ::std::option::Option<::std::string::String>,
15    /// <p>The IPv4 network range for the subnet, in CIDR notation. For example, <code>10.0.0.0/24</code>. We modify the specified CIDR block to its canonical form; for example, if you specify <code>100.68.0.18/18</code>, we modify it to <code>100.68.0.0/18</code>.</p>
16    /// <p>This parameter is not supported for an IPv6 only subnet.</p>
17    pub cidr_block: ::std::option::Option<::std::string::String>,
18    /// <p>The IPv6 network range for the subnet, in CIDR notation. This parameter is required for an IPv6 only subnet.</p>
19    pub ipv6_cidr_block: ::std::option::Option<::std::string::String>,
20    /// <p>The Amazon Resource Name (ARN) of the Outpost. If you specify an Outpost ARN, you must also specify the Availability Zone of the Outpost subnet.</p>
21    pub outpost_arn: ::std::option::Option<::std::string::String>,
22    /// <p>The ID of the VPC.</p>
23    pub vpc_id: ::std::option::Option<::std::string::String>,
24    /// <p>Indicates whether to create an IPv6 only subnet.</p>
25    pub ipv6_native: ::std::option::Option<bool>,
26    /// <p>An IPv4 IPAM pool ID for the subnet.</p>
27    pub ipv4_ipam_pool_id: ::std::option::Option<::std::string::String>,
28    /// <p>An IPv4 netmask length for the subnet.</p>
29    pub ipv4_netmask_length: ::std::option::Option<i32>,
30    /// <p>An IPv6 IPAM pool ID for the subnet.</p>
31    pub ipv6_ipam_pool_id: ::std::option::Option<::std::string::String>,
32    /// <p>An IPv6 netmask length for the subnet.</p>
33    pub ipv6_netmask_length: ::std::option::Option<i32>,
34    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
35    pub dry_run: ::std::option::Option<bool>,
36}
37impl CreateSubnetInput {
38    /// <p>The tags to assign to the subnet.</p>
39    ///
40    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tag_specifications.is_none()`.
41    pub fn tag_specifications(&self) -> &[crate::types::TagSpecification] {
42        self.tag_specifications.as_deref().unwrap_or_default()
43    }
44    /// <p>The Availability Zone or Local Zone for the subnet.</p>
45    /// <p>Default: Amazon Web Services selects one for you. If you create more than one subnet in your VPC, we do not necessarily select a different zone for each subnet.</p>
46    /// <p>To create a subnet in a Local Zone, set this value to the Local Zone ID, for example <code>us-west-2-lax-1a</code>. For information about the Regions that support Local Zones, see <a href="https://docs.aws.amazon.com/local-zones/latest/ug/available-local-zones.html">Available Local Zones</a>.</p>
47    /// <p>To create a subnet in an Outpost, set this value to the Availability Zone for the Outpost and specify the Outpost ARN.</p>
48    pub fn availability_zone(&self) -> ::std::option::Option<&str> {
49        self.availability_zone.as_deref()
50    }
51    /// <p>The AZ ID or the Local Zone ID of the subnet.</p>
52    pub fn availability_zone_id(&self) -> ::std::option::Option<&str> {
53        self.availability_zone_id.as_deref()
54    }
55    /// <p>The IPv4 network range for the subnet, in CIDR notation. For example, <code>10.0.0.0/24</code>. We modify the specified CIDR block to its canonical form; for example, if you specify <code>100.68.0.18/18</code>, we modify it to <code>100.68.0.0/18</code>.</p>
56    /// <p>This parameter is not supported for an IPv6 only subnet.</p>
57    pub fn cidr_block(&self) -> ::std::option::Option<&str> {
58        self.cidr_block.as_deref()
59    }
60    /// <p>The IPv6 network range for the subnet, in CIDR notation. This parameter is required for an IPv6 only subnet.</p>
61    pub fn ipv6_cidr_block(&self) -> ::std::option::Option<&str> {
62        self.ipv6_cidr_block.as_deref()
63    }
64    /// <p>The Amazon Resource Name (ARN) of the Outpost. If you specify an Outpost ARN, you must also specify the Availability Zone of the Outpost subnet.</p>
65    pub fn outpost_arn(&self) -> ::std::option::Option<&str> {
66        self.outpost_arn.as_deref()
67    }
68    /// <p>The ID of the VPC.</p>
69    pub fn vpc_id(&self) -> ::std::option::Option<&str> {
70        self.vpc_id.as_deref()
71    }
72    /// <p>Indicates whether to create an IPv6 only subnet.</p>
73    pub fn ipv6_native(&self) -> ::std::option::Option<bool> {
74        self.ipv6_native
75    }
76    /// <p>An IPv4 IPAM pool ID for the subnet.</p>
77    pub fn ipv4_ipam_pool_id(&self) -> ::std::option::Option<&str> {
78        self.ipv4_ipam_pool_id.as_deref()
79    }
80    /// <p>An IPv4 netmask length for the subnet.</p>
81    pub fn ipv4_netmask_length(&self) -> ::std::option::Option<i32> {
82        self.ipv4_netmask_length
83    }
84    /// <p>An IPv6 IPAM pool ID for the subnet.</p>
85    pub fn ipv6_ipam_pool_id(&self) -> ::std::option::Option<&str> {
86        self.ipv6_ipam_pool_id.as_deref()
87    }
88    /// <p>An IPv6 netmask length for the subnet.</p>
89    pub fn ipv6_netmask_length(&self) -> ::std::option::Option<i32> {
90        self.ipv6_netmask_length
91    }
92    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
93    pub fn dry_run(&self) -> ::std::option::Option<bool> {
94        self.dry_run
95    }
96}
97impl CreateSubnetInput {
98    /// Creates a new builder-style object to manufacture [`CreateSubnetInput`](crate::operation::create_subnet::CreateSubnetInput).
99    pub fn builder() -> crate::operation::create_subnet::builders::CreateSubnetInputBuilder {
100        crate::operation::create_subnet::builders::CreateSubnetInputBuilder::default()
101    }
102}
103
104/// A builder for [`CreateSubnetInput`](crate::operation::create_subnet::CreateSubnetInput).
105#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
106#[non_exhaustive]
107pub struct CreateSubnetInputBuilder {
108    pub(crate) tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
109    pub(crate) availability_zone: ::std::option::Option<::std::string::String>,
110    pub(crate) availability_zone_id: ::std::option::Option<::std::string::String>,
111    pub(crate) cidr_block: ::std::option::Option<::std::string::String>,
112    pub(crate) ipv6_cidr_block: ::std::option::Option<::std::string::String>,
113    pub(crate) outpost_arn: ::std::option::Option<::std::string::String>,
114    pub(crate) vpc_id: ::std::option::Option<::std::string::String>,
115    pub(crate) ipv6_native: ::std::option::Option<bool>,
116    pub(crate) ipv4_ipam_pool_id: ::std::option::Option<::std::string::String>,
117    pub(crate) ipv4_netmask_length: ::std::option::Option<i32>,
118    pub(crate) ipv6_ipam_pool_id: ::std::option::Option<::std::string::String>,
119    pub(crate) ipv6_netmask_length: ::std::option::Option<i32>,
120    pub(crate) dry_run: ::std::option::Option<bool>,
121}
122impl CreateSubnetInputBuilder {
123    /// Appends an item to `tag_specifications`.
124    ///
125    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
126    ///
127    /// <p>The tags to assign to the subnet.</p>
128    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
129        let mut v = self.tag_specifications.unwrap_or_default();
130        v.push(input);
131        self.tag_specifications = ::std::option::Option::Some(v);
132        self
133    }
134    /// <p>The tags to assign to the subnet.</p>
135    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
136        self.tag_specifications = input;
137        self
138    }
139    /// <p>The tags to assign to the subnet.</p>
140    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
141        &self.tag_specifications
142    }
143    /// <p>The Availability Zone or Local Zone for the subnet.</p>
144    /// <p>Default: Amazon Web Services selects one for you. If you create more than one subnet in your VPC, we do not necessarily select a different zone for each subnet.</p>
145    /// <p>To create a subnet in a Local Zone, set this value to the Local Zone ID, for example <code>us-west-2-lax-1a</code>. For information about the Regions that support Local Zones, see <a href="https://docs.aws.amazon.com/local-zones/latest/ug/available-local-zones.html">Available Local Zones</a>.</p>
146    /// <p>To create a subnet in an Outpost, set this value to the Availability Zone for the Outpost and specify the Outpost ARN.</p>
147    pub fn availability_zone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.availability_zone = ::std::option::Option::Some(input.into());
149        self
150    }
151    /// <p>The Availability Zone or Local Zone for the subnet.</p>
152    /// <p>Default: Amazon Web Services selects one for you. If you create more than one subnet in your VPC, we do not necessarily select a different zone for each subnet.</p>
153    /// <p>To create a subnet in a Local Zone, set this value to the Local Zone ID, for example <code>us-west-2-lax-1a</code>. For information about the Regions that support Local Zones, see <a href="https://docs.aws.amazon.com/local-zones/latest/ug/available-local-zones.html">Available Local Zones</a>.</p>
154    /// <p>To create a subnet in an Outpost, set this value to the Availability Zone for the Outpost and specify the Outpost ARN.</p>
155    pub fn set_availability_zone(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
156        self.availability_zone = input;
157        self
158    }
159    /// <p>The Availability Zone or Local Zone for the subnet.</p>
160    /// <p>Default: Amazon Web Services selects one for you. If you create more than one subnet in your VPC, we do not necessarily select a different zone for each subnet.</p>
161    /// <p>To create a subnet in a Local Zone, set this value to the Local Zone ID, for example <code>us-west-2-lax-1a</code>. For information about the Regions that support Local Zones, see <a href="https://docs.aws.amazon.com/local-zones/latest/ug/available-local-zones.html">Available Local Zones</a>.</p>
162    /// <p>To create a subnet in an Outpost, set this value to the Availability Zone for the Outpost and specify the Outpost ARN.</p>
163    pub fn get_availability_zone(&self) -> &::std::option::Option<::std::string::String> {
164        &self.availability_zone
165    }
166    /// <p>The AZ ID or the Local Zone ID of the subnet.</p>
167    pub fn availability_zone_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
168        self.availability_zone_id = ::std::option::Option::Some(input.into());
169        self
170    }
171    /// <p>The AZ ID or the Local Zone ID of the subnet.</p>
172    pub fn set_availability_zone_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
173        self.availability_zone_id = input;
174        self
175    }
176    /// <p>The AZ ID or the Local Zone ID of the subnet.</p>
177    pub fn get_availability_zone_id(&self) -> &::std::option::Option<::std::string::String> {
178        &self.availability_zone_id
179    }
180    /// <p>The IPv4 network range for the subnet, in CIDR notation. For example, <code>10.0.0.0/24</code>. We modify the specified CIDR block to its canonical form; for example, if you specify <code>100.68.0.18/18</code>, we modify it to <code>100.68.0.0/18</code>.</p>
181    /// <p>This parameter is not supported for an IPv6 only subnet.</p>
182    pub fn cidr_block(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
183        self.cidr_block = ::std::option::Option::Some(input.into());
184        self
185    }
186    /// <p>The IPv4 network range for the subnet, in CIDR notation. For example, <code>10.0.0.0/24</code>. We modify the specified CIDR block to its canonical form; for example, if you specify <code>100.68.0.18/18</code>, we modify it to <code>100.68.0.0/18</code>.</p>
187    /// <p>This parameter is not supported for an IPv6 only subnet.</p>
188    pub fn set_cidr_block(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189        self.cidr_block = input;
190        self
191    }
192    /// <p>The IPv4 network range for the subnet, in CIDR notation. For example, <code>10.0.0.0/24</code>. We modify the specified CIDR block to its canonical form; for example, if you specify <code>100.68.0.18/18</code>, we modify it to <code>100.68.0.0/18</code>.</p>
193    /// <p>This parameter is not supported for an IPv6 only subnet.</p>
194    pub fn get_cidr_block(&self) -> &::std::option::Option<::std::string::String> {
195        &self.cidr_block
196    }
197    /// <p>The IPv6 network range for the subnet, in CIDR notation. This parameter is required for an IPv6 only subnet.</p>
198    pub fn ipv6_cidr_block(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
199        self.ipv6_cidr_block = ::std::option::Option::Some(input.into());
200        self
201    }
202    /// <p>The IPv6 network range for the subnet, in CIDR notation. This parameter is required for an IPv6 only subnet.</p>
203    pub fn set_ipv6_cidr_block(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
204        self.ipv6_cidr_block = input;
205        self
206    }
207    /// <p>The IPv6 network range for the subnet, in CIDR notation. This parameter is required for an IPv6 only subnet.</p>
208    pub fn get_ipv6_cidr_block(&self) -> &::std::option::Option<::std::string::String> {
209        &self.ipv6_cidr_block
210    }
211    /// <p>The Amazon Resource Name (ARN) of the Outpost. If you specify an Outpost ARN, you must also specify the Availability Zone of the Outpost subnet.</p>
212    pub fn outpost_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
213        self.outpost_arn = ::std::option::Option::Some(input.into());
214        self
215    }
216    /// <p>The Amazon Resource Name (ARN) of the Outpost. If you specify an Outpost ARN, you must also specify the Availability Zone of the Outpost subnet.</p>
217    pub fn set_outpost_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
218        self.outpost_arn = input;
219        self
220    }
221    /// <p>The Amazon Resource Name (ARN) of the Outpost. If you specify an Outpost ARN, you must also specify the Availability Zone of the Outpost subnet.</p>
222    pub fn get_outpost_arn(&self) -> &::std::option::Option<::std::string::String> {
223        &self.outpost_arn
224    }
225    /// <p>The ID of the VPC.</p>
226    /// This field is required.
227    pub fn vpc_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
228        self.vpc_id = ::std::option::Option::Some(input.into());
229        self
230    }
231    /// <p>The ID of the VPC.</p>
232    pub fn set_vpc_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
233        self.vpc_id = input;
234        self
235    }
236    /// <p>The ID of the VPC.</p>
237    pub fn get_vpc_id(&self) -> &::std::option::Option<::std::string::String> {
238        &self.vpc_id
239    }
240    /// <p>Indicates whether to create an IPv6 only subnet.</p>
241    pub fn ipv6_native(mut self, input: bool) -> Self {
242        self.ipv6_native = ::std::option::Option::Some(input);
243        self
244    }
245    /// <p>Indicates whether to create an IPv6 only subnet.</p>
246    pub fn set_ipv6_native(mut self, input: ::std::option::Option<bool>) -> Self {
247        self.ipv6_native = input;
248        self
249    }
250    /// <p>Indicates whether to create an IPv6 only subnet.</p>
251    pub fn get_ipv6_native(&self) -> &::std::option::Option<bool> {
252        &self.ipv6_native
253    }
254    /// <p>An IPv4 IPAM pool ID for the subnet.</p>
255    pub fn ipv4_ipam_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
256        self.ipv4_ipam_pool_id = ::std::option::Option::Some(input.into());
257        self
258    }
259    /// <p>An IPv4 IPAM pool ID for the subnet.</p>
260    pub fn set_ipv4_ipam_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
261        self.ipv4_ipam_pool_id = input;
262        self
263    }
264    /// <p>An IPv4 IPAM pool ID for the subnet.</p>
265    pub fn get_ipv4_ipam_pool_id(&self) -> &::std::option::Option<::std::string::String> {
266        &self.ipv4_ipam_pool_id
267    }
268    /// <p>An IPv4 netmask length for the subnet.</p>
269    pub fn ipv4_netmask_length(mut self, input: i32) -> Self {
270        self.ipv4_netmask_length = ::std::option::Option::Some(input);
271        self
272    }
273    /// <p>An IPv4 netmask length for the subnet.</p>
274    pub fn set_ipv4_netmask_length(mut self, input: ::std::option::Option<i32>) -> Self {
275        self.ipv4_netmask_length = input;
276        self
277    }
278    /// <p>An IPv4 netmask length for the subnet.</p>
279    pub fn get_ipv4_netmask_length(&self) -> &::std::option::Option<i32> {
280        &self.ipv4_netmask_length
281    }
282    /// <p>An IPv6 IPAM pool ID for the subnet.</p>
283    pub fn ipv6_ipam_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
284        self.ipv6_ipam_pool_id = ::std::option::Option::Some(input.into());
285        self
286    }
287    /// <p>An IPv6 IPAM pool ID for the subnet.</p>
288    pub fn set_ipv6_ipam_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
289        self.ipv6_ipam_pool_id = input;
290        self
291    }
292    /// <p>An IPv6 IPAM pool ID for the subnet.</p>
293    pub fn get_ipv6_ipam_pool_id(&self) -> &::std::option::Option<::std::string::String> {
294        &self.ipv6_ipam_pool_id
295    }
296    /// <p>An IPv6 netmask length for the subnet.</p>
297    pub fn ipv6_netmask_length(mut self, input: i32) -> Self {
298        self.ipv6_netmask_length = ::std::option::Option::Some(input);
299        self
300    }
301    /// <p>An IPv6 netmask length for the subnet.</p>
302    pub fn set_ipv6_netmask_length(mut self, input: ::std::option::Option<i32>) -> Self {
303        self.ipv6_netmask_length = input;
304        self
305    }
306    /// <p>An IPv6 netmask length for the subnet.</p>
307    pub fn get_ipv6_netmask_length(&self) -> &::std::option::Option<i32> {
308        &self.ipv6_netmask_length
309    }
310    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
311    pub fn dry_run(mut self, input: bool) -> Self {
312        self.dry_run = ::std::option::Option::Some(input);
313        self
314    }
315    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
316    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
317        self.dry_run = input;
318        self
319    }
320    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
321    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
322        &self.dry_run
323    }
324    /// Consumes the builder and constructs a [`CreateSubnetInput`](crate::operation::create_subnet::CreateSubnetInput).
325    pub fn build(
326        self,
327    ) -> ::std::result::Result<crate::operation::create_subnet::CreateSubnetInput, ::aws_smithy_types::error::operation::BuildError> {
328        ::std::result::Result::Ok(crate::operation::create_subnet::CreateSubnetInput {
329            tag_specifications: self.tag_specifications,
330            availability_zone: self.availability_zone,
331            availability_zone_id: self.availability_zone_id,
332            cidr_block: self.cidr_block,
333            ipv6_cidr_block: self.ipv6_cidr_block,
334            outpost_arn: self.outpost_arn,
335            vpc_id: self.vpc_id,
336            ipv6_native: self.ipv6_native,
337            ipv4_ipam_pool_id: self.ipv4_ipam_pool_id,
338            ipv4_netmask_length: self.ipv4_netmask_length,
339            ipv6_ipam_pool_id: self.ipv6_ipam_pool_id,
340            ipv6_netmask_length: self.ipv6_netmask_length,
341            dry_run: self.dry_run,
342        })
343    }
344}