aws_sdk_ec2/protocol_serde/
shape_launch_specification.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_specification(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::LaunchSpecification, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::LaunchSpecification::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("userData") /* UserData com.amazonaws.ec2#LaunchSpecification$UserData */ =>  {
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_user_data(var_1);
21            }
22            ,
23            s if s.matches("addressingType") /* AddressingType com.amazonaws.ec2#LaunchSpecification$AddressingType */ =>  {
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_addressing_type(var_2);
34            }
35            ,
36            s if s.matches("blockDeviceMapping") /* BlockDeviceMappings com.amazonaws.ec2#LaunchSpecification$BlockDeviceMappings */ =>  {
37                let var_3 =
38                    Some(
39                        crate::protocol_serde::shape_block_device_mapping_list::de_block_device_mapping_list(&mut tag)
40                        ?
41                    )
42                ;
43                builder = builder.set_block_device_mappings(var_3);
44            }
45            ,
46            s if s.matches("ebsOptimized") /* EbsOptimized com.amazonaws.ec2#LaunchSpecification$EbsOptimized */ =>  {
47                let var_4 =
48                    Some(
49                         {
50                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
51                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
52                            )
53                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
54                        }
55                        ?
56                    )
57                ;
58                builder = builder.set_ebs_optimized(var_4);
59            }
60            ,
61            s if s.matches("iamInstanceProfile") /* IamInstanceProfile com.amazonaws.ec2#LaunchSpecification$IamInstanceProfile */ =>  {
62                let var_5 =
63                    Some(
64                        crate::protocol_serde::shape_iam_instance_profile_specification::de_iam_instance_profile_specification(&mut tag)
65                        ?
66                    )
67                ;
68                builder = builder.set_iam_instance_profile(var_5);
69            }
70            ,
71            s if s.matches("imageId") /* ImageId com.amazonaws.ec2#LaunchSpecification$ImageId */ =>  {
72                let var_6 =
73                    Some(
74                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
75                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
76                            .into()
77                        )
78                        ?
79                    )
80                ;
81                builder = builder.set_image_id(var_6);
82            }
83            ,
84            s if s.matches("instanceType") /* InstanceType com.amazonaws.ec2#LaunchSpecification$InstanceType */ =>  {
85                let var_7 =
86                    Some(
87                        Result::<crate::types::InstanceType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
88                            crate::types::InstanceType::from(
89                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
90                            )
91                        )
92                        ?
93                    )
94                ;
95                builder = builder.set_instance_type(var_7);
96            }
97            ,
98            s if s.matches("kernelId") /* KernelId com.amazonaws.ec2#LaunchSpecification$KernelId */ =>  {
99                let var_8 =
100                    Some(
101                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
102                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
103                            .into()
104                        )
105                        ?
106                    )
107                ;
108                builder = builder.set_kernel_id(var_8);
109            }
110            ,
111            s if s.matches("keyName") /* KeyName com.amazonaws.ec2#LaunchSpecification$KeyName */ =>  {
112                let var_9 =
113                    Some(
114                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
115                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
116                            .into()
117                        )
118                        ?
119                    )
120                ;
121                builder = builder.set_key_name(var_9);
122            }
123            ,
124            s if s.matches("networkInterfaceSet") /* NetworkInterfaces com.amazonaws.ec2#LaunchSpecification$NetworkInterfaces */ =>  {
125                let var_10 =
126                    Some(
127                        crate::protocol_serde::shape_instance_network_interface_specification_list::de_instance_network_interface_specification_list(&mut tag)
128                        ?
129                    )
130                ;
131                builder = builder.set_network_interfaces(var_10);
132            }
133            ,
134            s if s.matches("placement") /* Placement com.amazonaws.ec2#LaunchSpecification$Placement */ =>  {
135                let var_11 =
136                    Some(
137                        crate::protocol_serde::shape_spot_placement::de_spot_placement(&mut tag)
138                        ?
139                    )
140                ;
141                builder = builder.set_placement(var_11);
142            }
143            ,
144            s if s.matches("ramdiskId") /* RamdiskId com.amazonaws.ec2#LaunchSpecification$RamdiskId */ =>  {
145                let var_12 =
146                    Some(
147                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
148                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
149                            .into()
150                        )
151                        ?
152                    )
153                ;
154                builder = builder.set_ramdisk_id(var_12);
155            }
156            ,
157            s if s.matches("subnetId") /* SubnetId com.amazonaws.ec2#LaunchSpecification$SubnetId */ =>  {
158                let var_13 =
159                    Some(
160                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
161                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
162                            .into()
163                        )
164                        ?
165                    )
166                ;
167                builder = builder.set_subnet_id(var_13);
168            }
169            ,
170            s if s.matches("groupSet") /* SecurityGroups com.amazonaws.ec2#LaunchSpecification$SecurityGroups */ =>  {
171                let var_14 =
172                    Some(
173                        crate::protocol_serde::shape_group_identifier_list::de_group_identifier_list(&mut tag)
174                        ?
175                    )
176                ;
177                builder = builder.set_security_groups(var_14);
178            }
179            ,
180            s if s.matches("monitoring") /* Monitoring com.amazonaws.ec2#LaunchSpecification$Monitoring */ =>  {
181                let var_15 =
182                    Some(
183                        crate::protocol_serde::shape_run_instances_monitoring_enabled::de_run_instances_monitoring_enabled(&mut tag)
184                        ?
185                    )
186                ;
187                builder = builder.set_monitoring(var_15);
188            }
189            ,
190            _ => {}
191        }
192    }
193    Ok(builder.build())
194}