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::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 */
|
141 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
101 142 | }
|
102 - | }
|
143 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
103 144 | })
|
145 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
104 146 | }
|
105 147 |
|
148 + | /* JsonParserGenerator.kt:148 */
|
106 149 | pub(crate) fn de_primitive_int_op(
|
107 150 | value: &[u8],
|
108 151 | mut builder: crate::input::primitive_int_op_input::Builder,
|
109 152 | ) -> ::std::result::Result<
|
110 153 | crate::input::primitive_int_op_input::Builder,
|
111 154 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
112 155 | > {
|
156 + | /* JsonParserGenerator.kt:153 */
|
113 157 | let mut tokens_owned =
|
114 158 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
115 159 | .peekable();
|
116 160 | let tokens = &mut tokens_owned;
|
117 161 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
162 + | /* JsonParserGenerator.kt:684 */
|
118 163 | loop {
|
164 + | /* JsonParserGenerator.kt:685 */
|
119 165 | match tokens.next().transpose()? {
|
166 + | /* JsonParserGenerator.kt:686 */
|
120 167 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
121 168 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
169 + | /* JsonParserGenerator.kt:260 */
|
122 170 | match key.to_unescaped()?.as_ref() {
|
171 + | /* JsonParserGenerator.kt:262 */
|
123 172 | "value" => {
|
173 + | /* JsonParserGenerator.kt:276 */
|
124 174 | if let Some(v) =
|
175 + | /* JsonParserGenerator.kt:365 */
|
125 176 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
126 177 | tokens.next(),
|
127 178 | )?
|
128 179 | .map(i32::try_from)
|
129 180 | .transpose()?
|
181 + | /* JsonParserGenerator.kt:278 */
|
130 182 | {
|
131 183 | builder = builder.set_value(v);
|
132 184 | }
|
185 + | /* JsonParserGenerator.kt:262 */
|
133 186 | }
|
134 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
187 + | /* JsonParserGenerator.kt:290 */
|
188 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
135 189 | }
|
190 + | /* JsonParserGenerator.kt:686 */
|
136 191 | }
|
192 + | /* JsonParserGenerator.kt:695 */
|
137 193 | other => {
|
138 194 | return Err(
|
139 195 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
140 196 | "expected object key or end object, found: {:?}",
|
141 197 | other
|
142 198 | )),
|
143 199 | )
|
200 + | } /* JsonParserGenerator.kt:685 */
|
144 201 | }
|
202 + | /* JsonParserGenerator.kt:684 */
|
145 203 | }
|
146 - | }
|
204 + | /* JsonParserGenerator.kt:250 */
|
147 205 | if tokens.next().is_some() {
|
206 + | /* JsonParserGenerator.kt:251 */
|
148 207 | return Err(
|
149 208 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
150 209 | "found more JSON tokens after completing parsing",
|
151 210 | ),
|
152 211 | );
|
212 + | /* JsonParserGenerator.kt:250 */
|
153 213 | }
|
214 + | /* JsonParserGenerator.kt:163 */
|
154 215 | Ok(builder)
|
216 + | /* JsonParserGenerator.kt:148 */
|
155 217 | }
|