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::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 + | /* JsonParserGenerator.kt:148 */
|
68 96 | pub(crate) fn de_http_checksum_required(
|
69 97 | value: &[u8],
|
70 98 | mut builder: crate::input::http_checksum_required_input::Builder,
|
71 99 | ) -> ::std::result::Result<
|
72 100 | crate::input::http_checksum_required_input::Builder,
|
73 101 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
74 102 | > {
|
103 + | /* JsonParserGenerator.kt:153 */
|
75 104 | let mut tokens_owned =
|
76 105 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
77 106 | .peekable();
|
78 107 | let tokens = &mut tokens_owned;
|
79 108 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
109 + | /* JsonParserGenerator.kt:684 */
|
80 110 | loop {
|
111 + | /* JsonParserGenerator.kt:685 */
|
81 112 | match tokens.next().transpose()? {
|
113 + | /* JsonParserGenerator.kt:686 */
|
82 114 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
83 115 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
116 + | /* JsonParserGenerator.kt:260 */
|
84 117 | match key.to_unescaped()?.as_ref() {
|
118 + | /* JsonParserGenerator.kt:262 */
|
85 119 | "foo" => {
|
120 + | /* JsonParserGenerator.kt:272 */
|
86 121 | builder = builder.set_foo(
|
122 + | /* JsonParserGenerator.kt:354 */
|
87 123 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
88 124 | tokens.next(),
|
89 125 | )?
|
90 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
91 - | .transpose()?,
|
126 + | .map(|s|
|
127 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
128 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
129 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
130 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
92 131 | );
|
132 + | /* JsonParserGenerator.kt:262 */
|
93 133 | }
|
94 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
134 + | /* JsonParserGenerator.kt:290 */
|
135 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
95 136 | }
|
137 + | /* JsonParserGenerator.kt:686 */
|
96 138 | }
|
139 + | /* JsonParserGenerator.kt:695 */
|
97 140 | other => {
|
98 141 | return Err(
|
99 142 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
100 143 | "expected object key or end object, found: {:?}",
|
101 144 | other
|
102 145 | )),
|
103 146 | )
|
147 + | } /* JsonParserGenerator.kt:685 */
|
104 148 | }
|
149 + | /* JsonParserGenerator.kt:684 */
|
105 150 | }
|
106 - | }
|
151 + | /* JsonParserGenerator.kt:250 */
|
107 152 | if tokens.next().is_some() {
|
153 + | /* JsonParserGenerator.kt:251 */
|
108 154 | return Err(
|
109 155 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
110 156 | "found more JSON tokens after completing parsing",
|
111 157 | ),
|
112 158 | );
|
159 + | /* JsonParserGenerator.kt:250 */
|
113 160 | }
|
161 + | /* JsonParserGenerator.kt:163 */
|
114 162 | Ok(builder)
|
163 + | /* JsonParserGenerator.kt:148 */
|
115 164 | }
|