1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:534 */
|
2 3 | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
3 5 | pub async fn de_greeting_with_errors_http_request<B>(
|
4 - | #[allow(unused_variables)] request: ::http::Request<B>,
|
6 + | #[allow(unused_variables)] request: ::http_1x::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::GreetingWithErrorsInput,
|
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:424 */
|
15 18 | Ok({
|
19 + | /* RustType.kt:534 */
|
16 20 | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
17 22 | let mut input = crate::input::greeting_with_errors_input::Builder::default();
|
23 + | /* RustType.kt:534 */
|
18 24 | #[allow(unused_variables)]
|
25 + | /* ServerHttpBoundProtocolGenerator.kt:764 */
|
19 26 | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 27 | uri, headers, body, ..
|
21 28 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:873 */
|
22 30 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
|
31 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
23 32 | input.build()
|
33 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
24 34 | })
|
35 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
25 36 | }
|
26 37 |
|
38 + | /* RustType.kt:534 */
|
27 39 | #[allow(clippy::unnecessary_wraps)]
|
40 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
28 41 | pub fn ser_greeting_with_errors_http_response(
|
29 42 | #[allow(unused_variables)] output: crate::output::GreetingWithErrorsOutput,
|
30 43 | ) -> std::result::Result<
|
31 44 | ::aws_smithy_http_server::response::Response,
|
32 45 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
33 46 | > {
|
47 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
34 48 | Ok({
|
49 + | /* RustType.kt:534 */
|
35 50 | #[allow(unused_mut)]
|
36 - | let mut builder = ::http::Response::builder();
|
51 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
52 + | let mut builder = ::http_1x::Response::builder();
|
53 + | /* ServerHttpBoundProtocolGenerator.kt:665 */
|
37 54 | builder =
|
38 55 | crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_headers(
|
39 56 | &output, builder,
|
40 57 | )?;
|
58 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
41 59 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
42 60 | builder,
|
43 - | ::http::header::CONTENT_TYPE,
|
61 + | ::http_1x::header::CONTENT_TYPE,
|
44 62 | "application/json",
|
45 63 | );
|
64 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
46 65 | let http_status: u16 = 200;
|
47 66 | builder = builder.status(http_status);
|
67 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
48 68 | let payload =
|
49 - | crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output_output(&output)?
|
50 - | ;
|
69 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output_output(&output)?
|
70 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
71 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
51 72 | let content_length = payload.len();
|
52 73 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
53 74 | builder,
|
54 - | ::http::header::CONTENT_LENGTH,
|
75 + | ::http_1x::header::CONTENT_LENGTH,
|
55 76 | content_length,
|
56 77 | );
|
78 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
57 79 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
80 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
58 81 | builder.body(body)?
|
82 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
59 83 | })
|
84 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
60 85 | }
|
61 86 |
|
87 + | /* RustType.kt:534 */
|
62 88 | #[allow(clippy::unnecessary_wraps)]
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
63 90 | pub fn ser_greeting_with_errors_http_error(
|
64 91 | error: &crate::error::GreetingWithErrorsError,
|
65 92 | ) -> std::result::Result<
|
66 93 | ::aws_smithy_http_server::response::Response,
|
67 94 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
68 95 | > {
|
96 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
69 97 | Ok({
|
98 + | /* ServerHttpBoundProtocolGenerator.kt:492 */
|
70 99 | match error {
|
100 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
71 101 | crate::error::GreetingWithErrorsError::InvalidGreeting(output) => {
|
102 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
72 103 | let payload =
|
73 104 | crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting_error(
|
74 105 | output,
|
75 106 | )?;
|
107 + | /* RustType.kt:534 */
|
76 108 | #[allow(unused_mut)]
|
77 - | let mut builder = ::http::Response::builder();
|
109 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
110 + | let mut builder = ::http_1x::Response::builder();
|
111 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
78 112 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
79 113 | builder,
|
80 - | ::http::header::CONTENT_TYPE,
|
114 + | ::http_1x::header::CONTENT_TYPE,
|
81 115 | "application/json",
|
82 116 | );
|
117 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
83 118 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
84 119 | builder,
|
85 - | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
120 + | ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
|
86 121 | "InvalidGreeting",
|
87 122 | );
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
88 124 | let content_length = payload.len();
|
89 125 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
90 126 | builder,
|
91 - | ::http::header::CONTENT_LENGTH,
|
127 + | ::http_1x::header::CONTENT_LENGTH,
|
92 128 | content_length,
|
93 129 | );
|
130 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
94 131 | builder
|
95 132 | .status(400)
|
96 133 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
134 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
97 135 | }
|
136 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
98 137 | crate::error::GreetingWithErrorsError::ComplexError(output) => {
|
138 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
99 139 | let payload =
|
100 140 | crate::protocol_serde::shape_complex_error::ser_complex_error_error(output)?;
|
141 + | /* RustType.kt:534 */
|
101 142 | #[allow(unused_mut)]
|
102 - | let mut builder = ::http::Response::builder();
|
143 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
144 + | let mut builder = ::http_1x::Response::builder();
|
145 + | /* ServerHttpBoundProtocolGenerator.kt:665 */
|
103 146 | builder = crate::protocol_serde::shape_complex_error::ser_complex_error_headers(
|
104 147 | output, builder,
|
105 148 | )?;
|
149 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
106 150 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
107 151 | builder,
|
108 - | ::http::header::CONTENT_TYPE,
|
152 + | ::http_1x::header::CONTENT_TYPE,
|
109 153 | "application/json",
|
110 154 | );
|
155 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
111 156 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
112 157 | builder,
|
113 - | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
158 + | ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
|
114 159 | "ComplexError",
|
115 160 | );
|
161 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
116 162 | let content_length = payload.len();
|
117 163 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
118 164 | builder,
|
119 - | ::http::header::CONTENT_LENGTH,
|
165 + | ::http_1x::header::CONTENT_LENGTH,
|
120 166 | content_length,
|
121 167 | );
|
168 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
122 169 | builder
|
123 170 | .status(403)
|
124 171 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
172 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
125 173 | }
|
174 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
126 175 | crate::error::GreetingWithErrorsError::FooError(output) => {
|
176 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
127 177 | let payload = crate::protocol_serde::shape_foo_error::ser_foo_error_error(output)?;
|
178 + | /* RustType.kt:534 */
|
128 179 | #[allow(unused_mut)]
|
129 - | let mut builder = ::http::Response::builder();
|
180 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
181 + | let mut builder = ::http_1x::Response::builder();
|
182 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
130 183 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
131 184 | builder,
|
132 - | ::http::header::CONTENT_TYPE,
|
185 + | ::http_1x::header::CONTENT_TYPE,
|
133 186 | "application/json",
|
134 187 | );
|
188 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
135 189 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
136 190 | builder,
|
137 - | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
191 + | ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
|
138 192 | "FooError",
|
139 193 | );
|
194 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
140 195 | let content_length = payload.len();
|
141 196 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
142 197 | builder,
|
143 - | ::http::header::CONTENT_LENGTH,
|
198 + | ::http_1x::header::CONTENT_LENGTH,
|
144 199 | content_length,
|
145 200 | );
|
201 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
146 202 | builder
|
147 203 | .status(500)
|
148 204 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
149 - | }
|
205 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
206 + | } /* ServerHttpBoundProtocolGenerator.kt:492 */
|
150 207 | }
|
208 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
151 209 | })
|
210 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
152 211 | }
|
153 212 |
|
213 + | /* HttpBindingGenerator.kt:565 */
|
154 214 | pub fn ser_greeting_with_errors_headers(
|
155 215 | input: &crate::output::GreetingWithErrorsOutput,
|
156 - | mut builder: ::http::response::Builder,
|
157 - | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
158 - | {
|
216 + | mut builder: ::http_1x::response::Builder,
|
217 + | ) -> std::result::Result<
|
218 + | ::http_1x::response::Builder,
|
219 + | ::aws_smithy_types::error::operation::BuildError,
|
220 + | > {
|
221 + | /* HttpBindingGenerator.kt:615 */
|
159 222 | if let ::std::option::Option::Some(inner_1) = &input.greeting {
|
223 + | /* HttpBindingGenerator.kt:727 */
|
160 224 | let formatted_2 = inner_1.as_str();
|
225 + | /* HttpBindingGenerator.kt:728 */
|
161 226 | if !formatted_2.is_empty() {
|
227 + | /* HttpBindingGenerator.kt:729 */
|
162 228 | let header_value = formatted_2;
|
163 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
229 + | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
164 230 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
165 231 | "greeting",
|
166 232 | format!(
|
167 233 | "`{}` cannot be used as a header value: {}",
|
168 234 | &header_value, err
|
169 235 | ),
|
170 236 | )
|
171 237 | })?;
|
172 238 | builder = builder.header("X-Greeting", header_value);
|
239 + | /* HttpBindingGenerator.kt:728 */
|
173 240 | }
|
241 + | /* HttpBindingGenerator.kt:615 */
|
174 242 | }
|
243 + | /* HttpBindingGenerator.kt:578 */
|
175 244 | Ok(builder)
|
245 + | /* HttpBindingGenerator.kt:565 */
|
176 246 | }
|