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_document_type_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::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:424 */
|
15 18 | Ok({
|
19 + | /* RustType.kt:534 */
|
16 20 | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
17 22 | let mut input = crate::input::document_type_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();
|
22 - | let bytes = ::hyper::body::to_bytes(body).await?;
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:789 */
|
30 + | let bytes = {
|
31 + | use ::http_body_util::BodyExt;
|
32 + | body.collect().await?.to_bytes()
|
33 + | };
|
34 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
23 35 | if !bytes.is_empty() {
|
36 + | /* ServerHttpBoundProtocolGenerator.kt:826 */
|
24 37 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
25 38 | &headers,
|
26 39 | Some("application/json"),
|
27 40 | )?;
|
28 41 | input = crate::protocol_serde::shape_document_type::de_document_type(
|
29 42 | bytes.as_ref(),
|
30 43 | input,
|
31 44 | )?;
|
45 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
32 46 | }
|
47 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
33 48 | input.build()
|
49 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
34 50 | })
|
51 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
35 52 | }
|
36 53 |
|
54 + | /* RustType.kt:534 */
|
37 55 | #[allow(clippy::unnecessary_wraps)]
|
56 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
38 57 | pub fn ser_document_type_http_response(
|
39 58 | #[allow(unused_variables)] output: crate::output::DocumentTypeOutput,
|
40 59 | ) -> std::result::Result<
|
41 60 | ::aws_smithy_http_server::response::Response,
|
42 61 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
43 62 | > {
|
63 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
44 64 | Ok({
|
65 + | /* RustType.kt:534 */
|
45 66 | #[allow(unused_mut)]
|
46 - | let mut builder = ::http::Response::builder();
|
67 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
68 + | let mut builder = ::http_1x::Response::builder();
|
69 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
47 70 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
48 71 | builder,
|
49 - | ::http::header::CONTENT_TYPE,
|
72 + | ::http_1x::header::CONTENT_TYPE,
|
50 73 | "application/json",
|
51 74 | );
|
75 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
52 76 | let http_status: u16 = 200;
|
53 77 | builder = builder.status(http_status);
|
78 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
54 79 | let payload =
|
55 - | crate::protocol_serde::shape_document_type_output::ser_document_type_output_output_output(&output)?
|
56 - | ;
|
80 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_document_type_output::ser_document_type_output_output_output(&output)?
|
81 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
82 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
57 83 | let content_length = payload.len();
|
58 84 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
59 85 | builder,
|
60 - | ::http::header::CONTENT_LENGTH,
|
86 + | ::http_1x::header::CONTENT_LENGTH,
|
61 87 | content_length,
|
62 88 | );
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
63 90 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
91 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
64 92 | builder.body(body)?
|
93 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
65 94 | })
|
95 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
66 96 | }
|
67 97 |
|
98 + | /* JsonParserGenerator.kt:148 */
|
68 99 | pub(crate) fn de_document_type(
|
69 100 | value: &[u8],
|
70 101 | mut builder: crate::input::document_type_input::Builder,
|
71 102 | ) -> ::std::result::Result<
|
72 103 | crate::input::document_type_input::Builder,
|
73 104 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
74 105 | > {
|
106 + | /* JsonParserGenerator.kt:153 */
|
75 107 | let mut tokens_owned =
|
76 108 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
77 109 | .peekable();
|
78 110 | let tokens = &mut tokens_owned;
|
79 111 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
112 + | /* JsonParserGenerator.kt:684 */
|
80 113 | loop {
|
114 + | /* JsonParserGenerator.kt:685 */
|
81 115 | match tokens.next().transpose()? {
|
116 + | /* JsonParserGenerator.kt:686 */
|
82 117 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
83 118 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
119 + | /* JsonParserGenerator.kt:260 */
|
84 120 | match key.to_unescaped()?.as_ref() {
|
121 + | /* JsonParserGenerator.kt:262 */
|
85 122 | "documentValue" => {
|
86 - | builder = builder.set_document_value(Some(
|
87 - | ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
|
88 - | ));
|
123 + | /* JsonParserGenerator.kt:272 */
|
124 + | builder = builder.set_document_value(
|
125 + | /* JsonParserGenerator.kt:319 */
|
126 + | Some(::aws_smithy_json::deserialize::token::expect_document(
|
127 + | tokens,
|
128 + | )?), /* JsonParserGenerator.kt:272 */
|
129 + | );
|
130 + | /* JsonParserGenerator.kt:262 */
|
89 131 | }
|
132 + | /* JsonParserGenerator.kt:262 */
|
90 133 | "stringValue" => {
|
134 + | /* JsonParserGenerator.kt:272 */
|
91 135 | builder = builder.set_string_value(
|
136 + | /* JsonParserGenerator.kt:354 */
|
92 137 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
93 138 | tokens.next(),
|
94 139 | )?
|
95 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
96 - | .transpose()?,
|
140 + | .map(|s|
|
141 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
142 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
143 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
144 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
97 145 | );
|
146 + | /* JsonParserGenerator.kt:262 */
|
98 147 | }
|
99 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
148 + | /* JsonParserGenerator.kt:290 */
|
149 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
100 150 | }
|
151 + | /* JsonParserGenerator.kt:686 */
|
101 152 | }
|
153 + | /* JsonParserGenerator.kt:695 */
|
102 154 | other => {
|
103 155 | return Err(
|
104 156 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
105 157 | "expected object key or end object, found: {other:?}"
|
106 158 | )),
|
107 159 | )
|
108 - | }
|
160 + | } /* JsonParserGenerator.kt:685 */
|
109 161 | }
|
162 + | /* JsonParserGenerator.kt:684 */
|
110 163 | }
|
164 + | /* JsonParserGenerator.kt:250 */
|
111 165 | if tokens.next().is_some() {
|
166 + | /* JsonParserGenerator.kt:251 */
|
112 167 | return Err(
|
113 168 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
114 169 | "found more JSON tokens after completing parsing",
|
115 170 | ),
|
116 171 | );
|
172 + | /* JsonParserGenerator.kt:250 */
|
117 173 | }
|
174 + | /* JsonParserGenerator.kt:163 */
|
118 175 | Ok(builder)
|
176 + | /* JsonParserGenerator.kt:148 */
|
119 177 | }
|