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_malformed_timestamp_body_date_time_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::MalformedTimestampBodyDateTimeInput,
|
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)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:723 */
|
17 22 | let mut input =
|
18 23 | crate::input::malformed_timestamp_body_date_time_input_internal::Builder::default();
|
24 + | /* RustType.kt:516 */
|
19 25 | #[allow(unused_variables)]
|
26 + | /* ServerHttpBoundProtocolGenerator.kt:728 */
|
20 27 | let ::aws_smithy_runtime_api::http::RequestParts {
|
21 28 | uri, headers, body, ..
|
22 29 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
30 + | /* ServerHttpBoundProtocolGenerator.kt:745 */
|
23 31 | let bytes = ::hyper::body::to_bytes(body).await?;
|
32 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
24 33 | if !bytes.is_empty() {
|
34 + | /* ServerHttpBoundProtocolGenerator.kt:769 */
|
25 35 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
26 36 | &headers,
|
27 37 | Some("application/json"),
|
28 38 | )?;
|
29 39 | input = crate::protocol_serde::shape_malformed_timestamp_body_date_time::de_malformed_timestamp_body_date_time(bytes.as_ref(), input)?;
|
40 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
30 41 | }
|
42 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
31 43 | input.build()?
|
44 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
32 45 | })
|
46 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
33 47 | }
|
34 48 |
|
49 + | /* RustType.kt:516 */
|
35 50 | #[allow(clippy::unnecessary_wraps)]
|
51 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
36 52 | pub fn ser_malformed_timestamp_body_date_time_http_response(
|
37 53 | #[allow(unused_variables)] output: crate::output::MalformedTimestampBodyDateTimeOutput,
|
38 54 | ) -> std::result::Result<
|
39 55 | ::aws_smithy_http_server::response::Response,
|
40 56 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
41 57 | > {
|
58 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
42 59 | Ok({
|
60 + | /* RustType.kt:516 */
|
43 61 | #[allow(unused_mut)]
|
62 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
44 63 | let mut builder = ::http::Response::builder();
|
64 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
45 65 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
46 66 | builder,
|
47 67 | ::http::header::CONTENT_TYPE,
|
48 68 | "application/json",
|
49 69 | );
|
70 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
50 71 | let http_status: u16 = 200;
|
51 72 | builder = builder.status(http_status);
|
52 - | let payload = "";
|
73 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
74 + | let payload =
|
75 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */""
|
76 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
53 78 | let content_length = payload.len();
|
54 79 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
55 80 | builder,
|
56 81 | ::http::header::CONTENT_LENGTH,
|
57 82 | content_length,
|
58 83 | );
|
84 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
59 85 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
60 87 | builder.body(body)?
|
88 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
61 89 | })
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
62 91 | }
|
63 92 |
|
93 + | /* RustType.kt:516 */
|
64 94 | #[allow(clippy::unnecessary_wraps)]
|
95 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
65 96 | pub fn ser_malformed_timestamp_body_date_time_http_error(
|
66 97 | error: &crate::error::MalformedTimestampBodyDateTimeError,
|
67 98 | ) -> std::result::Result<
|
68 99 | ::aws_smithy_http_server::response::Response,
|
69 100 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
70 101 | > {
|
102 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
71 103 | Ok({
|
104 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
72 105 | match error {
|
106 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
73 107 | crate::error::MalformedTimestampBodyDateTimeError::ValidationException(output) => {
|
108 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
74 109 | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
110 + | /* RustType.kt:516 */
|
75 111 | #[allow(unused_mut)]
|
112 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
76 113 | let mut builder = ::http::Response::builder();
|
114 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
77 115 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
78 116 | builder,
|
79 117 | ::http::header::CONTENT_TYPE,
|
80 118 | "application/json",
|
81 119 | );
|
120 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
82 121 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
83 122 | builder,
|
84 123 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
85 124 | "ValidationException",
|
86 125 | );
|
126 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
87 127 | let content_length = payload.len();
|
88 128 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
89 129 | builder,
|
90 130 | ::http::header::CONTENT_LENGTH,
|
91 131 | content_length,
|
92 132 | );
|
133 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
93 134 | builder
|
94 135 | .status(400)
|
95 136 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
137 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
96 138 | }
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
97 140 | crate::error::MalformedTimestampBodyDateTimeError::InternalServerError(output) => {
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
98 142 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
143 + | /* RustType.kt:516 */
|
99 144 | #[allow(unused_mut)]
|
145 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
100 146 | let mut builder = ::http::Response::builder();
|
147 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
101 148 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
102 149 | builder,
|
103 150 | ::http::header::CONTENT_TYPE,
|
104 151 | "application/json",
|
105 152 | );
|
153 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
106 154 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
107 155 | builder,
|
108 156 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
109 157 | "InternalServerError",
|
110 158 | );
|
159 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
111 160 | let content_length = payload.len();
|
112 161 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
113 162 | builder,
|
114 163 | ::http::header::CONTENT_LENGTH,
|
115 164 | content_length,
|
116 165 | );
|
166 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
117 167 | builder
|
118 168 | .status(500)
|
119 169 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
120 - | }
|
170 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
171 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
121 172 | }
|
173 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
122 174 | })
|
175 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
123 176 | }
|
124 177 |
|
178 + | /* JsonParserGenerator.kt:148 */
|
125 179 | pub(crate) fn de_malformed_timestamp_body_date_time(
|
126 180 | value: &[u8],
|
127 181 | mut builder: crate::input::malformed_timestamp_body_date_time_input_internal::Builder,
|
128 182 | ) -> ::std::result::Result<
|
129 183 | crate::input::malformed_timestamp_body_date_time_input_internal::Builder,
|
130 184 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
131 185 | > {
|
186 + | /* JsonParserGenerator.kt:153 */
|
132 187 | let mut tokens_owned =
|
133 188 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
134 189 | .peekable();
|
135 190 | let tokens = &mut tokens_owned;
|
136 191 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
192 + | /* JsonParserGenerator.kt:684 */
|
137 193 | loop {
|
194 + | /* JsonParserGenerator.kt:685 */
|
138 195 | match tokens.next().transpose()? {
|
196 + | /* JsonParserGenerator.kt:686 */
|
139 197 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
140 198 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
199 + | /* JsonParserGenerator.kt:260 */
|
141 200 | match key.to_unescaped()?.as_ref() {
|
201 + | /* JsonParserGenerator.kt:262 */
|
142 202 | "timestamp" => {
|
203 + | /* JsonParserGenerator.kt:276 */
|
143 204 | if let Some(v) =
|
205 + | /* JsonParserGenerator.kt:384 */
|
144 206 | ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
145 - | tokens.next(),
|
146 - | ::aws_smithy_types::date_time::Format::DateTime,
|
147 - | )?
|
148 - | .map(::aws_smithy_http_server_python::types::DateTime::from)
|
207 + | tokens.next(),
|
208 + | ::aws_smithy_types::date_time::Format::DateTime,
|
209 + | )?
|
210 + | /* PythonServerProtocolLoader.kt:44 */
|
211 + | .map(::aws_smithy_http_server_python::types::DateTime::from)
|
212 + | /* JsonParserGenerator.kt:278 */
|
149 213 | {
|
150 214 | builder = builder.set_timestamp(v);
|
151 215 | }
|
216 + | /* JsonParserGenerator.kt:262 */
|
152 217 | }
|
153 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
218 + | /* JsonParserGenerator.kt:290 */
|
219 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
154 220 | }
|
221 + | /* JsonParserGenerator.kt:686 */
|
155 222 | }
|
223 + | /* JsonParserGenerator.kt:695 */
|
156 224 | other => {
|
157 225 | return Err(
|
158 226 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
159 227 | "expected object key or end object, found: {:?}",
|
160 228 | other
|
161 229 | )),
|
162 230 | )
|
163 - | }
|
231 + | } /* JsonParserGenerator.kt:685 */
|
164 232 | }
|
233 + | /* JsonParserGenerator.kt:684 */
|
165 234 | }
|
235 + | /* JsonParserGenerator.kt:250 */
|
166 236 | if tokens.next().is_some() {
|
237 + | /* JsonParserGenerator.kt:251 */
|
167 238 | return Err(
|
168 239 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
169 240 | "found more JSON tokens after completing parsing",
|
170 241 | ),
|
171 242 | );
|
243 + | /* JsonParserGenerator.kt:250 */
|
172 244 | }
|
245 + | /* JsonParserGenerator.kt:163 */
|
173 246 | Ok(builder)
|
247 + | /* JsonParserGenerator.kt:148 */
|
174 248 | }
|