aws_sdk_ec2/protocol_serde/
shape_describe_image_attribute.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_describe_image_attribute_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<
8 crate::operation::describe_image_attribute::DescribeImageAttributeOutput,
9 crate::operation::describe_image_attribute::DescribeImageAttributeError,
10> {
11 #[allow(unused_mut)]
12 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
13 .map_err(crate::operation::describe_image_attribute::DescribeImageAttributeError::unhandled)?;
14 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15 let generic = generic_builder.build();
16 Err(crate::operation::describe_image_attribute::DescribeImageAttributeError::generic(generic))
17}
18
19#[allow(clippy::unnecessary_wraps)]
20pub fn de_describe_image_attribute_http_response(
21 _response_status: u16,
22 _response_headers: &::aws_smithy_runtime_api::http::Headers,
23 _response_body: &[u8],
24) -> std::result::Result<
25 crate::operation::describe_image_attribute::DescribeImageAttributeOutput,
26 crate::operation::describe_image_attribute::DescribeImageAttributeError,
27> {
28 Ok({
29 #[allow(unused_mut)]
30 let mut output = crate::operation::describe_image_attribute::builders::DescribeImageAttributeOutputBuilder::default();
31 output = crate::protocol_serde::shape_describe_image_attribute::de_describe_image_attribute(_response_body, output)
32 .map_err(crate::operation::describe_image_attribute::DescribeImageAttributeError::unhandled)?;
33 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
34 output.build()
35 })
36}
37
38#[allow(unused_mut)]
39pub fn de_describe_image_attribute(
40 inp: &[u8],
41 mut builder: crate::operation::describe_image_attribute::builders::DescribeImageAttributeOutputBuilder,
42) -> std::result::Result<
43 crate::operation::describe_image_attribute::builders::DescribeImageAttributeOutputBuilder,
44 ::aws_smithy_xml::decode::XmlDecodeError,
45> {
46 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
47
48 #[allow(unused_mut)]
49 let mut decoder = doc.root_element()?;
50 #[allow(unused_variables)]
51 let start_el = decoder.start_el();
52 if !(start_el.matches("DescribeImageAttributeResponse")) {
53 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
54 "invalid root, expected DescribeImageAttributeResponse got {:?}",
55 start_el
56 )));
57 }
58 while let Some(mut tag) = decoder.next_tag() {
59 match tag.start_el() {
60 s if s.matches("description") => {
61 let var_1 =
62 Some(
63 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
64 ?
65 )
66 ;
67 builder = builder.set_description(var_1);
68 }
69 ,
70 s if s.matches("kernel") => {
71 let var_2 =
72 Some(
73 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
74 ?
75 )
76 ;
77 builder = builder.set_kernel_id(var_2);
78 }
79 ,
80 s if s.matches("ramdisk") => {
81 let var_3 =
82 Some(
83 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
84 ?
85 )
86 ;
87 builder = builder.set_ramdisk_id(var_3);
88 }
89 ,
90 s if s.matches("sriovNetSupport") => {
91 let var_4 =
92 Some(
93 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
94 ?
95 )
96 ;
97 builder = builder.set_sriov_net_support(var_4);
98 }
99 ,
100 s if s.matches("bootMode") => {
101 let var_5 =
102 Some(
103 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
104 ?
105 )
106 ;
107 builder = builder.set_boot_mode(var_5);
108 }
109 ,
110 s if s.matches("tpmSupport") => {
111 let var_6 =
112 Some(
113 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
114 ?
115 )
116 ;
117 builder = builder.set_tpm_support(var_6);
118 }
119 ,
120 s if s.matches("uefiData") => {
121 let var_7 =
122 Some(
123 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
124 ?
125 )
126 ;
127 builder = builder.set_uefi_data(var_7);
128 }
129 ,
130 s if s.matches("lastLaunchedTime") => {
131 let var_8 =
132 Some(
133 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
134 ?
135 )
136 ;
137 builder = builder.set_last_launched_time(var_8);
138 }
139 ,
140 s if s.matches("imdsSupport") => {
141 let var_9 =
142 Some(
143 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
144 ?
145 )
146 ;
147 builder = builder.set_imds_support(var_9);
148 }
149 ,
150 s if s.matches("deregistrationProtection") => {
151 let var_10 =
152 Some(
153 crate::protocol_serde::shape_attribute_value::de_attribute_value(&mut tag)
154 ?
155 )
156 ;
157 builder = builder.set_deregistration_protection(var_10);
158 }
159 ,
160 s if s.matches("imageId") => {
161 let var_11 =
162 Some(
163 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
164 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
165 .into()
166 )
167 ?
168 )
169 ;
170 builder = builder.set_image_id(var_11);
171 }
172 ,
173 s if s.matches("launchPermission") => {
174 let var_12 =
175 Some(
176 crate::protocol_serde::shape_launch_permission_list::de_launch_permission_list(&mut tag)
177 ?
178 )
179 ;
180 builder = builder.set_launch_permissions(var_12);
181 }
182 ,
183 s if s.matches("productCodes") => {
184 let var_13 =
185 Some(
186 crate::protocol_serde::shape_product_code_list::de_product_code_list(&mut tag)
187 ?
188 )
189 ;
190 builder = builder.set_product_codes(var_13);
191 }
192 ,
193 s if s.matches("blockDeviceMapping") => {
194 let var_14 =
195 Some(
196 crate::protocol_serde::shape_block_device_mapping_list::de_block_device_mapping_list(&mut tag)
197 ?
198 )
199 ;
200 builder = builder.set_block_device_mappings(var_14);
201 }
202 ,
203 _ => {}
204 }
205 }
206 Ok(builder)
207}