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_get_storage_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::GetStorageInput,
|
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::get_storage_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:794 */
|
22 30 | if let Some(value) =
|
23 31 | crate::protocol_serde::shape_get_storage_input::de_passcode_header(&headers)?
|
24 32 | {
|
25 33 | input = input.set_passcode(value)
|
26 34 | }
|
35 + | /* ServerHttpBoundProtocolGenerator.kt:986 */
|
27 36 | let input_string = uri.path();
|
37 + | /* ServerHttpBoundProtocolGenerator.kt:998 */
|
28 38 | let (input_string, (_, m1)) =
|
29 39 | ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
|
30 40 | ::nom::sequence::preceded(
|
31 41 | ::nom::bytes::complete::tag("/"),
|
32 42 | ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>("pokedex"),
|
33 43 | ),
|
34 44 | ::nom::sequence::preceded(
|
35 45 | ::nom::bytes::complete::tag("/"),
|
36 46 | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
37 47 | ::nom::bytes::complete::take_until("/"),
|
38 48 | ::nom::combinator::rest,
|
39 49 | )),
|
40 50 | ),
|
41 51 | ))(input_string)?;
|
42 52 | debug_assert_eq!("", input_string);
|
53 + | /* ServerHttpBoundProtocolGenerator.kt:1009 */
|
43 54 | input = input.set_user(crate::protocol_serde::shape_get_storage_input::de_user(m1)?);
|
55 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
44 56 | input.build()?
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
45 58 | })
|
59 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
46 60 | }
|
47 61 |
|
62 + | /* RustType.kt:516 */
|
48 63 | #[allow(clippy::unnecessary_wraps)]
|
64 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
49 65 | pub fn ser_get_storage_http_response(
|
50 66 | #[allow(unused_variables)] output: crate::output::GetStorageOutput,
|
51 67 | ) -> std::result::Result<
|
52 68 | ::aws_smithy_http_server::response::Response,
|
53 69 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
54 70 | > {
|
71 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
55 72 | Ok({
|
73 + | /* RustType.kt:516 */
|
56 74 | #[allow(unused_mut)]
|
75 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
57 76 | let mut builder = ::http::Response::builder();
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
58 78 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
59 79 | builder,
|
60 80 | ::http::header::CONTENT_TYPE,
|
61 81 | "application/json",
|
62 82 | );
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
63 84 | let http_status: u16 = 200;
|
64 85 | builder = builder.status(http_status);
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
65 87 | let payload =
|
66 - | crate::protocol_serde::shape_get_storage_output::ser_get_storage_output_output_output(
|
67 - | &output,
|
68 - | )?;
|
88 + | /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_get_storage_output::ser_get_storage_output_output_output(&output)?
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
69 91 | let content_length = payload.len();
|
70 92 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
71 93 | builder,
|
72 94 | ::http::header::CONTENT_LENGTH,
|
73 95 | content_length,
|
74 96 | );
|
97 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
75 98 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
99 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
76 100 | builder.body(body)?
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
77 102 | })
|
103 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
78 104 | }
|
79 105 |
|
106 + | /* RustType.kt:516 */
|
80 107 | #[allow(clippy::unnecessary_wraps)]
|
108 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
81 109 | pub fn ser_get_storage_http_error(
|
82 110 | error: &crate::error::GetStorageError,
|
83 111 | ) -> std::result::Result<
|
84 112 | ::aws_smithy_http_server::response::Response,
|
85 113 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
86 114 | > {
|
115 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
87 116 | Ok({
|
117 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
88 118 | match error {
|
119 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
89 120 | crate::error::GetStorageError::ValidationException(output) => {
|
121 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
90 122 | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
123 + | /* RustType.kt:516 */
|
91 124 | #[allow(unused_mut)]
|
125 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
92 126 | let mut builder = ::http::Response::builder();
|
127 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
93 128 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
94 129 | builder,
|
95 130 | ::http::header::CONTENT_TYPE,
|
96 131 | "application/json",
|
97 132 | );
|
133 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
98 134 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
99 135 | builder,
|
100 136 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
101 137 | "ValidationException",
|
102 138 | );
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
103 140 | let content_length = payload.len();
|
104 141 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
105 142 | builder,
|
106 143 | ::http::header::CONTENT_LENGTH,
|
107 144 | content_length,
|
108 145 | );
|
146 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
109 147 | builder
|
110 148 | .status(400)
|
111 149 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
150 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
112 151 | }
|
152 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
113 153 | crate::error::GetStorageError::StorageAccessNotAuthorized(output) => {
|
154 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
114 155 | let payload = crate::protocol_serde::shape_storage_access_not_authorized::ser_storage_access_not_authorized_error(output)?;
|
156 + | /* RustType.kt:516 */
|
115 157 | #[allow(unused_mut)]
|
158 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
116 159 | let mut builder = ::http::Response::builder();
|
160 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
117 161 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
118 162 | builder,
|
119 163 | ::http::header::CONTENT_TYPE,
|
120 164 | "application/json",
|
121 165 | );
|
166 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
122 167 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
123 168 | builder,
|
124 169 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
125 170 | "StorageAccessNotAuthorized",
|
126 171 | );
|
172 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
127 173 | let content_length = payload.len();
|
128 174 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
129 175 | builder,
|
130 176 | ::http::header::CONTENT_LENGTH,
|
131 177 | content_length,
|
132 178 | );
|
179 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
133 180 | builder
|
134 181 | .status(401)
|
135 182 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
183 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
136 184 | }
|
185 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
137 186 | crate::error::GetStorageError::ResourceNotFoundException(output) => {
|
187 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
138 188 | let payload = crate::protocol_serde::shape_resource_not_found_exception::ser_resource_not_found_exception_error(output)?;
|
189 + | /* RustType.kt:516 */
|
139 190 | #[allow(unused_mut)]
|
191 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
140 192 | let mut builder = ::http::Response::builder();
|
193 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
141 194 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
142 195 | builder,
|
143 196 | ::http::header::CONTENT_TYPE,
|
144 197 | "application/json",
|
145 198 | );
|
199 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
146 200 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
147 201 | builder,
|
148 202 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
149 203 | "ResourceNotFoundException",
|
150 204 | );
|
205 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
151 206 | let content_length = payload.len();
|
152 207 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
153 208 | builder,
|
154 209 | ::http::header::CONTENT_LENGTH,
|
155 210 | content_length,
|
156 211 | );
|
212 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
157 213 | builder
|
158 214 | .status(404)
|
159 215 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
216 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
217 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
160 218 | }
|
161 - | }
|
219 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
162 220 | })
|
221 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
163 222 | }
|