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