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