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:408 */
|
5 + | pub async fn de_malformed_timestamp_body_date_time_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::MalformedTimestampBodyDateTimeInput,
|
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::Data: Send,
|
14 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
15 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
16 + | {
|
17 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
18 + | Ok({
|
19 + | /* RustType.kt:534 */
|
20 + | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
22 + | let mut input = crate::input::malformed_timestamp_body_date_time_input::Builder::default();
|
23 + | /* RustType.kt:534 */
|
24 + | #[allow(unused_variables)]
|
25 + | /* ServerHttpBoundProtocolGenerator.kt:764 */
|
26 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
27 + | uri, headers, body, ..
|
28 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:801 */
|
30 + | let bytes = ::hyper::body::to_bytes(body).await?;
|
31 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
32 + | if !bytes.is_empty() {
|
33 + | /* ServerHttpBoundProtocolGenerator.kt:826 */
|
34 + | ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
|
35 + | &headers,
|
36 + | Some("application/json"),
|
37 + | )?;
|
38 + | input = crate::protocol_serde::shape_malformed_timestamp_body_date_time::de_malformed_timestamp_body_date_time(bytes.as_ref(), input)?;
|
39 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
40 + | }
|
41 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
42 + | input.build()?
|
43 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
44 + | })
|
45 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
46 + | }
|
47 + |
|
48 + | /* RustType.kt:534 */
|
49 + | #[allow(clippy::unnecessary_wraps)]
|
50 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
51 + | pub fn ser_malformed_timestamp_body_date_time_http_response(
|
52 + | #[allow(unused_variables)] output: crate::output::MalformedTimestampBodyDateTimeOutput,
|
53 + | ) -> std::result::Result<
|
54 + | ::aws_smithy_legacy_http_server::response::Response,
|
55 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
56 + | > {
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
58 + | Ok({
|
59 + | /* RustType.kt:534 */
|
60 + | #[allow(unused_mut)]
|
61 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
62 + | let mut builder = ::http::Response::builder();
|
63 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
64 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
65 + | builder,
|
66 + | ::http::header::CONTENT_TYPE,
|
67 + | "application/json",
|
68 + | );
|
69 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
70 + | let http_status: u16 = 200;
|
71 + | builder = builder.status(http_status);
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
73 + | let payload =
|
74 + | /* HttpBoundProtocolPayloadGenerator.kt:233 */""
|
75 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
76 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
77 + | let content_length = payload.len();
|
78 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
79 + | builder,
|
80 + | ::http::header::CONTENT_LENGTH,
|
81 + | content_length,
|
82 + | );
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
84 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
85 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
86 + | builder.body(body)?
|
87 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
88 + | })
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
90 + | }
|
91 + |
|
92 + | /* RustType.kt:534 */
|
93 + | #[allow(clippy::unnecessary_wraps)]
|
94 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
95 + | pub fn ser_malformed_timestamp_body_date_time_http_error(
|
96 + | error: &crate::error::MalformedTimestampBodyDateTimeError,
|
97 + | ) -> std::result::Result<
|
98 + | ::aws_smithy_legacy_http_server::response::Response,
|
99 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
100 + | > {
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
102 + | Ok({
|
103 + | /* ServerHttpBoundProtocolGenerator.kt:492 */
|
104 + | match error {
|
105 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
106 + | crate::error::MalformedTimestampBodyDateTimeError::ValidationException(output) => {
|
107 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
108 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
109 + | /* RustType.kt:534 */
|
110 + | #[allow(unused_mut)]
|
111 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
112 + | let mut builder = ::http::Response::builder();
|
113 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
114 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
115 + | builder,
|
116 + | ::http::header::CONTENT_TYPE,
|
117 + | "application/json",
|
118 + | );
|
119 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
120 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
121 + | builder,
|
122 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
123 + | "ValidationException",
|
124 + | );
|
125 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
126 + | let content_length = payload.len();
|
127 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
128 + | builder,
|
129 + | ::http::header::CONTENT_LENGTH,
|
130 + | content_length,
|
131 + | );
|
132 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
133 + | builder
|
134 + | .status(400)
|
135 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
136 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
137 + | } /* ServerHttpBoundProtocolGenerator.kt:492 */
|
138 + | }
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
140 + | })
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
142 + | }
|
143 + |
|
144 + | /* JsonParserGenerator.kt:148 */
|
145 + | pub(crate) fn de_malformed_timestamp_body_date_time(
|
146 + | value: &[u8],
|
147 + | mut builder: crate::input::malformed_timestamp_body_date_time_input::Builder,
|
148 + | ) -> ::std::result::Result<
|
149 + | crate::input::malformed_timestamp_body_date_time_input::Builder,
|
150 + | ::aws_smithy_json::deserialize::error::DeserializeError,
|
151 + | > {
|
152 + | /* JsonParserGenerator.kt:153 */
|
153 + | let mut tokens_owned =
|
154 + | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
155 + | .peekable();
|
156 + | let tokens = &mut tokens_owned;
|
157 + | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
158 + | /* JsonParserGenerator.kt:684 */
|
159 + | loop {
|
160 + | /* JsonParserGenerator.kt:685 */
|
161 + | match tokens.next().transpose()? {
|
162 + | /* JsonParserGenerator.kt:686 */
|
163 + | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
164 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
165 + | /* JsonParserGenerator.kt:260 */
|
166 + | match key.to_unescaped()?.as_ref() {
|
167 + | /* JsonParserGenerator.kt:262 */
|
168 + | "timestamp" => {
|
169 + | /* JsonParserGenerator.kt:276 */
|
170 + | if let Some(v) =
|
171 + | /* JsonParserGenerator.kt:384 */
|
172 + | ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
173 + | tokens.next(),
|
174 + | ::aws_smithy_types::date_time::Format::DateTime,
|
175 + | )?
|
176 + | /* JsonParserGenerator.kt:278 */
|
177 + | {
|
178 + | builder = builder.set_timestamp(v);
|
179 + | }
|
180 + | /* JsonParserGenerator.kt:262 */
|
181 + | }
|
182 + | /* JsonParserGenerator.kt:290 */
|
183 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
184 + | }
|
185 + | /* JsonParserGenerator.kt:686 */
|
186 + | }
|
187 + | /* JsonParserGenerator.kt:695 */
|
188 + | other => {
|
189 + | return Err(
|
190 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
191 + | "expected object key or end object, found: {other:?}"
|
192 + | )),
|
193 + | )
|
194 + | } /* JsonParserGenerator.kt:685 */
|
195 + | }
|
196 + | /* JsonParserGenerator.kt:684 */
|
197 + | }
|
198 + | /* JsonParserGenerator.kt:250 */
|
199 + | if tokens.next().is_some() {
|
200 + | /* JsonParserGenerator.kt:251 */
|
201 + | return Err(
|
202 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
203 + | "found more JSON tokens after completing parsing",
|
204 + | ),
|
205 + | );
|
206 + | /* JsonParserGenerator.kt:250 */
|
207 + | }
|
208 + | /* JsonParserGenerator.kt:163 */
|
209 + | Ok(builder)
|
210 + | /* JsonParserGenerator.kt:148 */
|
211 + | }
|