1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:534 */
|
2 3 | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
3 5 | pub async fn de_test_body_structure_http_request<B>(
|
4 - | #[allow(unused_variables)] request: ::http::Request<B>,
|
6 + | #[allow(unused_variables)] request: ::http_1x::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:424 */
|
15 18 | Ok({
|
19 + | /* RustType.kt:534 */
|
16 20 | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
17 22 | let mut input = crate::input::test_body_structure_input::Builder::default();
|
23 + | /* RustType.kt:534 */
|
18 24 | #[allow(unused_variables)]
|
25 + | /* ServerHttpBoundProtocolGenerator.kt:764 */
|
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();
|
22 - | let bytes = ::hyper::body::to_bytes(body).await?;
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:789 */
|
30 + | let bytes = {
|
31 + | use ::http_body_util::BodyExt;
|
32 + | body.collect().await?.to_bytes()
|
33 + | };
|
34 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
23 35 | if !bytes.is_empty() {
|
36 + | /* ServerHttpBoundProtocolGenerator.kt:826 */
|
24 37 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
25 38 | &headers,
|
26 39 | Some("application/json"),
|
27 40 | )?;
|
28 41 | input = crate::protocol_serde::shape_test_body_structure::de_test_body_structure(
|
29 42 | bytes.as_ref(),
|
30 43 | input,
|
31 44 | )?;
|
45 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
32 46 | }
|
47 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
33 48 | if let Some(value) =
|
34 49 | crate::protocol_serde::shape_test_body_structure_input::de_test_id_header(&headers)?
|
35 50 | {
|
36 51 | input = input.set_test_id(Some(value))
|
37 52 | }
|
53 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
38 54 | input.build()
|
55 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
39 56 | })
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
40 58 | }
|
41 59 |
|
60 + | /* RustType.kt:534 */
|
42 61 | #[allow(clippy::unnecessary_wraps)]
|
62 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
43 63 | pub fn ser_test_body_structure_http_response(
|
44 64 | #[allow(unused_variables)] output: crate::output::TestBodyStructureOutput,
|
45 65 | ) -> std::result::Result<
|
46 66 | ::aws_smithy_http_server::response::Response,
|
47 67 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
48 68 | > {
|
69 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
49 70 | Ok({
|
71 + | /* RustType.kt:534 */
|
50 72 | #[allow(unused_mut)]
|
51 - | let mut builder = ::http::Response::builder();
|
73 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
74 + | let mut builder = ::http_1x::Response::builder();
|
75 + | /* ServerHttpBoundProtocolGenerator.kt:665 */
|
52 76 | builder =
|
53 77 | crate::protocol_serde::shape_test_body_structure::ser_test_body_structure_headers(
|
54 78 | &output, builder,
|
55 79 | )?;
|
80 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
56 81 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
57 82 | builder,
|
58 - | ::http::header::CONTENT_TYPE,
|
83 + | ::http_1x::header::CONTENT_TYPE,
|
59 84 | "application/json",
|
60 85 | );
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
61 87 | let http_status: u16 = 200;
|
62 88 | builder = builder.status(http_status);
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
63 90 | let payload =
|
64 - | crate::protocol_serde::shape_test_body_structure_output::ser_test_body_structure_output_output_output(&output)?
|
65 - | ;
|
91 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_test_body_structure_output::ser_test_body_structure_output_output_output(&output)?
|
92 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
93 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
66 94 | let content_length = payload.len();
|
67 95 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
68 96 | builder,
|
69 - | ::http::header::CONTENT_LENGTH,
|
97 + | ::http_1x::header::CONTENT_LENGTH,
|
70 98 | content_length,
|
71 99 | );
|
100 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
72 101 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
102 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
73 103 | builder.body(body)?
|
104 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
74 105 | })
|
106 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
75 107 | }
|
76 108 |
|
109 + | /* JsonParserGenerator.kt:148 */
|
77 110 | pub(crate) fn de_test_body_structure(
|
78 111 | value: &[u8],
|
79 112 | mut builder: crate::input::test_body_structure_input::Builder,
|
80 113 | ) -> ::std::result::Result<
|
81 114 | crate::input::test_body_structure_input::Builder,
|
82 115 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
83 116 | > {
|
117 + | /* JsonParserGenerator.kt:153 */
|
84 118 | let mut tokens_owned =
|
85 119 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
86 120 | .peekable();
|
87 121 | let tokens = &mut tokens_owned;
|
88 122 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
123 + | /* JsonParserGenerator.kt:684 */
|
89 124 | loop {
|
125 + | /* JsonParserGenerator.kt:685 */
|
90 126 | match tokens.next().transpose()? {
|
127 + | /* JsonParserGenerator.kt:686 */
|
91 128 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
92 129 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
130 + | /* JsonParserGenerator.kt:260 */
|
93 131 | match key.to_unescaped()?.as_ref() {
|
132 + | /* JsonParserGenerator.kt:262 */
|
94 133 | "testConfig" => {
|
134 + | /* JsonParserGenerator.kt:272 */
|
95 135 | builder = builder.set_test_config(
|
96 - | crate::protocol_serde::shape_test_config::de_test_config(tokens)?,
|
97 - | );
|
136 + | /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_test_config::de_test_config(tokens)?
|
137 + | /* JsonParserGenerator.kt:272 */);
|
138 + | /* JsonParserGenerator.kt:262 */
|
98 139 | }
|
99 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
140 + | /* JsonParserGenerator.kt:290 */
|
141 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
100 142 | }
|
143 + | /* JsonParserGenerator.kt:686 */
|
101 144 | }
|
145 + | /* JsonParserGenerator.kt:695 */
|
102 146 | other => {
|
103 147 | return Err(
|
104 148 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
105 149 | "expected object key or end object, found: {other:?}"
|
106 150 | )),
|
107 151 | )
|
152 + | } /* JsonParserGenerator.kt:685 */
|
108 153 | }
|
154 + | /* JsonParserGenerator.kt:684 */
|
109 155 | }
|
110 - | }
|
156 + | /* JsonParserGenerator.kt:250 */
|
111 157 | if tokens.next().is_some() {
|
158 + | /* JsonParserGenerator.kt:251 */
|
112 159 | return Err(
|
113 160 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
114 161 | "found more JSON tokens after completing parsing",
|
115 162 | ),
|
116 163 | );
|
164 + | /* JsonParserGenerator.kt:250 */
|
117 165 | }
|
166 + | /* JsonParserGenerator.kt:163 */
|
118 167 | Ok(builder)
|
168 + | /* JsonParserGenerator.kt:148 */
|
119 169 | }
|
120 170 |
|
171 + | /* HttpBindingGenerator.kt:565 */
|
121 172 | pub fn ser_test_body_structure_headers(
|
122 173 | input: &crate::output::TestBodyStructureOutput,
|
123 - | mut builder: ::http::response::Builder,
|
124 - | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
125 - | {
|
174 + | mut builder: ::http_1x::response::Builder,
|
175 + | ) -> std::result::Result<
|
176 + | ::http_1x::response::Builder,
|
177 + | ::aws_smithy_types::error::operation::BuildError,
|
178 + | > {
|
179 + | /* HttpBindingGenerator.kt:615 */
|
126 180 | if let ::std::option::Option::Some(inner_1) = &input.test_id {
|
181 + | /* HttpBindingGenerator.kt:727 */
|
127 182 | let formatted_2 = inner_1.as_str();
|
183 + | /* HttpBindingGenerator.kt:728 */
|
128 184 | if !formatted_2.is_empty() {
|
185 + | /* HttpBindingGenerator.kt:729 */
|
129 186 | let header_value = formatted_2;
|
130 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
187 + | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
131 188 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
132 189 | "test_id",
|
133 190 | format!(
|
134 191 | "`{}` cannot be used as a header value: {}",
|
135 192 | &header_value, err
|
136 193 | ),
|
137 194 | )
|
138 195 | })?;
|
139 196 | builder = builder.header("x-amz-test-id", header_value);
|
197 + | /* HttpBindingGenerator.kt:728 */
|
140 198 | }
|
199 + | /* HttpBindingGenerator.kt:615 */
|
141 200 | }
|
201 + | /* HttpBindingGenerator.kt:578 */
|
142 202 | Ok(builder)
|
203 + | /* HttpBindingGenerator.kt:565 */
|
143 204 | }
|