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_test_body_structure_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::TestBodyStructureInput,
|
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::test_body_structure_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_test_body_structure::de_test_body_structure(
|
29 39 | bytes.as_ref(),
|
30 40 | input,
|
31 41 | )?;
|
42 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
32 43 | }
|
44 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
33 45 | if let Some(value) =
|
34 46 | crate::protocol_serde::shape_test_body_structure_input::de_test_id_header(&headers)?
|
35 47 | {
|
36 48 | input = input.set_test_id(Some(value))
|
37 49 | }
|
50 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
38 51 | input.build()
|
52 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
39 53 | })
|
54 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
40 55 | }
|
41 56 |
|
57 + | /* RustType.kt:516 */
|
42 58 | #[allow(clippy::unnecessary_wraps)]
|
59 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
43 60 | pub fn ser_test_body_structure_http_response(
|
44 61 | #[allow(unused_variables)] output: crate::output::TestBodyStructureOutput,
|
45 62 | ) -> std::result::Result<
|
46 63 | ::aws_smithy_http_server::response::Response,
|
47 64 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
48 65 | > {
|
66 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
49 67 | Ok({
|
68 + | /* RustType.kt:516 */
|
50 69 | #[allow(unused_mut)]
|
70 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
51 71 | let mut builder = ::http::Response::builder();
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:629 */
|
52 73 | builder =
|
53 74 | crate::protocol_serde::shape_test_body_structure::ser_test_body_structure_headers(
|
54 75 | &output, builder,
|
55 76 | )?;
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
56 78 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
57 79 | builder,
|
58 80 | ::http::header::CONTENT_TYPE,
|
59 81 | "application/json",
|
60 82 | );
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
61 84 | let http_status: u16 = 200;
|
62 85 | builder = builder.status(http_status);
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
63 87 | let payload =
|
64 - | crate::protocol_serde::shape_test_body_structure_output::ser_test_body_structure_output_output_output(&output)?
|
65 - | ;
|
88 + | /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_test_body_structure_output::ser_test_body_structure_output_output_output(&output)?
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
66 91 | let content_length = payload.len();
|
67 92 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
68 93 | builder,
|
69 94 | ::http::header::CONTENT_LENGTH,
|
70 95 | content_length,
|
71 96 | );
|
97 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
72 98 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
99 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
73 100 | builder.body(body)?
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
74 102 | })
|
103 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
75 104 | }
|
76 105 |
|
106 + | /* JsonParserGenerator.kt:148 */
|
77 107 | pub(crate) fn de_test_body_structure(
|
78 108 | value: &[u8],
|
79 109 | mut builder: crate::input::test_body_structure_input::Builder,
|
80 110 | ) -> ::std::result::Result<
|
81 111 | crate::input::test_body_structure_input::Builder,
|
82 112 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
83 113 | > {
|
114 + | /* JsonParserGenerator.kt:153 */
|
84 115 | let mut tokens_owned =
|
85 116 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
86 117 | .peekable();
|
87 118 | let tokens = &mut tokens_owned;
|
88 119 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
120 + | /* JsonParserGenerator.kt:684 */
|
89 121 | loop {
|
122 + | /* JsonParserGenerator.kt:685 */
|
90 123 | match tokens.next().transpose()? {
|
124 + | /* JsonParserGenerator.kt:686 */
|
91 125 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
92 126 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
127 + | /* JsonParserGenerator.kt:260 */
|
93 128 | match key.to_unescaped()?.as_ref() {
|
129 + | /* JsonParserGenerator.kt:262 */
|
94 130 | "testConfig" => {
|
131 + | /* JsonParserGenerator.kt:272 */
|
95 132 | builder = builder.set_test_config(
|
96 - | crate::protocol_serde::shape_test_config::de_test_config(tokens)?,
|
97 - | );
|
133 + | /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_test_config::de_test_config(tokens)?
|
134 + | /* JsonParserGenerator.kt:272 */);
|
135 + | /* JsonParserGenerator.kt:262 */
|
98 136 | }
|
99 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
137 + | /* JsonParserGenerator.kt:290 */
|
138 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
100 139 | }
|
140 + | /* JsonParserGenerator.kt:686 */
|
101 141 | }
|
142 + | /* JsonParserGenerator.kt:695 */
|
102 143 | other => {
|
103 144 | return Err(
|
104 145 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
105 146 | "expected object key or end object, found: {:?}",
|
106 147 | other
|
107 148 | )),
|
108 149 | )
|
150 + | } /* JsonParserGenerator.kt:685 */
|
109 151 | }
|
152 + | /* JsonParserGenerator.kt:684 */
|
110 153 | }
|
111 - | }
|
154 + | /* JsonParserGenerator.kt:250 */
|
112 155 | if tokens.next().is_some() {
|
156 + | /* JsonParserGenerator.kt:251 */
|
113 157 | return Err(
|
114 158 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
115 159 | "found more JSON tokens after completing parsing",
|
116 160 | ),
|
117 161 | );
|
162 + | /* JsonParserGenerator.kt:250 */
|
118 163 | }
|
164 + | /* JsonParserGenerator.kt:163 */
|
119 165 | Ok(builder)
|
166 + | /* JsonParserGenerator.kt:148 */
|
120 167 | }
|
121 168 |
|
169 + | /* HttpBindingGenerator.kt:542 */
|
122 170 | pub fn ser_test_body_structure_headers(
|
123 171 | input: &crate::output::TestBodyStructureOutput,
|
124 172 | mut builder: ::http::response::Builder,
|
125 173 | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
126 174 | {
|
175 + | /* HttpBindingGenerator.kt:592 */
|
127 176 | if let ::std::option::Option::Some(inner_1) = &input.test_id {
|
177 + | /* HttpBindingGenerator.kt:704 */
|
128 178 | let formatted_2 = inner_1.as_str();
|
179 + | /* HttpBindingGenerator.kt:705 */
|
129 180 | if !formatted_2.is_empty() {
|
181 + | /* HttpBindingGenerator.kt:706 */
|
130 182 | let header_value = formatted_2;
|
131 183 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
132 184 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
133 185 | "test_id",
|
134 186 | format!(
|
135 187 | "`{}` cannot be used as a header value: {}",
|
136 188 | &header_value, err
|
137 189 | ),
|
138 190 | )
|
139 191 | })?;
|
140 192 | builder = builder.header("x-amz-test-id", header_value);
|
193 + | /* HttpBindingGenerator.kt:705 */
|
141 194 | }
|
195 + | /* HttpBindingGenerator.kt:592 */
|
142 196 | }
|
197 + | /* HttpBindingGenerator.kt:555 */
|
143 198 | Ok(builder)
|
199 + | /* HttpBindingGenerator.kt:542 */
|
144 200 | }
|