1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:534 */
|
3 + | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ServerHttpBoundProtocolGenerator.kt:412 */
|
5 + | pub async fn de_input_stream_with_initial_request_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http_1x::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::InputStreamWithInitialRequestInput,
|
9 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
10 + | >
|
11 + | where
|
12 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
13 + | B: ::http_body_1x::Body<Data = ::bytes::Bytes>
|
14 + | + ::std::marker::Send
|
15 + | + ::std::marker::Sync
|
16 + | + 'static,
|
17 + | B::Error: Into<::aws_smithy_types::body::Error> + 'static,
|
18 + |
|
19 + | B::Data: Send,
|
20 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
21 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
22 + | {
|
23 + | /* ServerHttpBoundProtocolGenerator.kt:428 */
|
24 + | Ok({
|
25 + | /* RustType.kt:534 */
|
26 + | #[allow(unused_mut)]
|
27 + | /* ServerHttpBoundProtocolGenerator.kt:773 */
|
28 + | let mut input = crate::input::input_stream_with_initial_request_input::Builder::default();
|
29 + | /* RustType.kt:534 */
|
30 + | #[allow(unused_variables)]
|
31 + | /* ServerHttpBoundProtocolGenerator.kt:778 */
|
32 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
33 + | uri, headers, body, ..
|
34 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
35 + | /* ServerHttpBoundProtocolGenerator.kt:870 */
|
36 + | if let Some(value) = crate::protocol_serde::shape_input_stream_with_initial_request_input::de_initial_request_member_header(&headers)? {
|
37 + | input = input.set_initial_request_member(value)
|
38 + | }
|
39 + | /* ServerHttpBoundProtocolGenerator.kt:870 */
|
40 + | if let Some(value) = {
|
41 + | let mut receiver = crate::protocol_serde::shape_input_stream_with_initial_request_input::de_stream_payload(&mut ::aws_smithy_types::body::SdkBody::from_body_1_x(body))?;
|
42 + | if let Some(_initial_event) = receiver
|
43 + | .try_recv_initial(::aws_smithy_http::event_stream::InitialMessageType::Request)
|
44 + | .await
|
45 + | .map_err(
|
46 + | |ev_error| ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::ConstraintViolation(
|
47 + | #[allow(clippy::useless_conversion)]
|
48 + | format!("{ev_error}").into()
|
49 + | )
|
50 + | )? {
|
51 + |
|
52 + | }
|
53 + | Some(receiver)
|
54 + | } {
|
55 + | input = input.set_stream(value)
|
56 + | }
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:910 */
|
58 + | input.build()?
|
59 + | /* ServerHttpBoundProtocolGenerator.kt:428 */
|
60 + | })
|
61 + | /* ServerHttpBoundProtocolGenerator.kt:412 */
|
62 + | }
|
63 + |
|
64 + | /* RustType.kt:534 */
|
65 + | #[allow(clippy::unnecessary_wraps)]
|
66 + | /* ServerHttpBoundProtocolGenerator.kt:449 */
|
67 + | pub fn ser_input_stream_with_initial_request_http_response(
|
68 + | #[allow(unused_variables)] output: crate::output::InputStreamWithInitialRequestOutput,
|
69 + | ) -> std::result::Result<
|
70 + | ::aws_smithy_http_server::response::Response,
|
71 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
72 + | > {
|
73 + | /* ServerHttpBoundProtocolGenerator.kt:461 */
|
74 + | Ok({
|
75 + | /* RustType.kt:534 */
|
76 + | #[allow(unused_mut)]
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:551 */
|
78 + | let mut builder = ::http_1x::Response::builder();
|
79 + | /* ServerHttpBoundProtocolGenerator.kt:647 */
|
80 + | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
81 + | builder,
|
82 + | ::http_1x::header::CONTENT_TYPE,
|
83 + | "application/json",
|
84 + | );
|
85 + | /* ServerHttpBoundProtocolGenerator.kt:732 */
|
86 + | let http_status: u16 = 200;
|
87 + | builder = builder.status(http_status);
|
88 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
89 + | let payload =
|
90 + | /* HttpBoundProtocolPayloadGenerator.kt:238 */""
|
91 + | /* ServerHttpBoundProtocolGenerator.kt:611 */;
|
92 + | /* ServerHttpBoundProtocolGenerator.kt:713 */
|
93 + | let content_length = payload.len();
|
94 + | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
95 + | builder,
|
96 + | ::http_1x::header::CONTENT_LENGTH,
|
97 + | content_length,
|
98 + | );
|
99 + | /* ServerHttpBoundProtocolGenerator.kt:617 */
|
100 + | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:625 */
|
102 + | builder.body(body)?
|
103 + | /* ServerHttpBoundProtocolGenerator.kt:461 */
|
104 + | })
|
105 + | /* ServerHttpBoundProtocolGenerator.kt:449 */
|
106 + | }
|
107 + |
|
108 + | /* RustType.kt:534 */
|
109 + | #[allow(clippy::unnecessary_wraps)]
|
110 + | /* ServerHttpBoundProtocolGenerator.kt:475 */
|
111 + | pub fn ser_input_stream_with_initial_request_http_error(
|
112 + | error: &crate::error::InputStreamWithInitialRequestError,
|
113 + | ) -> std::result::Result<
|
114 + | ::aws_smithy_http_server::response::Response,
|
115 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
116 + | > {
|
117 + | /* ServerHttpBoundProtocolGenerator.kt:480 */
|
118 + | Ok({
|
119 + | /* ServerHttpBoundProtocolGenerator.kt:496 */
|
120 + | match error {
|
121 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
122 + | crate::error::InputStreamWithInitialRequestError::ValidationException(output) => {
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:505 */
|
124 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
125 + | /* RustType.kt:534 */
|
126 + | #[allow(unused_mut)]
|
127 + | /* ServerHttpBoundProtocolGenerator.kt:515 */
|
128 + | let mut builder = ::http_1x::Response::builder();
|
129 + | /* ServerHttpBoundProtocolGenerator.kt:647 */
|
130 + | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
131 + | builder,
|
132 + | ::http_1x::header::CONTENT_TYPE,
|
133 + | "application/json",
|
134 + | );
|
135 + | /* ServerHttpBoundProtocolGenerator.kt:647 */
|
136 + | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
137 + | builder,
|
138 + | ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
|
139 + | "ValidationException",
|
140 + | );
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:713 */
|
142 + | let content_length = payload.len();
|
143 + | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
144 + | builder,
|
145 + | ::http_1x::header::CONTENT_LENGTH,
|
146 + | content_length,
|
147 + | );
|
148 + | /* ServerHttpBoundProtocolGenerator.kt:532 */
|
149 + | builder
|
150 + | .status(400)
|
151 + | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
152 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
153 + | }
|
154 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
155 + | crate::error::InputStreamWithInitialRequestError::ErrorEvent(output) => {
|
156 + | /* ServerHttpBoundProtocolGenerator.kt:505 */
|
157 + | let payload =
|
158 + | crate::protocol_serde::shape_error_event::ser_error_event_error(output)?;
|
159 + | /* RustType.kt:534 */
|
160 + | #[allow(unused_mut)]
|
161 + | /* ServerHttpBoundProtocolGenerator.kt:515 */
|
162 + | let mut builder = ::http_1x::Response::builder();
|
163 + | /* ServerHttpBoundProtocolGenerator.kt:647 */
|
164 + | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
165 + | builder,
|
166 + | ::http_1x::header::CONTENT_TYPE,
|
167 + | "application/json",
|
168 + | );
|
169 + | /* ServerHttpBoundProtocolGenerator.kt:647 */
|
170 + | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
171 + | builder,
|
172 + | ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
|
173 + | "ErrorEvent",
|
174 + | );
|
175 + | /* ServerHttpBoundProtocolGenerator.kt:713 */
|
176 + | let content_length = payload.len();
|
177 + | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
178 + | builder,
|
179 + | ::http_1x::header::CONTENT_LENGTH,
|
180 + | content_length,
|
181 + | );
|
182 + | /* ServerHttpBoundProtocolGenerator.kt:532 */
|
183 + | builder
|
184 + | .status(400)
|
185 + | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
186 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
187 + | } /* ServerHttpBoundProtocolGenerator.kt:496 */
|
188 + | }
|
189 + | /* ServerHttpBoundProtocolGenerator.kt:480 */
|
190 + | })
|
191 + | /* ServerHttpBoundProtocolGenerator.kt:475 */
|
192 + | }
|