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_null_and_empty_headers_client_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<
|
8 10 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientOutput,
|
9 11 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError,
|
10 12 | > {
|
13 + | /* RustType.kt:516 */
|
11 14 | #[allow(unused_mut)]
|
15 + | /* ProtocolParserGenerator.kt:106 */
|
12 16 | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
13 17 | .map_err(crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled)?;
|
18 + | /* ProtocolParserGenerator.kt:120 */
|
14 19 | let generic = generic_builder.build();
|
20 + | /* ProtocolParserGenerator.kt:185 */
|
15 21 | Err(crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::generic(
|
16 22 | generic,
|
17 23 | ))
|
24 + | /* ProtocolParserGenerator.kt:99 */
|
18 25 | }
|
19 26 |
|
27 + | /* RustType.kt:516 */
|
20 28 | #[allow(clippy::unnecessary_wraps)]
|
29 + | /* ProtocolParserGenerator.kt:71 */
|
21 30 | pub fn de_null_and_empty_headers_client_http_response(
|
22 31 | _response_status: u16,
|
23 32 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
24 33 | _response_body: &[u8],
|
25 34 | ) -> std::result::Result<
|
26 35 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientOutput,
|
27 36 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError,
|
28 37 | > {
|
38 + | /* ProtocolParserGenerator.kt:77 */
|
29 39 | Ok({
|
40 + | /* RustType.kt:516 */
|
30 41 | #[allow(unused_mut)]
|
42 + | /* ProtocolParserGenerator.kt:240 */
|
31 43 | let mut output = crate::operation::null_and_empty_headers_client::builders::NullAndEmptyHeadersClientOutputBuilder::default();
|
44 + | /* ProtocolParserGenerator.kt:267 */
|
32 45 | output = output.set_a(
|
46 + | /* ProtocolParserGenerator.kt:302 */
|
33 47 | crate::protocol_serde::shape_null_and_empty_headers_client_output::de_a_header(_response_headers).map_err(|_| {
|
34 48 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled("Failed to parse a from header `X-A")
|
35 - | })?,
|
49 + | })?, /* ProtocolParserGenerator.kt:267 */
|
36 50 | );
|
51 + | /* ProtocolParserGenerator.kt:267 */
|
37 52 | output = output.set_b(
|
53 + | /* ProtocolParserGenerator.kt:302 */
|
38 54 | crate::protocol_serde::shape_null_and_empty_headers_client_output::de_b_header(_response_headers).map_err(|_| {
|
39 55 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled("Failed to parse b from header `X-B")
|
40 - | })?,
|
56 + | })?, /* ProtocolParserGenerator.kt:267 */
|
41 57 | );
|
58 + | /* ProtocolParserGenerator.kt:267 */
|
42 59 | output = output.set_c(
|
60 + | /* ProtocolParserGenerator.kt:302 */
|
43 61 | crate::protocol_serde::shape_null_and_empty_headers_client_output::de_c_header(_response_headers).map_err(|_| {
|
44 62 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled("Failed to parse c from header `X-C")
|
45 - | })?,
|
63 + | })?, /* ProtocolParserGenerator.kt:267 */
|
46 64 | );
|
65 + | /* ClientBuilderInstantiator.kt:56 */
|
47 66 | output.build()
|
67 + | /* ProtocolParserGenerator.kt:77 */
|
48 68 | })
|
69 + | /* ProtocolParserGenerator.kt:71 */
|
49 70 | }
|
50 71 |
|
72 + | /* HttpBindingGenerator.kt:542 */
|
51 73 | pub fn ser_null_and_empty_headers_client_headers(
|
52 74 | input: &crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientInput,
|
53 75 | mut builder: ::http::request::Builder,
|
54 76 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
77 + | /* HttpBindingGenerator.kt:592 */
|
55 78 | if let ::std::option::Option::Some(inner_1) = &input.a {
|
79 + | /* HttpBindingGenerator.kt:704 */
|
56 80 | let formatted_2 = inner_1.as_str();
|
81 + | /* HttpBindingGenerator.kt:706 */
|
57 82 | let header_value = formatted_2;
|
58 83 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
59 84 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
60 85 | "a",
|
61 86 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
62 87 | )
|
63 88 | })?;
|
64 89 | builder = builder.header("X-A", header_value);
|
90 + | /* HttpBindingGenerator.kt:592 */
|
65 91 | }
|
92 + | /* HttpBindingGenerator.kt:592 */
|
66 93 | if let ::std::option::Option::Some(inner_3) = &input.b {
|
94 + | /* HttpBindingGenerator.kt:704 */
|
67 95 | let formatted_4 = inner_3.as_str();
|
96 + | /* HttpBindingGenerator.kt:706 */
|
68 97 | let header_value = formatted_4;
|
69 98 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
70 99 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
71 100 | "b",
|
72 101 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
73 102 | )
|
74 103 | })?;
|
75 104 | builder = builder.header("X-B", header_value);
|
105 + | /* HttpBindingGenerator.kt:592 */
|
76 106 | }
|
107 + | /* HttpBindingGenerator.kt:592 */
|
77 108 | if let ::std::option::Option::Some(inner_5) = &input.c {
|
78 - | // Empty vec in header is serialized as an empty string
|
109 + | /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
|
79 110 | if inner_5.is_empty() {
|
80 111 | builder = builder.header("X-C", "");
|
81 112 | } else {
|
113 + | /* HttpBindingGenerator.kt:646 */
|
82 114 | for inner_6 in inner_5 {
|
115 + | /* HttpBindingGenerator.kt:704 */
|
83 116 | let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
|
117 + | /* HttpBindingGenerator.kt:706 */
|
84 118 | let header_value = formatted_7;
|
85 119 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
86 120 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
87 121 | "c",
|
88 122 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
89 123 | )
|
90 124 | })?;
|
91 125 | builder = builder.header("X-C", header_value);
|
126 + | /* HttpBindingGenerator.kt:646 */
|
92 127 | }
|
128 + | /* HttpBindingGenerator.kt:638 */
|
93 129 | }
|
130 + | /* HttpBindingGenerator.kt:592 */
|
94 131 | }
|
132 + | /* HttpBindingGenerator.kt:555 */
|
95 133 | Ok(builder)
|
134 + | /* HttpBindingGenerator.kt:542 */
|
96 135 | }
|