1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_http_prefix_headers_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::http_prefix_headers::HttpPrefixHeadersOutput, crate::operation::http_prefix_headers::HttpPrefixHeadersError>
|
8 - | {
|
9 - | #[allow(unused_mut)]
|
10 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
11 - | .map_err(crate::operation::http_prefix_headers::HttpPrefixHeadersError::unhandled)?;
|
12 - | let generic = generic_builder.build();
|
13 - | Err(crate::operation::http_prefix_headers::HttpPrefixHeadersError::generic(generic))
|
14 - | }
|
15 - |
|
16 - | #[allow(clippy::unnecessary_wraps)]
|
17 - | pub fn de_http_prefix_headers_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::http_prefix_headers::HttpPrefixHeadersOutput, crate::operation::http_prefix_headers::HttpPrefixHeadersError>
|
22 - | {
|
23 - | Ok({
|
24 - | #[allow(unused_mut)]
|
25 - | let mut output = crate::operation::http_prefix_headers::builders::HttpPrefixHeadersOutputBuilder::default();
|
26 - | output = output.set_foo(
|
27 - | crate::protocol_serde::shape_http_prefix_headers_output::de_foo_header(_response_headers)
|
28 - | .map_err(|_| crate::operation::http_prefix_headers::HttpPrefixHeadersError::unhandled("Failed to parse foo from header `x-foo"))?,
|
29 - | );
|
30 - | output = output.set_foo_map(
|
31 - | crate::protocol_serde::shape_http_prefix_headers_output::de_foo_map_prefix_header(_response_headers).map_err(|_| {
|
32 - | crate::operation::http_prefix_headers::HttpPrefixHeadersError::unhandled("Failed to parse fooMap from prefix header `x-foo-")
|
33 - | })?,
|
34 - | );
|
35 - | output.build()
|
36 - | })
|
37 - | }
|
38 - |
|
39 - | pub fn ser_http_prefix_headers_headers(
|
40 - | input: &crate::operation::http_prefix_headers::HttpPrefixHeadersInput,
|
41 - | mut builder: ::http_1x::request::Builder,
|
42 - | ) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
43 - | if let ::std::option::Option::Some(inner_1) = &input.foo {
|
44 - | let formatted_2 = inner_1.as_str();
|
45 - | let header_value = formatted_2;
|
46 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
47 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
48 - | "foo",
|
49 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
50 - | )
|
51 - | })?;
|
52 - | builder = builder.header("x-foo", header_value);
|
53 - | }
|
54 - | if let ::std::option::Option::Some(inner_3) = &input.foo_map {
|
55 - | {
|
56 - | for (k, v) in inner_3 {
|
57 - | use std::str::FromStr;
|
58 - | let header_name = ::http_1x::HeaderName::from_str(&format!("{}{}", "x-foo-", &k)).map_err(|err| {
|
59 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
60 - | "foo_map",
|
61 - | format!("`{k}` cannot be used as a header name: {err}"),
|
62 - | )
|
63 - | })?;
|
64 - | let header_value = v.as_str();
|
65 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
66 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
67 - | "foo_map",
|
68 - | format!("`{v}` cannot be used as a header value: {err}"),
|
69 - | )
|
70 - | })?;
|
71 - | builder = builder.header(header_name, header_value);
|
72 - | }
|
73 - | }
|
74 - | }
|
75 - | Ok(builder)
|
76 - | }
|