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_primitive_int_op_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::PrimitiveIntOpInput,
|
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::primitive_int_op_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_primitive_int_op::de_primitive_int_op(
|
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_primitive_int_op_http_response(
|
39 55 | #[allow(unused_variables)] output: crate::output::PrimitiveIntOpOutput,
|
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_primitive_int_op_output::ser_primitive_int_op_output_output_output(&output)?
|
56 - | ;
|
77 + | /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_primitive_int_op_output::ser_primitive_int_op_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_primitive_int_op_http_error(
|
70 99 | error: &crate::error::PrimitiveIntOpError,
|
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::PrimitiveIntOpError::ExtraError(output) => {
|
110 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
78 111 | let payload =
|
79 112 | crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
|
113 + | /* RustType.kt:516 */
|
80 114 | #[allow(unused_mut)]
|
115 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
81 116 | let mut builder = ::http::Response::builder();
|
117 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
82 118 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
83 119 | builder,
|
84 120 | ::http::header::CONTENT_TYPE,
|
85 121 | "application/json",
|
86 122 | );
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
87 124 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
88 125 | builder,
|
89 126 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
90 127 | "ExtraError",
|
91 128 | );
|
129 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
92 130 | let content_length = payload.len();
|
93 131 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
94 132 | builder,
|
95 133 | ::http::header::CONTENT_LENGTH,
|
96 134 | content_length,
|
97 135 | );
|
136 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
98 137 | builder
|
99 138 | .status(500)
|
100 139 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
140 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
101 141 | }
|
142 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
102 143 | crate::error::PrimitiveIntOpError::InternalServerError(output) => {
|
144 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
103 145 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
146 + | /* RustType.kt:516 */
|
104 147 | #[allow(unused_mut)]
|
148 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
105 149 | let mut builder = ::http::Response::builder();
|
150 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
106 151 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
107 152 | builder,
|
108 153 | ::http::header::CONTENT_TYPE,
|
109 154 | "application/json",
|
110 155 | );
|
156 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
111 157 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
112 158 | builder,
|
113 159 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
114 160 | "InternalServerError",
|
115 161 | );
|
162 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
116 163 | let content_length = payload.len();
|
117 164 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
118 165 | builder,
|
119 166 | ::http::header::CONTENT_LENGTH,
|
120 167 | content_length,
|
121 168 | );
|
169 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
122 170 | builder
|
123 171 | .status(500)
|
124 172 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
173 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
174 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
125 175 | }
|
126 - | }
|
176 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
127 177 | })
|
178 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
128 179 | }
|
129 180 |
|
181 + | /* JsonParserGenerator.kt:148 */
|
130 182 | pub(crate) fn de_primitive_int_op(
|
131 183 | value: &[u8],
|
132 184 | mut builder: crate::input::primitive_int_op_input_internal::Builder,
|
133 185 | ) -> ::std::result::Result<
|
134 186 | crate::input::primitive_int_op_input_internal::Builder,
|
135 187 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
136 188 | > {
|
189 + | /* JsonParserGenerator.kt:153 */
|
137 190 | let mut tokens_owned =
|
138 191 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
139 192 | .peekable();
|
140 193 | let tokens = &mut tokens_owned;
|
141 194 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
195 + | /* JsonParserGenerator.kt:684 */
|
142 196 | loop {
|
197 + | /* JsonParserGenerator.kt:685 */
|
143 198 | match tokens.next().transpose()? {
|
199 + | /* JsonParserGenerator.kt:686 */
|
144 200 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
145 201 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
202 + | /* JsonParserGenerator.kt:260 */
|
146 203 | match key.to_unescaped()?.as_ref() {
|
204 + | /* JsonParserGenerator.kt:262 */
|
147 205 | "value" => {
|
206 + | /* JsonParserGenerator.kt:276 */
|
148 207 | if let Some(v) =
|
208 + | /* JsonParserGenerator.kt:365 */
|
149 209 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
150 210 | tokens.next(),
|
151 211 | )?
|
152 212 | .map(i32::try_from)
|
153 213 | .transpose()?
|
214 + | /* JsonParserGenerator.kt:278 */
|
154 215 | {
|
155 216 | builder = builder.set_value(v);
|
156 217 | }
|
218 + | /* JsonParserGenerator.kt:262 */
|
157 219 | }
|
158 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
220 + | /* JsonParserGenerator.kt:290 */
|
221 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
159 222 | }
|
223 + | /* JsonParserGenerator.kt:686 */
|
160 224 | }
|
225 + | /* JsonParserGenerator.kt:695 */
|
161 226 | other => {
|
162 227 | return Err(
|
163 228 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
164 229 | "expected object key or end object, found: {:?}",
|
165 230 | other
|
166 231 | )),
|
167 232 | )
|
233 + | } /* JsonParserGenerator.kt:685 */
|
168 234 | }
|
235 + | /* JsonParserGenerator.kt:684 */
|
169 236 | }
|
170 - | }
|
237 + | /* JsonParserGenerator.kt:250 */
|
171 238 | if tokens.next().is_some() {
|
239 + | /* JsonParserGenerator.kt:251 */
|
172 240 | return Err(
|
173 241 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
174 242 | "found more JSON tokens after completing parsing",
|
175 243 | ),
|
176 244 | );
|
245 + | /* JsonParserGenerator.kt:250 */
|
177 246 | }
|
247 + | /* JsonParserGenerator.kt:163 */
|
178 248 | Ok(builder)
|
249 + | /* JsonParserGenerator.kt:148 */
|
179 250 | }
|