aws_sdk_ec2/protocol_serde/
shape_import_image.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_import_image_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<crate::operation::import_image::ImportImageOutput, crate::operation::import_image::ImportImageError> {
8 #[allow(unused_mut)]
9 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
10 .map_err(crate::operation::import_image::ImportImageError::unhandled)?;
11 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
12 let generic = generic_builder.build();
13 Err(crate::operation::import_image::ImportImageError::generic(generic))
14}
15
16#[allow(clippy::unnecessary_wraps)]
17pub fn de_import_image_http_response(
18 _response_status: u16,
19 _response_headers: &::aws_smithy_runtime_api::http::Headers,
20 _response_body: &[u8],
21) -> std::result::Result<crate::operation::import_image::ImportImageOutput, crate::operation::import_image::ImportImageError> {
22 Ok({
23 #[allow(unused_mut)]
24 let mut output = crate::operation::import_image::builders::ImportImageOutputBuilder::default();
25 output = crate::protocol_serde::shape_import_image::de_import_image(_response_body, output)
26 .map_err(crate::operation::import_image::ImportImageError::unhandled)?;
27 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
28 output.build()
29 })
30}
31
32#[allow(unused_mut)]
33pub fn de_import_image(
34 inp: &[u8],
35 mut builder: crate::operation::import_image::builders::ImportImageOutputBuilder,
36) -> std::result::Result<crate::operation::import_image::builders::ImportImageOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError> {
37 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
38
39 #[allow(unused_mut)]
40 let mut decoder = doc.root_element()?;
41 #[allow(unused_variables)]
42 let start_el = decoder.start_el();
43 if !(start_el.matches("ImportImageResponse")) {
44 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
45 "invalid root, expected ImportImageResponse got {:?}",
46 start_el
47 )));
48 }
49 while let Some(mut tag) = decoder.next_tag() {
50 match tag.start_el() {
51 s if s.matches("architecture") => {
52 let var_1 =
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_architecture(var_1);
62 }
63 ,
64 s if s.matches("description") => {
65 let var_2 =
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_description(var_2);
75 }
76 ,
77 s if s.matches("encrypted") => {
78 let var_3 =
79 Some(
80 {
81 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
82 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
83 )
84 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
85 }
86 ?
87 )
88 ;
89 builder = builder.set_encrypted(var_3);
90 }
91 ,
92 s if s.matches("hypervisor") => {
93 let var_4 =
94 Some(
95 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
96 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
97 .into()
98 )
99 ?
100 )
101 ;
102 builder = builder.set_hypervisor(var_4);
103 }
104 ,
105 s if s.matches("imageId") => {
106 let var_5 =
107 Some(
108 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
109 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
110 .into()
111 )
112 ?
113 )
114 ;
115 builder = builder.set_image_id(var_5);
116 }
117 ,
118 s if s.matches("importTaskId") => {
119 let var_6 =
120 Some(
121 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
122 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
123 .into()
124 )
125 ?
126 )
127 ;
128 builder = builder.set_import_task_id(var_6);
129 }
130 ,
131 s if s.matches("kmsKeyId") => {
132 let var_7 =
133 Some(
134 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
135 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
136 .into()
137 )
138 ?
139 )
140 ;
141 builder = builder.set_kms_key_id(var_7);
142 }
143 ,
144 s if s.matches("licenseType") => {
145 let var_8 =
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_license_type(var_8);
155 }
156 ,
157 s if s.matches("platform") => {
158 let var_9 =
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_platform(var_9);
168 }
169 ,
170 s if s.matches("progress") => {
171 let var_10 =
172 Some(
173 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
174 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
175 .into()
176 )
177 ?
178 )
179 ;
180 builder = builder.set_progress(var_10);
181 }
182 ,
183 s if s.matches("snapshotDetailSet") => {
184 let var_11 =
185 Some(
186 crate::protocol_serde::shape_snapshot_detail_list::de_snapshot_detail_list(&mut tag)
187 ?
188 )
189 ;
190 builder = builder.set_snapshot_details(var_11);
191 }
192 ,
193 s if s.matches("status") => {
194 let var_12 =
195 Some(
196 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
197 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
198 .into()
199 )
200 ?
201 )
202 ;
203 builder = builder.set_status(var_12);
204 }
205 ,
206 s if s.matches("statusMessage") => {
207 let var_13 =
208 Some(
209 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
210 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
211 .into()
212 )
213 ?
214 )
215 ;
216 builder = builder.set_status_message(var_13);
217 }
218 ,
219 s if s.matches("licenseSpecifications") => {
220 let var_14 =
221 Some(
222 crate::protocol_serde::shape_import_image_license_specification_list_response::de_import_image_license_specification_list_response(&mut tag)
223 ?
224 )
225 ;
226 builder = builder.set_license_specifications(var_14);
227 }
228 ,
229 s if s.matches("tagSet") => {
230 let var_15 =
231 Some(
232 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
233 ?
234 )
235 ;
236 builder = builder.set_tags(var_15);
237 }
238 ,
239 s if s.matches("usageOperation") => {
240 let var_16 =
241 Some(
242 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
243 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
244 .into()
245 )
246 ?
247 )
248 ;
249 builder = builder.set_usage_operation(var_16);
250 }
251 ,
252 _ => {}
253 }
254 }
255 Ok(builder)
256}