aws_sdk_ec2/protocol_serde/
shape_export_image.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_export_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::export_image::ExportImageOutput, crate::operation::export_image::ExportImageError> {
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::export_image::ExportImageError::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::export_image::ExportImageError::generic(generic))
14}
15
16#[allow(clippy::unnecessary_wraps)]
17pub fn de_export_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::export_image::ExportImageOutput, crate::operation::export_image::ExportImageError> {
22 Ok({
23 #[allow(unused_mut)]
24 let mut output = crate::operation::export_image::builders::ExportImageOutputBuilder::default();
25 output = crate::protocol_serde::shape_export_image::de_export_image(_response_body, output)
26 .map_err(crate::operation::export_image::ExportImageError::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_export_image(
34 inp: &[u8],
35 mut builder: crate::operation::export_image::builders::ExportImageOutputBuilder,
36) -> std::result::Result<crate::operation::export_image::builders::ExportImageOutputBuilder, ::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("ExportImageResponse")) {
44 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
45 "invalid root, expected ExportImageResponse 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("description") => {
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_description(var_1);
62 }
63 ,
64 s if s.matches("diskImageFormat") => {
65 let var_2 =
66 Some(
67 Result::<crate::types::DiskImageFormat, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
68 crate::types::DiskImageFormat::from(
69 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
70 )
71 )
72 ?
73 )
74 ;
75 builder = builder.set_disk_image_format(var_2);
76 }
77 ,
78 s if s.matches("exportImageTaskId") => {
79 let var_3 =
80 Some(
81 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
82 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
83 .into()
84 )
85 ?
86 )
87 ;
88 builder = builder.set_export_image_task_id(var_3);
89 }
90 ,
91 s if s.matches("imageId") => {
92 let var_4 =
93 Some(
94 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
95 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
96 .into()
97 )
98 ?
99 )
100 ;
101 builder = builder.set_image_id(var_4);
102 }
103 ,
104 s if s.matches("roleName") => {
105 let var_5 =
106 Some(
107 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
108 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
109 .into()
110 )
111 ?
112 )
113 ;
114 builder = builder.set_role_name(var_5);
115 }
116 ,
117 s if s.matches("progress") => {
118 let var_6 =
119 Some(
120 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
121 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
122 .into()
123 )
124 ?
125 )
126 ;
127 builder = builder.set_progress(var_6);
128 }
129 ,
130 s if s.matches("s3ExportLocation") => {
131 let var_7 =
132 Some(
133 crate::protocol_serde::shape_export_task_s3_location::de_export_task_s3_location(&mut tag)
134 ?
135 )
136 ;
137 builder = builder.set_s3_export_location(var_7);
138 }
139 ,
140 s if s.matches("status") => {
141 let var_8 =
142 Some(
143 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
144 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
145 .into()
146 )
147 ?
148 )
149 ;
150 builder = builder.set_status(var_8);
151 }
152 ,
153 s if s.matches("statusMessage") => {
154 let var_9 =
155 Some(
156 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
157 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
158 .into()
159 )
160 ?
161 )
162 ;
163 builder = builder.set_status_message(var_9);
164 }
165 ,
166 s if s.matches("tagSet") => {
167 let var_10 =
168 Some(
169 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
170 ?
171 )
172 ;
173 builder = builder.set_tags(var_10);
174 }
175 ,
176 _ => {}
177 }
178 }
179 Ok(builder)
180}