1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_input_and_output_with_headers_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::input_and_output_with_headers::InputAndOutputWithHeadersOutput,
|
9 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError,
|
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::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled)?;
|
14 - | let generic = generic_builder.build();
|
15 - | Err(crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::generic(
|
16 - | generic,
|
17 - | ))
|
18 - | }
|
19 - |
|
20 - | #[allow(clippy::unnecessary_wraps)]
|
21 - | pub fn de_input_and_output_with_headers_http_response(
|
22 - | _response_status: u16,
|
23 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
24 - | _response_body: &[u8],
|
25 - | ) -> std::result::Result<
|
26 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersOutput,
|
27 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError,
|
28 - | > {
|
29 - | Ok({
|
30 - | #[allow(unused_mut)]
|
31 - | let mut output = crate::operation::input_and_output_with_headers::builders::InputAndOutputWithHeadersOutputBuilder::default();
|
32 - | output = output.set_header_boolean_list(
|
33 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_boolean_list_header(_response_headers).map_err(|_| {
|
34 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
35 - | "Failed to parse headerBooleanList from header `X-BooleanList",
|
36 - | )
|
37 - | })?,
|
38 - | );
|
39 - | output = output.set_header_byte(
|
40 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_byte_header(_response_headers).map_err(|_| {
|
41 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
42 - | "Failed to parse headerByte from header `X-Byte",
|
43 - | )
|
44 - | })?,
|
45 - | );
|
46 - | output = output.set_header_double(
|
47 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_double_header(_response_headers).map_err(|_| {
|
48 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
49 - | "Failed to parse headerDouble from header `X-Double",
|
50 - | )
|
51 - | })?,
|
52 - | );
|
53 - | output = output.set_header_enum(
|
54 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_enum_header(_response_headers).map_err(|_| {
|
55 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
56 - | "Failed to parse headerEnum from header `X-Enum",
|
57 - | )
|
58 - | })?,
|
59 - | );
|
60 - | output = output.set_header_enum_list(
|
61 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_enum_list_header(_response_headers).map_err(|_| {
|
62 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
63 - | "Failed to parse headerEnumList from header `X-EnumList",
|
64 - | )
|
65 - | })?,
|
66 - | );
|
67 - | output = output.set_header_false_bool(
|
68 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_false_bool_header(_response_headers).map_err(|_| {
|
69 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
70 - | "Failed to parse headerFalseBool from header `X-Boolean2",
|
71 - | )
|
72 - | })?,
|
73 - | );
|
74 - | output = output.set_header_float(
|
75 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_float_header(_response_headers).map_err(|_| {
|
76 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
77 - | "Failed to parse headerFloat from header `X-Float",
|
78 - | )
|
79 - | })?,
|
80 - | );
|
81 - | output = output.set_header_integer(
|
82 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_header(_response_headers).map_err(|_| {
|
83 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
84 - | "Failed to parse headerInteger from header `X-Integer",
|
85 - | )
|
86 - | })?,
|
87 - | );
|
88 - | output = output.set_header_integer_enum(
|
89 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_enum_header(_response_headers).map_err(|_| {
|
90 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
91 - | "Failed to parse headerIntegerEnum from header `X-IntegerEnum",
|
92 - | )
|
93 - | })?,
|
94 - | );
|
95 - | output = output.set_header_integer_enum_list(
|
96 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_enum_list_header(_response_headers).map_err(
|
97 - | |_| {
|
98 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
99 - | "Failed to parse headerIntegerEnumList from header `X-IntegerEnumList",
|
100 - | )
|
101 - | },
|
102 - | )?,
|
103 - | );
|
104 - | output = output.set_header_integer_list(
|
105 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_list_header(_response_headers).map_err(|_| {
|
106 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
107 - | "Failed to parse headerIntegerList from header `X-IntegerList",
|
108 - | )
|
109 - | })?,
|
110 - | );
|
111 - | output = output.set_header_long(
|
112 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_long_header(_response_headers).map_err(|_| {
|
113 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
114 - | "Failed to parse headerLong from header `X-Long",
|
115 - | )
|
116 - | })?,
|
117 - | );
|
118 - | output = output.set_header_short(
|
119 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_short_header(_response_headers).map_err(|_| {
|
120 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
121 - | "Failed to parse headerShort from header `X-Short",
|
122 - | )
|
123 - | })?,
|
124 - | );
|
125 - | output = output.set_header_string(
|
126 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_string_header(_response_headers).map_err(|_| {
|
127 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
128 - | "Failed to parse headerString from header `X-String",
|
129 - | )
|
130 - | })?,
|
131 - | );
|
132 - | output = output.set_header_string_list(
|
133 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_string_list_header(_response_headers).map_err(|_| {
|
134 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
135 - | "Failed to parse headerStringList from header `X-StringList",
|
136 - | )
|
137 - | })?,
|
138 - | );
|
139 - | output = output.set_header_string_set(
|
140 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_string_set_header(_response_headers).map_err(|_| {
|
141 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
142 - | "Failed to parse headerStringSet from header `X-StringSet",
|
143 - | )
|
144 - | })?,
|
145 - | );
|
146 - | output = output.set_header_timestamp_list(
|
147 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_timestamp_list_header(_response_headers).map_err(|_| {
|
148 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
149 - | "Failed to parse headerTimestampList from header `X-TimestampList",
|
150 - | )
|
151 - | })?,
|
152 - | );
|
153 - | output = output.set_header_true_bool(
|
154 - | crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_true_bool_header(_response_headers).map_err(|_| {
|
155 - | crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
|
156 - | "Failed to parse headerTrueBool from header `X-Boolean1",
|
157 - | )
|
158 - | })?,
|
159 - | );
|
160 - | output.build()
|
161 - | })
|
162 - | }
|
163 - |
|
164 - | pub fn ser_input_and_output_with_headers_headers(
|
165 - | input: &crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersInput,
|
166 - | mut builder: ::http_1x::request::Builder,
|
167 - | ) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
168 - | if let ::std::option::Option::Some(inner_1) = &input.header_string {
|
169 - | let formatted_2 = inner_1.as_str();
|
170 - | let header_value = formatted_2;
|
171 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
172 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
173 - | "header_string",
|
174 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
175 - | )
|
176 - | })?;
|
177 - | builder = builder.header("X-String", header_value);
|
178 - | }
|
179 - | if let ::std::option::Option::Some(inner_3) = &input.header_byte {
|
180 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
|
181 - | let formatted_4 = encoder.encode();
|
182 - | let header_value = formatted_4;
|
183 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
184 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
185 - | "header_byte",
|
186 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
187 - | )
|
188 - | })?;
|
189 - | builder = builder.header("X-Byte", header_value);
|
190 - | }
|
191 - | if let ::std::option::Option::Some(inner_5) = &input.header_short {
|
192 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_5);
|
193 - | let formatted_6 = encoder.encode();
|
194 - | let header_value = formatted_6;
|
195 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
196 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
197 - | "header_short",
|
198 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
199 - | )
|
200 - | })?;
|
201 - | builder = builder.header("X-Short", header_value);
|
202 - | }
|
203 - | if let ::std::option::Option::Some(inner_7) = &input.header_integer {
|
204 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_7);
|
205 - | let formatted_8 = encoder.encode();
|
206 - | let header_value = formatted_8;
|
207 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
208 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
209 - | "header_integer",
|
210 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
211 - | )
|
212 - | })?;
|
213 - | builder = builder.header("X-Integer", header_value);
|
214 - | }
|
215 - | if let ::std::option::Option::Some(inner_9) = &input.header_long {
|
216 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_9);
|
217 - | let formatted_10 = encoder.encode();
|
218 - | let header_value = formatted_10;
|
219 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
220 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
221 - | "header_long",
|
222 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
223 - | )
|
224 - | })?;
|
225 - | builder = builder.header("X-Long", header_value);
|
226 - | }
|
227 - | if let ::std::option::Option::Some(inner_11) = &input.header_float {
|
228 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_11);
|
229 - | let formatted_12 = encoder.encode();
|
230 - | let header_value = formatted_12;
|
231 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
232 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
233 - | "header_float",
|
234 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
235 - | )
|
236 - | })?;
|
237 - | builder = builder.header("X-Float", header_value);
|
238 - | }
|
239 - | if let ::std::option::Option::Some(inner_13) = &input.header_double {
|
240 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_13);
|
241 - | let formatted_14 = encoder.encode();
|
242 - | let header_value = formatted_14;
|
243 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
244 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
245 - | "header_double",
|
246 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
247 - | )
|
248 - | })?;
|
249 - | builder = builder.header("X-Double", header_value);
|
250 - | }
|
251 - | if let ::std::option::Option::Some(inner_15) = &input.header_true_bool {
|
252 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_15);
|
253 - | let formatted_16 = encoder.encode();
|
254 - | let header_value = formatted_16;
|
255 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
256 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
257 - | "header_true_bool",
|
258 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
259 - | )
|
260 - | })?;
|
261 - | builder = builder.header("X-Boolean1", header_value);
|
262 - | }
|
263 - | if let ::std::option::Option::Some(inner_17) = &input.header_false_bool {
|
264 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_17);
|
265 - | let formatted_18 = encoder.encode();
|
266 - | let header_value = formatted_18;
|
267 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
268 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
269 - | "header_false_bool",
|
270 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
271 - | )
|
272 - | })?;
|
273 - | builder = builder.header("X-Boolean2", header_value);
|
274 - | }
|
275 - | if let ::std::option::Option::Some(inner_19) = &input.header_string_list {
|
276 - | // Empty vec in header is serialized as an empty string
|
277 - | if inner_19.is_empty() {
|
278 - | builder = builder.header("X-StringList", "");
|
279 - | } else {
|
280 - | for inner_20 in inner_19 {
|
281 - | let formatted_21 = ::aws_smithy_http::header::quote_header_value(inner_20.as_str());
|
282 - | let header_value = formatted_21;
|
283 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
284 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
285 - | "header_string_list",
|
286 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
287 - | )
|
288 - | })?;
|
289 - | builder = builder.header("X-StringList", header_value);
|
290 - | }
|
291 - | }
|
292 - | }
|
293 - | if let ::std::option::Option::Some(inner_22) = &input.header_string_set {
|
294 - | // Empty vec in header is serialized as an empty string
|
295 - | if inner_22.is_empty() {
|
296 - | builder = builder.header("X-StringSet", "");
|
297 - | } else {
|
298 - | for inner_23 in inner_22 {
|
299 - | let formatted_24 = ::aws_smithy_http::header::quote_header_value(inner_23.as_str());
|
300 - | let header_value = formatted_24;
|
301 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
302 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
303 - | "header_string_set",
|
304 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
305 - | )
|
306 - | })?;
|
307 - | builder = builder.header("X-StringSet", header_value);
|
308 - | }
|
309 - | }
|
310 - | }
|
311 - | if let ::std::option::Option::Some(inner_25) = &input.header_integer_list {
|
312 - | // Empty vec in header is serialized as an empty string
|
313 - | if inner_25.is_empty() {
|
314 - | builder = builder.header("X-IntegerList", "");
|
315 - | } else {
|
316 - | for inner_26 in inner_25 {
|
317 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
|
318 - | let formatted_27 = encoder.encode();
|
319 - | let header_value = formatted_27;
|
320 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
321 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
322 - | "header_integer_list",
|
323 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
324 - | )
|
325 - | })?;
|
326 - | builder = builder.header("X-IntegerList", header_value);
|
327 - | }
|
328 - | }
|
329 - | }
|
330 - | if let ::std::option::Option::Some(inner_28) = &input.header_boolean_list {
|
331 - | // Empty vec in header is serialized as an empty string
|
332 - | if inner_28.is_empty() {
|
333 - | builder = builder.header("X-BooleanList", "");
|
334 - | } else {
|
335 - | for inner_29 in inner_28 {
|
336 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
|
337 - | let formatted_30 = encoder.encode();
|
338 - | let header_value = formatted_30;
|
339 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
340 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
341 - | "header_boolean_list",
|
342 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
343 - | )
|
344 - | })?;
|
345 - | builder = builder.header("X-BooleanList", header_value);
|
346 - | }
|
347 - | }
|
348 - | }
|
349 - | if let ::std::option::Option::Some(inner_31) = &input.header_timestamp_list {
|
350 - | // Empty vec in header is serialized as an empty string
|
351 - | if inner_31.is_empty() {
|
352 - | builder = builder.header("X-TimestampList", "");
|
353 - | } else {
|
354 - | for inner_32 in inner_31 {
|
355 - | let formatted_33 = inner_32.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
356 - | let header_value = formatted_33;
|
357 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
358 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
359 - | "header_timestamp_list",
|
360 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
361 - | )
|
362 - | })?;
|
363 - | builder = builder.header("X-TimestampList", header_value);
|
364 - | }
|
365 - | }
|
366 - | }
|
367 - | if let ::std::option::Option::Some(inner_34) = &input.header_enum {
|
368 - | let formatted_35 = inner_34.as_str();
|
369 - | let header_value = formatted_35;
|
370 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
371 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
372 - | "header_enum",
|
373 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
374 - | )
|
375 - | })?;
|
376 - | builder = builder.header("X-Enum", header_value);
|
377 - | }
|
378 - | if let ::std::option::Option::Some(inner_36) = &input.header_enum_list {
|
379 - | // Empty vec in header is serialized as an empty string
|
380 - | if inner_36.is_empty() {
|
381 - | builder = builder.header("X-EnumList", "");
|
382 - | } else {
|
383 - | for inner_37 in inner_36 {
|
384 - | let formatted_38 = ::aws_smithy_http::header::quote_header_value(inner_37.as_str());
|
385 - | let header_value = formatted_38;
|
386 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
387 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
388 - | "header_enum_list",
|
389 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
390 - | )
|
391 - | })?;
|
392 - | builder = builder.header("X-EnumList", header_value);
|
393 - | }
|
394 - | }
|
395 - | }
|
396 - | if let ::std::option::Option::Some(inner_39) = &input.header_integer_enum {
|
397 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_39);
|
398 - | let formatted_40 = encoder.encode();
|
399 - | let header_value = formatted_40;
|
400 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
401 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
402 - | "header_integer_enum",
|
403 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
404 - | )
|
405 - | })?;
|
406 - | builder = builder.header("X-IntegerEnum", header_value);
|
407 - | }
|
408 - | if let ::std::option::Option::Some(inner_41) = &input.header_integer_enum_list {
|
409 - | // Empty vec in header is serialized as an empty string
|
410 - | if inner_41.is_empty() {
|
411 - | builder = builder.header("X-IntegerEnumList", "");
|
412 - | } else {
|
413 - | for inner_42 in inner_41 {
|
414 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_42);
|
415 - | let formatted_43 = encoder.encode();
|
416 - | let header_value = formatted_43;
|
417 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
418 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
419 - | "header_integer_enum_list",
|
420 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
421 - | )
|
422 - | })?;
|
423 - | builder = builder.header("X-IntegerEnumList", header_value);
|
424 - | }
|
425 - | }
|
426 - | }
|
427 - | Ok(builder)
|
428 - | }
|