aws_sdk_ec2/protocol_serde/
shape_subnet.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_subnet(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::Subnet, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::Subnet::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("availabilityZoneId") /* AvailabilityZoneId com.amazonaws.ec2#Subnet$AvailabilityZoneId */ =>  {
11                let var_1 =
12                    Some(
13                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
15                            .into()
16                        )
17                        ?
18                    )
19                ;
20                builder = builder.set_availability_zone_id(var_1);
21            }
22            ,
23            s if s.matches("enableLniAtDeviceIndex") /* EnableLniAtDeviceIndex com.amazonaws.ec2#Subnet$EnableLniAtDeviceIndex */ =>  {
24                let var_2 =
25                    Some(
26                         {
27                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
28                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29                            )
30                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
31                        }
32                        ?
33                    )
34                ;
35                builder = builder.set_enable_lni_at_device_index(var_2);
36            }
37            ,
38            s if s.matches("mapCustomerOwnedIpOnLaunch") /* MapCustomerOwnedIpOnLaunch com.amazonaws.ec2#Subnet$MapCustomerOwnedIpOnLaunch */ =>  {
39                let var_3 =
40                    Some(
41                         {
42                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
43                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
44                            )
45                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
46                        }
47                        ?
48                    )
49                ;
50                builder = builder.set_map_customer_owned_ip_on_launch(var_3);
51            }
52            ,
53            s if s.matches("customerOwnedIpv4Pool") /* CustomerOwnedIpv4Pool com.amazonaws.ec2#Subnet$CustomerOwnedIpv4Pool */ =>  {
54                let var_4 =
55                    Some(
56                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
57                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
58                            .into()
59                        )
60                        ?
61                    )
62                ;
63                builder = builder.set_customer_owned_ipv4_pool(var_4);
64            }
65            ,
66            s if s.matches("ownerId") /* OwnerId com.amazonaws.ec2#Subnet$OwnerId */ =>  {
67                let var_5 =
68                    Some(
69                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
70                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
71                            .into()
72                        )
73                        ?
74                    )
75                ;
76                builder = builder.set_owner_id(var_5);
77            }
78            ,
79            s if s.matches("assignIpv6AddressOnCreation") /* AssignIpv6AddressOnCreation com.amazonaws.ec2#Subnet$AssignIpv6AddressOnCreation */ =>  {
80                let var_6 =
81                    Some(
82                         {
83                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
84                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
85                            )
86                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
87                        }
88                        ?
89                    )
90                ;
91                builder = builder.set_assign_ipv6_address_on_creation(var_6);
92            }
93            ,
94            s if s.matches("ipv6CidrBlockAssociationSet") /* Ipv6CidrBlockAssociationSet com.amazonaws.ec2#Subnet$Ipv6CidrBlockAssociationSet */ =>  {
95                let var_7 =
96                    Some(
97                        crate::protocol_serde::shape_subnet_ipv6_cidr_block_association_set::de_subnet_ipv6_cidr_block_association_set(&mut tag)
98                        ?
99                    )
100                ;
101                builder = builder.set_ipv6_cidr_block_association_set(var_7);
102            }
103            ,
104            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#Subnet$Tags */ =>  {
105                let var_8 =
106                    Some(
107                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
108                        ?
109                    )
110                ;
111                builder = builder.set_tags(var_8);
112            }
113            ,
114            s if s.matches("subnetArn") /* SubnetArn com.amazonaws.ec2#Subnet$SubnetArn */ =>  {
115                let var_9 =
116                    Some(
117                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
118                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
119                            .into()
120                        )
121                        ?
122                    )
123                ;
124                builder = builder.set_subnet_arn(var_9);
125            }
126            ,
127            s if s.matches("outpostArn") /* OutpostArn com.amazonaws.ec2#Subnet$OutpostArn */ =>  {
128                let var_10 =
129                    Some(
130                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
131                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
132                            .into()
133                        )
134                        ?
135                    )
136                ;
137                builder = builder.set_outpost_arn(var_10);
138            }
139            ,
140            s if s.matches("enableDns64") /* EnableDns64 com.amazonaws.ec2#Subnet$EnableDns64 */ =>  {
141                let var_11 =
142                    Some(
143                         {
144                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
145                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
146                            )
147                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
148                        }
149                        ?
150                    )
151                ;
152                builder = builder.set_enable_dns64(var_11);
153            }
154            ,
155            s if s.matches("ipv6Native") /* Ipv6Native com.amazonaws.ec2#Subnet$Ipv6Native */ =>  {
156                let var_12 =
157                    Some(
158                         {
159                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
160                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
161                            )
162                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
163                        }
164                        ?
165                    )
166                ;
167                builder = builder.set_ipv6_native(var_12);
168            }
169            ,
170            s if s.matches("privateDnsNameOptionsOnLaunch") /* PrivateDnsNameOptionsOnLaunch com.amazonaws.ec2#Subnet$PrivateDnsNameOptionsOnLaunch */ =>  {
171                let var_13 =
172                    Some(
173                        crate::protocol_serde::shape_private_dns_name_options_on_launch::de_private_dns_name_options_on_launch(&mut tag)
174                        ?
175                    )
176                ;
177                builder = builder.set_private_dns_name_options_on_launch(var_13);
178            }
179            ,
180            s if s.matches("blockPublicAccessStates") /* BlockPublicAccessStates com.amazonaws.ec2#Subnet$BlockPublicAccessStates */ =>  {
181                let var_14 =
182                    Some(
183                        crate::protocol_serde::shape_block_public_access_states::de_block_public_access_states(&mut tag)
184                        ?
185                    )
186                ;
187                builder = builder.set_block_public_access_states(var_14);
188            }
189            ,
190            s if s.matches("type") /* Type com.amazonaws.ec2#Subnet$Type */ =>  {
191                let var_15 =
192                    Some(
193                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
194                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
195                            .into()
196                        )
197                        ?
198                    )
199                ;
200                builder = builder.set_type(var_15);
201            }
202            ,
203            s if s.matches("subnetId") /* SubnetId com.amazonaws.ec2#Subnet$SubnetId */ =>  {
204                let var_16 =
205                    Some(
206                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
207                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
208                            .into()
209                        )
210                        ?
211                    )
212                ;
213                builder = builder.set_subnet_id(var_16);
214            }
215            ,
216            s if s.matches("state") /* State com.amazonaws.ec2#Subnet$State */ =>  {
217                let var_17 =
218                    Some(
219                        Result::<crate::types::SubnetState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
220                            crate::types::SubnetState::from(
221                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
222                            )
223                        )
224                        ?
225                    )
226                ;
227                builder = builder.set_state(var_17);
228            }
229            ,
230            s if s.matches("vpcId") /* VpcId com.amazonaws.ec2#Subnet$VpcId */ =>  {
231                let var_18 =
232                    Some(
233                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
234                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
235                            .into()
236                        )
237                        ?
238                    )
239                ;
240                builder = builder.set_vpc_id(var_18);
241            }
242            ,
243            s if s.matches("cidrBlock") /* CidrBlock com.amazonaws.ec2#Subnet$CidrBlock */ =>  {
244                let var_19 =
245                    Some(
246                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
247                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
248                            .into()
249                        )
250                        ?
251                    )
252                ;
253                builder = builder.set_cidr_block(var_19);
254            }
255            ,
256            s if s.matches("availableIpAddressCount") /* AvailableIpAddressCount com.amazonaws.ec2#Subnet$AvailableIpAddressCount */ =>  {
257                let var_20 =
258                    Some(
259                         {
260                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
261                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
262                            )
263                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
264                        }
265                        ?
266                    )
267                ;
268                builder = builder.set_available_ip_address_count(var_20);
269            }
270            ,
271            s if s.matches("availabilityZone") /* AvailabilityZone com.amazonaws.ec2#Subnet$AvailabilityZone */ =>  {
272                let var_21 =
273                    Some(
274                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
275                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
276                            .into()
277                        )
278                        ?
279                    )
280                ;
281                builder = builder.set_availability_zone(var_21);
282            }
283            ,
284            s if s.matches("defaultForAz") /* DefaultForAz com.amazonaws.ec2#Subnet$DefaultForAz */ =>  {
285                let var_22 =
286                    Some(
287                         {
288                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
289                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
290                            )
291                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
292                        }
293                        ?
294                    )
295                ;
296                builder = builder.set_default_for_az(var_22);
297            }
298            ,
299            s if s.matches("mapPublicIpOnLaunch") /* MapPublicIpOnLaunch com.amazonaws.ec2#Subnet$MapPublicIpOnLaunch */ =>  {
300                let var_23 =
301                    Some(
302                         {
303                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
304                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
305                            )
306                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
307                        }
308                        ?
309                    )
310                ;
311                builder = builder.set_map_public_ip_on_launch(var_23);
312            }
313            ,
314            _ => {}
315        }
316    }
317    Ok(builder.build())
318}