aws_sdk_ec2/protocol_serde/
shape_import_image_task.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_import_image_task(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::ImportImageTask, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::ImportImageTask::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("architecture") /* Architecture com.amazonaws.ec2#ImportImageTask$Architecture */ =>  {
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_architecture(var_1);
21            }
22            ,
23            s if s.matches("description") /* Description com.amazonaws.ec2#ImportImageTask$Description */ =>  {
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_description(var_2);
34            }
35            ,
36            s if s.matches("encrypted") /* Encrypted com.amazonaws.ec2#ImportImageTask$Encrypted */ =>  {
37                let var_3 =
38                    Some(
39                         {
40                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
41                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            )
43                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
44                        }
45                        ?
46                    )
47                ;
48                builder = builder.set_encrypted(var_3);
49            }
50            ,
51            s if s.matches("hypervisor") /* Hypervisor com.amazonaws.ec2#ImportImageTask$Hypervisor */ =>  {
52                let var_4 =
53                    Some(
54                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
55                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
56                            .into()
57                        )
58                        ?
59                    )
60                ;
61                builder = builder.set_hypervisor(var_4);
62            }
63            ,
64            s if s.matches("imageId") /* ImageId com.amazonaws.ec2#ImportImageTask$ImageId */ =>  {
65                let var_5 =
66                    Some(
67                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
68                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
69                            .into()
70                        )
71                        ?
72                    )
73                ;
74                builder = builder.set_image_id(var_5);
75            }
76            ,
77            s if s.matches("importTaskId") /* ImportTaskId com.amazonaws.ec2#ImportImageTask$ImportTaskId */ =>  {
78                let var_6 =
79                    Some(
80                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
81                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
82                            .into()
83                        )
84                        ?
85                    )
86                ;
87                builder = builder.set_import_task_id(var_6);
88            }
89            ,
90            s if s.matches("kmsKeyId") /* KmsKeyId com.amazonaws.ec2#ImportImageTask$KmsKeyId */ =>  {
91                let var_7 =
92                    Some(
93                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
94                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
95                            .into()
96                        )
97                        ?
98                    )
99                ;
100                builder = builder.set_kms_key_id(var_7);
101            }
102            ,
103            s if s.matches("licenseType") /* LicenseType com.amazonaws.ec2#ImportImageTask$LicenseType */ =>  {
104                let var_8 =
105                    Some(
106                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
107                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
108                            .into()
109                        )
110                        ?
111                    )
112                ;
113                builder = builder.set_license_type(var_8);
114            }
115            ,
116            s if s.matches("platform") /* Platform com.amazonaws.ec2#ImportImageTask$Platform */ =>  {
117                let var_9 =
118                    Some(
119                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
120                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
121                            .into()
122                        )
123                        ?
124                    )
125                ;
126                builder = builder.set_platform(var_9);
127            }
128            ,
129            s if s.matches("progress") /* Progress com.amazonaws.ec2#ImportImageTask$Progress */ =>  {
130                let var_10 =
131                    Some(
132                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
133                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
134                            .into()
135                        )
136                        ?
137                    )
138                ;
139                builder = builder.set_progress(var_10);
140            }
141            ,
142            s if s.matches("snapshotDetailSet") /* SnapshotDetails com.amazonaws.ec2#ImportImageTask$SnapshotDetails */ =>  {
143                let var_11 =
144                    Some(
145                        crate::protocol_serde::shape_snapshot_detail_list::de_snapshot_detail_list(&mut tag)
146                        ?
147                    )
148                ;
149                builder = builder.set_snapshot_details(var_11);
150            }
151            ,
152            s if s.matches("status") /* Status com.amazonaws.ec2#ImportImageTask$Status */ =>  {
153                let var_12 =
154                    Some(
155                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
156                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
157                            .into()
158                        )
159                        ?
160                    )
161                ;
162                builder = builder.set_status(var_12);
163            }
164            ,
165            s if s.matches("statusMessage") /* StatusMessage com.amazonaws.ec2#ImportImageTask$StatusMessage */ =>  {
166                let var_13 =
167                    Some(
168                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
169                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
170                            .into()
171                        )
172                        ?
173                    )
174                ;
175                builder = builder.set_status_message(var_13);
176            }
177            ,
178            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#ImportImageTask$Tags */ =>  {
179                let var_14 =
180                    Some(
181                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
182                        ?
183                    )
184                ;
185                builder = builder.set_tags(var_14);
186            }
187            ,
188            s if s.matches("licenseSpecifications") /* LicenseSpecifications com.amazonaws.ec2#ImportImageTask$LicenseSpecifications */ =>  {
189                let var_15 =
190                    Some(
191                        crate::protocol_serde::shape_import_image_license_specification_list_response::de_import_image_license_specification_list_response(&mut tag)
192                        ?
193                    )
194                ;
195                builder = builder.set_license_specifications(var_15);
196            }
197            ,
198            s if s.matches("usageOperation") /* UsageOperation com.amazonaws.ec2#ImportImageTask$UsageOperation */ =>  {
199                let var_16 =
200                    Some(
201                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
202                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
203                            .into()
204                        )
205                        ?
206                    )
207                ;
208                builder = builder.set_usage_operation(var_16);
209            }
210            ,
211            s if s.matches("bootMode") /* BootMode com.amazonaws.ec2#ImportImageTask$BootMode */ =>  {
212                let var_17 =
213                    Some(
214                        Result::<crate::types::BootModeValues, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
215                            crate::types::BootModeValues::from(
216                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
217                            )
218                        )
219                        ?
220                    )
221                ;
222                builder = builder.set_boot_mode(var_17);
223            }
224            ,
225            _ => {}
226        }
227    }
228    Ok(builder.build())
229}