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