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