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