1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:516 */
|
2 3 | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ProtocolParserGenerator.kt:99 */
|
3 5 | pub fn de_http_prefix_headers_http_error(
|
4 6 | _response_status: u16,
|
5 7 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 8 | _response_body: &[u8],
|
7 9 | ) -> std::result::Result<crate::operation::http_prefix_headers::HttpPrefixHeadersOutput, crate::operation::http_prefix_headers::HttpPrefixHeadersError>
|
8 10 | {
|
11 + | /* RustType.kt:516 */
|
9 12 | #[allow(unused_mut)]
|
13 + | /* ProtocolParserGenerator.kt:106 */
|
10 14 | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
11 15 | .map_err(crate::operation::http_prefix_headers::HttpPrefixHeadersError::unhandled)?;
|
16 + | /* ProtocolParserGenerator.kt:120 */
|
12 17 | let generic = generic_builder.build();
|
18 + | /* ProtocolParserGenerator.kt:185 */
|
13 19 | Err(crate::operation::http_prefix_headers::HttpPrefixHeadersError::generic(generic))
|
20 + | /* ProtocolParserGenerator.kt:99 */
|
14 21 | }
|
15 22 |
|
23 + | /* RustType.kt:516 */
|
16 24 | #[allow(clippy::unnecessary_wraps)]
|
25 + | /* ProtocolParserGenerator.kt:71 */
|
17 26 | pub fn de_http_prefix_headers_http_response(
|
18 27 | _response_status: u16,
|
19 28 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
20 29 | _response_body: &[u8],
|
21 30 | ) -> std::result::Result<crate::operation::http_prefix_headers::HttpPrefixHeadersOutput, crate::operation::http_prefix_headers::HttpPrefixHeadersError>
|
22 31 | {
|
32 + | /* ProtocolParserGenerator.kt:77 */
|
23 33 | Ok({
|
34 + | /* RustType.kt:516 */
|
24 35 | #[allow(unused_mut)]
|
36 + | /* ProtocolParserGenerator.kt:240 */
|
25 37 | 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"))?,
|
38 + | /* ProtocolParserGenerator.kt:267 */
|
39 + | output =
|
40 + | output.set_foo(
|
41 + | /* ProtocolParserGenerator.kt:302 */
|
42 + | crate::protocol_serde::shape_http_prefix_headers_output::de_foo_header(_response_headers).map_err(|_| {
|
43 + | crate::operation::http_prefix_headers::HttpPrefixHeadersError::unhandled("Failed to parse foo from header `X-Foo")
|
44 + | })?, /* ProtocolParserGenerator.kt:267 */
|
29 45 | );
|
46 + | /* ProtocolParserGenerator.kt:267 */
|
30 47 | output = output.set_foo_map(
|
48 + | /* ProtocolParserGenerator.kt:337 */
|
31 49 | crate::protocol_serde::shape_http_prefix_headers_output::de_foo_map_prefix_header(_response_headers).map_err(|_| {
|
32 50 | crate::operation::http_prefix_headers::HttpPrefixHeadersError::unhandled("Failed to parse fooMap from prefix header `X-Foo-")
|
33 - | })?,
|
51 + | })?, /* ProtocolParserGenerator.kt:267 */
|
34 52 | );
|
53 + | /* ClientBuilderInstantiator.kt:56 */
|
35 54 | output.build()
|
55 + | /* ProtocolParserGenerator.kt:77 */
|
36 56 | })
|
57 + | /* ProtocolParserGenerator.kt:71 */
|
37 58 | }
|
38 59 |
|
60 + | /* HttpBindingGenerator.kt:542 */
|
39 61 | pub fn ser_http_prefix_headers_headers(
|
40 62 | input: &crate::operation::http_prefix_headers::HttpPrefixHeadersInput,
|
41 63 | mut builder: ::http::request::Builder,
|
42 64 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
65 + | /* HttpBindingGenerator.kt:592 */
|
43 66 | if let ::std::option::Option::Some(inner_1) = &input.foo {
|
67 + | /* HttpBindingGenerator.kt:704 */
|
44 68 | let formatted_2 = inner_1.as_str();
|
69 + | /* HttpBindingGenerator.kt:706 */
|
45 70 | let header_value = formatted_2;
|
46 71 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
47 72 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
48 73 | "foo",
|
49 74 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
50 75 | )
|
51 76 | })?;
|
52 77 | builder = builder.header("X-Foo", header_value);
|
78 + | /* HttpBindingGenerator.kt:592 */
|
53 79 | }
|
80 + | /* HttpBindingGenerator.kt:741 */
|
54 81 | if let ::std::option::Option::Some(inner_3) = &input.foo_map {
|
82 + | /* HttpBindingGenerator.kt:741 */
|
55 83 | {
|
84 + | /* HttpBindingGenerator.kt:747 */
|
56 85 | for (k, v) in inner_3 {
|
57 86 | use std::str::FromStr;
|
58 87 | let header_name = http::header::HeaderName::from_str(&format!("{}{}", "X-Foo-", &k)).map_err(|err| {
|
59 88 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
60 89 | "foo_map",
|
61 90 | format!("`{k}` cannot be used as a header name: {err}"),
|
62 91 | )
|
63 92 | })?;
|
64 93 | let header_value = v.as_str();
|
65 94 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
66 95 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
67 96 | "foo_map",
|
68 97 | format!("`{}` cannot be used as a header value: {}", v, err),
|
69 98 | )
|
70 99 | })?;
|
71 100 | builder = builder.header(header_name, header_value);
|
72 101 | }
|
102 + | /* HttpBindingGenerator.kt:741 */
|
73 103 | }
|
104 + | /* HttpBindingGenerator.kt:741 */
|
74 105 | }
|
106 + | /* HttpBindingGenerator.kt:555 */
|
75 107 | Ok(builder)
|
108 + | /* HttpBindingGenerator.kt:542 */
|
76 109 | }
|