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_http_checksum_required_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::HttpChecksumRequiredInput,
|
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::http_checksum_required_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_http_checksum_required::de_http_checksum_required(
|
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_http_checksum_required_http_response(
|
39 55 | #[allow(unused_variables)] output: crate::output::HttpChecksumRequiredOutput,
|
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_http_checksum_required_output::ser_http_checksum_required_output_output_output(&output)?
|
56 - | ;
|
77 + | /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_http_checksum_required_output::ser_http_checksum_required_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_http_checksum_required_http_error(
|
70 99 | error: &crate::error::HttpChecksumRequiredError,
|
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::HttpChecksumRequiredError::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_http_checksum_required(
|
106 149 | value: &[u8],
|
107 150 | mut builder: crate::input::http_checksum_required_input_internal::Builder,
|
108 151 | ) -> ::std::result::Result<
|
109 152 | crate::input::http_checksum_required_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 | "foo" => {
|
172 + | /* JsonParserGenerator.kt:272 */
|
123 173 | builder = builder.set_foo(
|
174 + | /* JsonParserGenerator.kt:354 */
|
124 175 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
125 176 | tokens.next(),
|
126 177 | )?
|
127 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
128 - | .transpose()?,
|
178 + | .map(|s|
|
179 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
180 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
181 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
182 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
129 183 | );
|
184 + | /* JsonParserGenerator.kt:262 */
|
130 185 | }
|
131 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
186 + | /* JsonParserGenerator.kt:290 */
|
187 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
132 188 | }
|
189 + | /* JsonParserGenerator.kt:686 */
|
133 190 | }
|
191 + | /* JsonParserGenerator.kt:695 */
|
134 192 | other => {
|
135 193 | return Err(
|
136 194 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
137 195 | "expected object key or end object, found: {:?}",
|
138 196 | other
|
139 197 | )),
|
140 198 | )
|
199 + | } /* JsonParserGenerator.kt:685 */
|
141 200 | }
|
201 + | /* JsonParserGenerator.kt:684 */
|
142 202 | }
|
143 - | }
|
203 + | /* JsonParserGenerator.kt:250 */
|
144 204 | if tokens.next().is_some() {
|
205 + | /* JsonParserGenerator.kt:251 */
|
145 206 | return Err(
|
146 207 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
147 208 | "found more JSON tokens after completing parsing",
|
148 209 | ),
|
149 210 | );
|
211 + | /* JsonParserGenerator.kt:250 */
|
150 212 | }
|
213 + | /* JsonParserGenerator.kt:163 */
|
151 214 | Ok(builder)
|
215 + | /* JsonParserGenerator.kt:148 */
|
152 216 | }
|