1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:534 */
|
3 + | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
5 + | pub async fn de_put_with_content_encoding_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::PutWithContentEncodingInput,
|
9 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
10 + | >
|
11 + | where
|
12 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
13 + | B::Data: Send,
|
14 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
15 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
16 + | {
|
17 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
18 + | Ok({
|
19 + | /* RustType.kt:534 */
|
20 + | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
22 + | let mut input = crate::input::put_with_content_encoding_input::Builder::default();
|
23 + | /* RustType.kt:534 */
|
24 + | #[allow(unused_variables)]
|
25 + | /* ServerHttpBoundProtocolGenerator.kt:764 */
|
26 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
27 + | uri, headers, body, ..
|
28 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:801 */
|
30 + | let bytes = ::hyper::body::to_bytes(body).await?;
|
31 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
32 + | if !bytes.is_empty() {
|
33 + | /* ServerHttpBoundProtocolGenerator.kt:826 */
|
34 + | ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
|
35 + | &headers,
|
36 + | Some("application/json"),
|
37 + | )?;
|
38 + | input = crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding(bytes.as_ref(), input)?;
|
39 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
40 + | }
|
41 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
42 + | if let Some(value) =
|
43 + | crate::protocol_serde::shape_put_with_content_encoding_input::de_encoding_header(
|
44 + | &headers,
|
45 + | )?
|
46 + | {
|
47 + | input = input.set_encoding(Some(value))
|
48 + | }
|
49 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
50 + | input.build()
|
51 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
52 + | })
|
53 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
54 + | }
|
55 + |
|
56 + | /* RustType.kt:534 */
|
57 + | #[allow(clippy::unnecessary_wraps)]
|
58 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
59 + | pub fn ser_put_with_content_encoding_http_response(
|
60 + | #[allow(unused_variables)] output: crate::output::PutWithContentEncodingOutput,
|
61 + | ) -> std::result::Result<
|
62 + | ::aws_smithy_legacy_http_server::response::Response,
|
63 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
64 + | > {
|
65 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
66 + | Ok({
|
67 + | /* RustType.kt:534 */
|
68 + | #[allow(unused_mut)]
|
69 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
70 + | let mut builder = ::http::Response::builder();
|
71 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
72 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
73 + | builder,
|
74 + | ::http::header::CONTENT_TYPE,
|
75 + | "application/json",
|
76 + | );
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
78 + | let http_status: u16 = 200;
|
79 + | builder = builder.status(http_status);
|
80 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
81 + | let payload =
|
82 + | /* HttpBoundProtocolPayloadGenerator.kt:233 */""
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
84 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
85 + | let content_length = payload.len();
|
86 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
87 + | builder,
|
88 + | ::http::header::CONTENT_LENGTH,
|
89 + | content_length,
|
90 + | );
|
91 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
92 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
93 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
94 + | builder.body(body)?
|
95 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
96 + | })
|
97 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
98 + | }
|
99 + |
|
100 + | /* JsonParserGenerator.kt:148 */
|
101 + | pub(crate) fn de_put_with_content_encoding(
|
102 + | value: &[u8],
|
103 + | mut builder: crate::input::put_with_content_encoding_input::Builder,
|
104 + | ) -> ::std::result::Result<
|
105 + | crate::input::put_with_content_encoding_input::Builder,
|
106 + | ::aws_smithy_json::deserialize::error::DeserializeError,
|
107 + | > {
|
108 + | /* JsonParserGenerator.kt:153 */
|
109 + | let mut tokens_owned =
|
110 + | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
111 + | .peekable();
|
112 + | let tokens = &mut tokens_owned;
|
113 + | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
114 + | /* JsonParserGenerator.kt:684 */
|
115 + | loop {
|
116 + | /* JsonParserGenerator.kt:685 */
|
117 + | match tokens.next().transpose()? {
|
118 + | /* JsonParserGenerator.kt:686 */
|
119 + | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
120 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
121 + | /* JsonParserGenerator.kt:260 */
|
122 + | match key.to_unescaped()?.as_ref() {
|
123 + | /* JsonParserGenerator.kt:262 */
|
124 + | "data" => {
|
125 + | /* JsonParserGenerator.kt:272 */
|
126 + | builder = builder.set_data(
|
127 + | /* JsonParserGenerator.kt:354 */
|
128 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
129 + | tokens.next(),
|
130 + | )?
|
131 + | .map(|s|
|
132 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
133 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
134 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
135 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
136 + | );
|
137 + | /* JsonParserGenerator.kt:262 */
|
138 + | }
|
139 + | /* JsonParserGenerator.kt:290 */
|
140 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
141 + | }
|
142 + | /* JsonParserGenerator.kt:686 */
|
143 + | }
|
144 + | /* JsonParserGenerator.kt:695 */
|
145 + | other => {
|
146 + | return Err(
|
147 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
148 + | "expected object key or end object, found: {other:?}"
|
149 + | )),
|
150 + | )
|
151 + | } /* JsonParserGenerator.kt:685 */
|
152 + | }
|
153 + | /* JsonParserGenerator.kt:684 */
|
154 + | }
|
155 + | /* JsonParserGenerator.kt:250 */
|
156 + | if tokens.next().is_some() {
|
157 + | /* JsonParserGenerator.kt:251 */
|
158 + | return Err(
|
159 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
160 + | "found more JSON tokens after completing parsing",
|
161 + | ),
|
162 + | );
|
163 + | /* JsonParserGenerator.kt:250 */
|
164 + | }
|
165 + | /* JsonParserGenerator.kt:163 */
|
166 + | Ok(builder)
|
167 + | /* JsonParserGenerator.kt:148 */
|
168 + | }
|