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_put_with_content_encoding_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::PutWithContentEncodingInput,
|
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::put_with_content_encoding_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_put_with_content_encoding::de_put_with_content_encoding(bytes.as_ref(), input)?;
|
42 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
29 43 | }
|
44 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
30 45 | if let Some(value) =
|
31 46 | crate::protocol_serde::shape_put_with_content_encoding_input::de_encoding_header(
|
32 47 | &headers,
|
33 48 | )?
|
34 49 | {
|
35 50 | input = input.set_encoding(Some(value))
|
36 51 | }
|
52 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
37 53 | input.build()
|
54 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
38 55 | })
|
56 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
39 57 | }
|
40 58 |
|
59 + | /* RustType.kt:534 */
|
41 60 | #[allow(clippy::unnecessary_wraps)]
|
61 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
42 62 | pub fn ser_put_with_content_encoding_http_response(
|
43 63 | #[allow(unused_variables)] output: crate::output::PutWithContentEncodingOutput,
|
44 64 | ) -> std::result::Result<
|
45 65 | ::aws_smithy_http_server::response::Response,
|
46 66 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
47 67 | > {
|
68 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
48 69 | Ok({
|
70 + | /* RustType.kt:534 */
|
49 71 | #[allow(unused_mut)]
|
50 - | let mut builder = ::http::Response::builder();
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
73 + | let mut builder = ::http_1x::Response::builder();
|
74 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
51 75 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
52 76 | builder,
|
53 - | ::http::header::CONTENT_TYPE,
|
77 + | ::http_1x::header::CONTENT_TYPE,
|
54 78 | "application/json",
|
55 79 | );
|
80 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
56 81 | let http_status: u16 = 200;
|
57 82 | builder = builder.status(http_status);
|
58 - | let payload = "";
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
84 + | let payload =
|
85 + | /* HttpBoundProtocolPayloadGenerator.kt:233 */""
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
87 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
59 88 | let content_length = payload.len();
|
60 89 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
61 90 | builder,
|
62 - | ::http::header::CONTENT_LENGTH,
|
91 + | ::http_1x::header::CONTENT_LENGTH,
|
63 92 | content_length,
|
64 93 | );
|
94 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
65 95 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
96 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
66 97 | builder.body(body)?
|
98 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
67 99 | })
|
100 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
68 101 | }
|
69 102 |
|
103 + | /* JsonParserGenerator.kt:148 */
|
70 104 | pub(crate) fn de_put_with_content_encoding(
|
71 105 | value: &[u8],
|
72 106 | mut builder: crate::input::put_with_content_encoding_input::Builder,
|
73 107 | ) -> ::std::result::Result<
|
74 108 | crate::input::put_with_content_encoding_input::Builder,
|
75 109 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
76 110 | > {
|
111 + | /* JsonParserGenerator.kt:153 */
|
77 112 | let mut tokens_owned =
|
78 113 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
79 114 | .peekable();
|
80 115 | let tokens = &mut tokens_owned;
|
81 116 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
117 + | /* JsonParserGenerator.kt:684 */
|
82 118 | loop {
|
119 + | /* JsonParserGenerator.kt:685 */
|
83 120 | match tokens.next().transpose()? {
|
121 + | /* JsonParserGenerator.kt:686 */
|
84 122 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
85 123 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
124 + | /* JsonParserGenerator.kt:260 */
|
86 125 | match key.to_unescaped()?.as_ref() {
|
126 + | /* JsonParserGenerator.kt:262 */
|
87 127 | "data" => {
|
128 + | /* JsonParserGenerator.kt:272 */
|
88 129 | builder = builder.set_data(
|
130 + | /* JsonParserGenerator.kt:354 */
|
89 131 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
90 132 | tokens.next(),
|
91 133 | )?
|
92 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
93 - | .transpose()?,
|
134 + | .map(|s|
|
135 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
136 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
137 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
138 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
94 139 | );
|
140 + | /* JsonParserGenerator.kt:262 */
|
95 141 | }
|
96 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
142 + | /* JsonParserGenerator.kt:290 */
|
143 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
97 144 | }
|
145 + | /* JsonParserGenerator.kt:686 */
|
98 146 | }
|
147 + | /* JsonParserGenerator.kt:695 */
|
99 148 | other => {
|
100 149 | return Err(
|
101 150 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
102 151 | "expected object key or end object, found: {other:?}"
|
103 152 | )),
|
104 153 | )
|
105 - | }
|
154 + | } /* JsonParserGenerator.kt:685 */
|
106 155 | }
|
156 + | /* JsonParserGenerator.kt:684 */
|
107 157 | }
|
158 + | /* JsonParserGenerator.kt:250 */
|
108 159 | if tokens.next().is_some() {
|
160 + | /* JsonParserGenerator.kt:251 */
|
109 161 | return Err(
|
110 162 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
111 163 | "found more JSON tokens after completing parsing",
|
112 164 | ),
|
113 165 | );
|
166 + | /* JsonParserGenerator.kt:250 */
|
114 167 | }
|
168 + | /* JsonParserGenerator.kt:163 */
|
115 169 | Ok(builder)
|
170 + | /* JsonParserGenerator.kt:148 */
|
116 171 | }
|