Skip to main content

aws_sdk_autoscaling/protocol_serde/
shape_launch_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_launch_configuration(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::LaunchConfiguration, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::LaunchConfiguration::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("LaunchConfigurationName") /* LaunchConfigurationName com.amazonaws.autoscaling#LaunchConfiguration$LaunchConfigurationName */ =>  {
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_launch_configuration_name(var_1);
21            }
22            ,
23            s if s.matches("LaunchConfigurationARN") /* LaunchConfigurationARN com.amazonaws.autoscaling#LaunchConfiguration$LaunchConfigurationARN */ =>  {
24                let var_2 =
25                    Some(
26                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
28                            .into()
29                        )
30                        ?
31                    )
32                ;
33                builder = builder.set_launch_configuration_arn(var_2);
34            }
35            ,
36            s if s.matches("ImageId") /* ImageId com.amazonaws.autoscaling#LaunchConfiguration$ImageId */ =>  {
37                let var_3 =
38                    Some(
39                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
40                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
41                            .into()
42                        )
43                        ?
44                    )
45                ;
46                builder = builder.set_image_id(var_3);
47            }
48            ,
49            s if s.matches("KeyName") /* KeyName com.amazonaws.autoscaling#LaunchConfiguration$KeyName */ =>  {
50                let var_4 =
51                    Some(
52                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
53                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
54                            .into()
55                        )
56                        ?
57                    )
58                ;
59                builder = builder.set_key_name(var_4);
60            }
61            ,
62            s if s.matches("SecurityGroups") /* SecurityGroups com.amazonaws.autoscaling#LaunchConfiguration$SecurityGroups */ =>  {
63                let var_5 =
64                    Some(
65                        crate::protocol_serde::shape_security_groups::de_security_groups(&mut tag)
66                        ?
67                    )
68                ;
69                builder = builder.set_security_groups(var_5);
70            }
71            ,
72            s if s.matches("ClassicLinkVPCId") /* ClassicLinkVPCId com.amazonaws.autoscaling#LaunchConfiguration$ClassicLinkVPCId */ =>  {
73                let var_6 =
74                    Some(
75                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
76                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
77                            .into()
78                        )
79                        ?
80                    )
81                ;
82                builder = builder.set_classic_link_vpc_id(var_6);
83            }
84            ,
85            s if s.matches("ClassicLinkVPCSecurityGroups") /* ClassicLinkVPCSecurityGroups com.amazonaws.autoscaling#LaunchConfiguration$ClassicLinkVPCSecurityGroups */ =>  {
86                let var_7 =
87                    Some(
88                        crate::protocol_serde::shape_classic_link_vpc_security_groups::de_classic_link_vpc_security_groups(&mut tag)
89                        ?
90                    )
91                ;
92                builder = builder.set_classic_link_vpc_security_groups(var_7);
93            }
94            ,
95            s if s.matches("UserData") /* UserData com.amazonaws.autoscaling#LaunchConfiguration$UserData */ =>  {
96                let var_8 =
97                    Some(
98                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
99                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
100                            .into()
101                        )
102                        ?
103                    )
104                ;
105                builder = builder.set_user_data(var_8);
106            }
107            ,
108            s if s.matches("InstanceType") /* InstanceType com.amazonaws.autoscaling#LaunchConfiguration$InstanceType */ =>  {
109                let var_9 =
110                    Some(
111                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
112                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
113                            .into()
114                        )
115                        ?
116                    )
117                ;
118                builder = builder.set_instance_type(var_9);
119            }
120            ,
121            s if s.matches("KernelId") /* KernelId com.amazonaws.autoscaling#LaunchConfiguration$KernelId */ =>  {
122                let var_10 =
123                    Some(
124                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
125                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
126                            .into()
127                        )
128                        ?
129                    )
130                ;
131                builder = builder.set_kernel_id(var_10);
132            }
133            ,
134            s if s.matches("RamdiskId") /* RamdiskId com.amazonaws.autoscaling#LaunchConfiguration$RamdiskId */ =>  {
135                let var_11 =
136                    Some(
137                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
138                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
139                            .into()
140                        )
141                        ?
142                    )
143                ;
144                builder = builder.set_ramdisk_id(var_11);
145            }
146            ,
147            s if s.matches("BlockDeviceMappings") /* BlockDeviceMappings com.amazonaws.autoscaling#LaunchConfiguration$BlockDeviceMappings */ =>  {
148                let var_12 =
149                    Some(
150                        crate::protocol_serde::shape_block_device_mappings::de_block_device_mappings(&mut tag)
151                        ?
152                    )
153                ;
154                builder = builder.set_block_device_mappings(var_12);
155            }
156            ,
157            s if s.matches("InstanceMonitoring") /* InstanceMonitoring com.amazonaws.autoscaling#LaunchConfiguration$InstanceMonitoring */ =>  {
158                let var_13 =
159                    Some(
160                        crate::protocol_serde::shape_instance_monitoring::de_instance_monitoring(&mut tag)
161                        ?
162                    )
163                ;
164                builder = builder.set_instance_monitoring(var_13);
165            }
166            ,
167            s if s.matches("SpotPrice") /* SpotPrice com.amazonaws.autoscaling#LaunchConfiguration$SpotPrice */ =>  {
168                let var_14 =
169                    Some(
170                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
171                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
172                            .into()
173                        )
174                        ?
175                    )
176                ;
177                builder = builder.set_spot_price(var_14);
178            }
179            ,
180            s if s.matches("IamInstanceProfile") /* IamInstanceProfile com.amazonaws.autoscaling#LaunchConfiguration$IamInstanceProfile */ =>  {
181                let var_15 =
182                    Some(
183                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
184                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
185                            .into()
186                        )
187                        ?
188                    )
189                ;
190                builder = builder.set_iam_instance_profile(var_15);
191            }
192            ,
193            s if s.matches("CreatedTime") /* CreatedTime com.amazonaws.autoscaling#LaunchConfiguration$CreatedTime */ =>  {
194                let var_16 =
195                    Some(
196                        ::aws_smithy_types::DateTime::from_str(
197                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
198                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
199                        )
200                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.autoscaling#TimestampType`)"))
201                        ?
202                    )
203                ;
204                builder = builder.set_created_time(var_16);
205            }
206            ,
207            s if s.matches("EbsOptimized") /* EbsOptimized com.amazonaws.autoscaling#LaunchConfiguration$EbsOptimized */ =>  {
208                let var_17 =
209                    Some(
210                         {
211                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
212                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
213                            )
214                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.autoscaling#EbsOptimized`)"))
215                        }
216                        ?
217                    )
218                ;
219                builder = builder.set_ebs_optimized(var_17);
220            }
221            ,
222            s if s.matches("AssociatePublicIpAddress") /* AssociatePublicIpAddress com.amazonaws.autoscaling#LaunchConfiguration$AssociatePublicIpAddress */ =>  {
223                let var_18 =
224                    Some(
225                         {
226                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
227                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
228                            )
229                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.autoscaling#AssociatePublicIpAddress`)"))
230                        }
231                        ?
232                    )
233                ;
234                builder = builder.set_associate_public_ip_address(var_18);
235            }
236            ,
237            s if s.matches("PlacementTenancy") /* PlacementTenancy com.amazonaws.autoscaling#LaunchConfiguration$PlacementTenancy */ =>  {
238                let var_19 =
239                    Some(
240                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
241                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
242                            .into()
243                        )
244                        ?
245                    )
246                ;
247                builder = builder.set_placement_tenancy(var_19);
248            }
249            ,
250            s if s.matches("MetadataOptions") /* MetadataOptions com.amazonaws.autoscaling#LaunchConfiguration$MetadataOptions */ =>  {
251                let var_20 =
252                    Some(
253                        crate::protocol_serde::shape_instance_metadata_options::de_instance_metadata_options(&mut tag)
254                        ?
255                    )
256                ;
257                builder = builder.set_metadata_options(var_20);
258            }
259            ,
260            _ => {}
261        }
262    }
263    Ok(crate::serde_util::launch_configuration_correct_errors(builder).build())
264}