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 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
3 5 | pub async fn de_http_prefix_headers_targeting_length_map_operation_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::HttpPrefixHeadersTargetingLengthMapOperationInput,
|
7 9 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
8 10 | >
|
9 11 | where
|
10 12 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11 13 | B::Data: Send,
|
12 14 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 15 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
14 16 | {
|
17 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
15 18 | Ok({
|
19 + | /* RustType.kt:516 */
|
16 20 | #[allow(unused_mut)]
|
17 - | let mut input = crate::input::http_prefix_headers_targeting_length_map_operation_input_internal::Builder::default();
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:723 */let mut input = crate::input::http_prefix_headers_targeting_length_map_operation_input_internal::Builder::default();
|
22 + | /* RustType.kt:516 */
|
18 23 | #[allow(unused_variables)]
|
24 + | /* ServerHttpBoundProtocolGenerator.kt:728 */
|
19 25 | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 26 | uri, headers, body, ..
|
21 27 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
28 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
22 29 | if let Some(value) = crate::protocol_serde::shape_http_prefix_headers_targeting_length_map_operation_input::de_length_map_prefix_header(&headers)? {
|
23 30 | input = input.set_length_map(Some(value))
|
24 31 | }
|
32 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
25 33 | input.build()?
|
34 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
26 35 | })
|
36 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
27 37 | }
|
28 38 |
|
39 + | /* RustType.kt:516 */
|
29 40 | #[allow(clippy::unnecessary_wraps)]
|
41 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
30 42 | pub fn ser_http_prefix_headers_targeting_length_map_operation_http_response(
|
31 43 | #[allow(unused_variables)]
|
32 44 | output: crate::output::HttpPrefixHeadersTargetingLengthMapOperationOutput,
|
33 45 | ) -> std::result::Result<
|
34 46 | ::aws_smithy_http_server::response::Response,
|
35 47 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
36 48 | > {
|
49 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
37 50 | Ok({
|
51 + | /* RustType.kt:516 */
|
38 52 | #[allow(unused_mut)]
|
53 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
39 54 | let mut builder = ::http::Response::builder();
|
55 + | /* ServerHttpBoundProtocolGenerator.kt:629 */
|
40 56 | builder = crate::protocol_serde::shape_http_prefix_headers_targeting_length_map_operation::ser_http_prefix_headers_targeting_length_map_operation_headers(&output, builder)?;
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
41 58 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
42 59 | builder,
|
43 60 | ::http::header::CONTENT_TYPE,
|
44 61 | "application/json",
|
45 62 | );
|
63 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
46 64 | let http_status: u16 = 200;
|
47 65 | builder = builder.status(http_status);
|
66 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
48 67 | let payload =
|
49 - | crate::protocol_serde::shape_http_prefix_headers_targeting_length_map_operation_output::ser_http_prefix_headers_targeting_length_map_operation_output_output_output(&output)?
|
50 - | ;
|
68 + | /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_http_prefix_headers_targeting_length_map_operation_output::ser_http_prefix_headers_targeting_length_map_operation_output_output_output(&output)?
|
69 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
70 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
51 71 | let content_length = payload.len();
|
52 72 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
53 73 | builder,
|
54 74 | ::http::header::CONTENT_LENGTH,
|
55 75 | content_length,
|
56 76 | );
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
57 78 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
79 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
58 80 | builder.body(body)?
|
81 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
59 82 | })
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
60 84 | }
|
61 85 |
|
86 + | /* RustType.kt:516 */
|
62 87 | #[allow(clippy::unnecessary_wraps)]
|
88 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
63 89 | pub fn ser_http_prefix_headers_targeting_length_map_operation_http_error(
|
64 90 | error: &crate::error::HttpPrefixHeadersTargetingLengthMapOperationError,
|
65 91 | ) -> std::result::Result<
|
66 92 | ::aws_smithy_http_server::response::Response,
|
67 93 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
68 94 | > {
|
95 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
69 96 | Ok({
|
97 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
70 98 | match error {
|
71 - | crate::error::HttpPrefixHeadersTargetingLengthMapOperationError::ValidationException(output) => {
|
72 - | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
73 - | #[allow(unused_mut)]
|
74 - | let mut builder = ::http::Response::builder();
|
75 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
99 + | /* ServerHttpBoundProtocolGenerator.kt:476 */crate::error::HttpPrefixHeadersTargetingLengthMapOperationError::ValidationException(output) => {
|
100 + | /* ServerHttpBoundProtocolGenerator.kt:477 */let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
101 + | /* RustType.kt:516 */#[allow(unused_mut)]
|
102 + | /* ServerHttpBoundProtocolGenerator.kt:487 */let mut builder = ::http::Response::builder();
|
103 + | /* ServerHttpBoundProtocolGenerator.kt:597 */builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
76 104 | builder,
|
77 105 | ::http::header::CONTENT_TYPE,
|
78 106 | "application/json",
|
79 107 | );
|
80 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
108 + | /* ServerHttpBoundProtocolGenerator.kt:597 */builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
81 109 | builder,
|
82 110 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
83 111 | "ValidationException",
|
84 112 | );
|
85 - | let content_length = payload.len();
|
113 + | /* ServerHttpBoundProtocolGenerator.kt:663 */let content_length = payload.len();
|
86 114 | builder = ::aws_smithy_http::header::set_response_header_if_absent(builder, ::http::header::CONTENT_LENGTH, content_length);
|
87 - | builder.status(400).body(::aws_smithy_http_server::body::to_boxed(payload))?
|
88 - | }
|
89 - | crate::error::HttpPrefixHeadersTargetingLengthMapOperationError::InternalServerError(output) => {
|
90 - | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
91 - | #[allow(unused_mut)]
|
92 - | let mut builder = ::http::Response::builder();
|
93 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
115 + | /* ServerHttpBoundProtocolGenerator.kt:504 */builder.status(400).body(::aws_smithy_http_server::body::to_boxed(payload))?
|
116 + | /* ServerHttpBoundProtocolGenerator.kt:476 */}
|
117 + | /* ServerHttpBoundProtocolGenerator.kt:476 */crate::error::HttpPrefixHeadersTargetingLengthMapOperationError::InternalServerError(output) => {
|
118 + | /* ServerHttpBoundProtocolGenerator.kt:477 */let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
119 + | /* RustType.kt:516 */#[allow(unused_mut)]
|
120 + | /* ServerHttpBoundProtocolGenerator.kt:487 */let mut builder = ::http::Response::builder();
|
121 + | /* ServerHttpBoundProtocolGenerator.kt:597 */builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
94 122 | builder,
|
95 123 | ::http::header::CONTENT_TYPE,
|
96 124 | "application/json",
|
97 125 | );
|
98 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
126 + | /* ServerHttpBoundProtocolGenerator.kt:597 */builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
99 127 | builder,
|
100 128 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
101 129 | "InternalServerError",
|
102 130 | );
|
103 - | let content_length = payload.len();
|
131 + | /* ServerHttpBoundProtocolGenerator.kt:663 */let content_length = payload.len();
|
104 132 | builder = ::aws_smithy_http::header::set_response_header_if_absent(builder, ::http::header::CONTENT_LENGTH, content_length);
|
105 - | builder.status(500).body(::aws_smithy_http_server::body::to_boxed(payload))?
|
106 - | }
|
107 - | }
|
133 + | /* ServerHttpBoundProtocolGenerator.kt:504 */builder.status(500).body(::aws_smithy_http_server::body::to_boxed(payload))?
|
134 + | /* ServerHttpBoundProtocolGenerator.kt:476 */}
|
135 + | /* ServerHttpBoundProtocolGenerator.kt:468 */}
|
136 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
108 137 | })
|
138 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
109 139 | }
|
110 140 |
|
141 + | /* HttpBindingGenerator.kt:542 */
|
111 142 | pub fn ser_http_prefix_headers_targeting_length_map_operation_headers(
|
112 143 | input: &crate::output::HttpPrefixHeadersTargetingLengthMapOperationOutput,
|
113 144 | mut builder: ::http::response::Builder,
|
114 145 | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
115 146 | {
|
147 + | /* HttpBindingGenerator.kt:741 */
|
116 148 | if let ::std::option::Option::Some(inner_1) = &input.length_map {
|
149 + | /* HttpBindingGenerator.kt:741 */
|
117 150 | {
|
151 + | /* HttpBindingGenerator.kt:747 */
|
118 152 | for (k, v) in inner_1 {
|
119 153 | use std::str::FromStr;
|
120 154 | let header_name = http::header::HeaderName::from_str(&format!(
|
121 155 | "{}{}",
|
122 156 | "X-Prefix-Headers-LengthMap-", &k
|
123 157 | ))
|
124 158 | .map_err(|err| {
|
125 159 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
126 160 | "length_map",
|
127 161 | format!("`{k}` cannot be used as a header name: {err}"),
|
128 162 | )
|
129 163 | })?;
|
130 164 | let header_value = v.as_str();
|
131 165 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
132 166 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
133 167 | "length_map",
|
134 168 | format!("`{}` cannot be used as a header value: {}", v, err),
|
135 169 | )
|
136 170 | })?;
|
137 171 | builder = builder.header(header_name, header_value);
|
138 172 | }
|
173 + | /* HttpBindingGenerator.kt:741 */
|
139 174 | }
|
175 + | /* HttpBindingGenerator.kt:741 */
|
140 176 | }
|
177 + | /* HttpBindingGenerator.kt:555 */
|
141 178 | Ok(builder)
|
179 + | /* HttpBindingGenerator.kt:542 */
|
142 180 | }
|