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_timestamp_format_headers_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::TimestampFormatHeadersInput,
|
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::timestamp_format_headers_input_internal::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_timestamp_format_headers_input::de_default_format_header(
|
24 32 | &headers,
|
25 33 | )?
|
26 34 | {
|
27 35 | input = input.set_default_format(Some(value))
|
28 36 | }
|
37 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
29 38 | if let Some(value) =
|
30 39 | crate::protocol_serde::shape_timestamp_format_headers_input::de_member_date_time_header(
|
31 40 | &headers,
|
32 41 | )?
|
33 42 | {
|
34 43 | input = input.set_member_date_time(Some(value))
|
35 44 | }
|
45 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
36 46 | if let Some(value) = crate::protocol_serde::shape_timestamp_format_headers_input::de_member_epoch_seconds_header(&headers)? {
|
37 47 | input = input.set_member_epoch_seconds(Some(value))
|
38 48 | }
|
49 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
39 50 | if let Some(value) =
|
40 51 | crate::protocol_serde::shape_timestamp_format_headers_input::de_member_http_date_header(
|
41 52 | &headers,
|
42 53 | )?
|
43 54 | {
|
44 55 | input = input.set_member_http_date(Some(value))
|
45 56 | }
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
46 58 | if let Some(value) =
|
47 59 | crate::protocol_serde::shape_timestamp_format_headers_input::de_target_date_time_header(
|
48 60 | &headers,
|
49 61 | )?
|
50 62 | {
|
51 63 | input = input.set_target_date_time(Some(value))
|
52 64 | }
|
65 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
53 66 | if let Some(value) = crate::protocol_serde::shape_timestamp_format_headers_input::de_target_epoch_seconds_header(&headers)? {
|
54 67 | input = input.set_target_epoch_seconds(Some(value))
|
55 68 | }
|
69 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
56 70 | if let Some(value) =
|
57 71 | crate::protocol_serde::shape_timestamp_format_headers_input::de_target_http_date_header(
|
58 72 | &headers,
|
59 73 | )?
|
60 74 | {
|
61 75 | input = input.set_target_http_date(Some(value))
|
62 76 | }
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
63 78 | input.build()
|
79 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
64 80 | })
|
81 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
65 82 | }
|
66 83 |
|
84 + | /* RustType.kt:516 */
|
67 85 | #[allow(clippy::unnecessary_wraps)]
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
68 87 | pub fn ser_timestamp_format_headers_http_response(
|
69 88 | #[allow(unused_variables)] output: crate::output::TimestampFormatHeadersOutput,
|
70 89 | ) -> std::result::Result<
|
71 90 | ::aws_smithy_http_server::response::Response,
|
72 91 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
73 92 | > {
|
93 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
74 94 | Ok({
|
95 + | /* RustType.kt:516 */
|
75 96 | #[allow(unused_mut)]
|
97 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
76 98 | let mut builder = ::http::Response::builder();
|
99 + | /* ServerHttpBoundProtocolGenerator.kt:629 */
|
77 100 | builder = crate::protocol_serde::shape_timestamp_format_headers::ser_timestamp_format_headers_headers(&output, builder)?;
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
78 102 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
79 103 | builder,
|
80 104 | ::http::header::CONTENT_TYPE,
|
81 105 | "application/json",
|
82 106 | );
|
107 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
83 108 | let http_status: u16 = 200;
|
84 109 | builder = builder.status(http_status);
|
110 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
85 111 | let payload =
|
86 - | crate::protocol_serde::shape_timestamp_format_headers_output::ser_timestamp_format_headers_output_output_output(&output)?
|
87 - | ;
|
112 + | /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_timestamp_format_headers_output::ser_timestamp_format_headers_output_output_output(&output)?
|
113 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
114 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
88 115 | let content_length = payload.len();
|
89 116 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
90 117 | builder,
|
91 118 | ::http::header::CONTENT_LENGTH,
|
92 119 | content_length,
|
93 120 | );
|
121 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
94 122 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
95 124 | builder.body(body)?
|
125 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
96 126 | })
|
127 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
97 128 | }
|
98 129 |
|
130 + | /* RustType.kt:516 */
|
99 131 | #[allow(clippy::unnecessary_wraps)]
|
132 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
100 133 | pub fn ser_timestamp_format_headers_http_error(
|
101 134 | error: &crate::error::TimestampFormatHeadersError,
|
102 135 | ) -> std::result::Result<
|
103 136 | ::aws_smithy_http_server::response::Response,
|
104 137 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
105 138 | > {
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
106 140 | Ok({
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
107 142 | match error {
|
143 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
108 144 | crate::error::TimestampFormatHeadersError::InternalServerError(output) => {
|
145 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
109 146 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
147 + | /* RustType.kt:516 */
|
110 148 | #[allow(unused_mut)]
|
149 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
111 150 | let mut builder = ::http::Response::builder();
|
151 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
112 152 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
113 153 | builder,
|
114 154 | ::http::header::CONTENT_TYPE,
|
115 155 | "application/json",
|
116 156 | );
|
157 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
117 158 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
118 159 | builder,
|
119 160 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
120 161 | "InternalServerError",
|
121 162 | );
|
163 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
122 164 | let content_length = payload.len();
|
123 165 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
124 166 | builder,
|
125 167 | ::http::header::CONTENT_LENGTH,
|
126 168 | content_length,
|
127 169 | );
|
170 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
128 171 | builder
|
129 172 | .status(500)
|
130 173 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
174 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
175 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
131 176 | }
|
132 - | }
|
177 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
133 178 | })
|
179 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
134 180 | }
|
135 181 |
|
182 + | /* HttpBindingGenerator.kt:542 */
|
136 183 | pub fn ser_timestamp_format_headers_headers(
|
137 184 | input: &crate::output::TimestampFormatHeadersOutput,
|
138 185 | mut builder: ::http::response::Builder,
|
139 186 | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
140 187 | {
|
188 + | /* HttpBindingGenerator.kt:592 */
|
141 189 | if let ::std::option::Option::Some(inner_1) = &input.member_epoch_seconds {
|
190 + | /* HttpBindingGenerator.kt:704 */
|
142 191 | let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
|
192 + | /* HttpBindingGenerator.kt:705 */
|
143 193 | if !formatted_2.is_empty() {
|
194 + | /* HttpBindingGenerator.kt:706 */
|
144 195 | let header_value = formatted_2;
|
145 196 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
146 197 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
147 198 | "member_epoch_seconds",
|
148 199 | format!(
|
149 200 | "`{}` cannot be used as a header value: {}",
|
150 201 | &header_value, err
|
151 202 | ),
|
152 203 | )
|
153 204 | })?;
|
154 205 | builder = builder.header("X-memberEpochSeconds", header_value);
|
206 + | /* HttpBindingGenerator.kt:705 */
|
155 207 | }
|
208 + | /* HttpBindingGenerator.kt:592 */
|
156 209 | }
|
210 + | /* HttpBindingGenerator.kt:592 */
|
157 211 | if let ::std::option::Option::Some(inner_3) = &input.member_http_date {
|
212 + | /* HttpBindingGenerator.kt:704 */
|
158 213 | let formatted_4 = inner_3.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
214 + | /* HttpBindingGenerator.kt:705 */
|
159 215 | if !formatted_4.is_empty() {
|
216 + | /* HttpBindingGenerator.kt:706 */
|
160 217 | let header_value = formatted_4;
|
161 218 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
162 219 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
163 220 | "member_http_date",
|
164 221 | format!(
|
165 222 | "`{}` cannot be used as a header value: {}",
|
166 223 | &header_value, err
|
167 224 | ),
|
168 225 | )
|
169 226 | })?;
|
170 227 | builder = builder.header("X-memberHttpDate", header_value);
|
228 + | /* HttpBindingGenerator.kt:705 */
|
171 229 | }
|
230 + | /* HttpBindingGenerator.kt:592 */
|
172 231 | }
|
232 + | /* HttpBindingGenerator.kt:592 */
|
173 233 | if let ::std::option::Option::Some(inner_5) = &input.member_date_time {
|
234 + | /* HttpBindingGenerator.kt:704 */
|
174 235 | let formatted_6 = inner_5.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
|
236 + | /* HttpBindingGenerator.kt:705 */
|
175 237 | if !formatted_6.is_empty() {
|
238 + | /* HttpBindingGenerator.kt:706 */
|
176 239 | let header_value = formatted_6;
|
177 240 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
178 241 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
179 242 | "member_date_time",
|
180 243 | format!(
|
181 244 | "`{}` cannot be used as a header value: {}",
|
182 245 | &header_value, err
|
183 246 | ),
|
184 247 | )
|
185 248 | })?;
|
186 249 | builder = builder.header("X-memberDateTime", header_value);
|
250 + | /* HttpBindingGenerator.kt:705 */
|
187 251 | }
|
252 + | /* HttpBindingGenerator.kt:592 */
|
188 253 | }
|
254 + | /* HttpBindingGenerator.kt:592 */
|
189 255 | if let ::std::option::Option::Some(inner_7) = &input.default_format {
|
256 + | /* HttpBindingGenerator.kt:704 */
|
190 257 | let formatted_8 = inner_7.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
258 + | /* HttpBindingGenerator.kt:705 */
|
191 259 | if !formatted_8.is_empty() {
|
260 + | /* HttpBindingGenerator.kt:706 */
|
192 261 | let header_value = formatted_8;
|
193 262 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
194 263 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
195 264 | "default_format",
|
196 265 | format!(
|
197 266 | "`{}` cannot be used as a header value: {}",
|
198 267 | &header_value, err
|
199 268 | ),
|
200 269 | )
|
201 270 | })?;
|
202 271 | builder = builder.header("X-defaultFormat", header_value);
|
272 + | /* HttpBindingGenerator.kt:705 */
|
203 273 | }
|
274 + | /* HttpBindingGenerator.kt:592 */
|
204 275 | }
|
276 + | /* HttpBindingGenerator.kt:592 */
|
205 277 | if let ::std::option::Option::Some(inner_9) = &input.target_epoch_seconds {
|
278 + | /* HttpBindingGenerator.kt:704 */
|
206 279 | let formatted_10 = inner_9.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
|
280 + | /* HttpBindingGenerator.kt:705 */
|
207 281 | if !formatted_10.is_empty() {
|
282 + | /* HttpBindingGenerator.kt:706 */
|
208 283 | let header_value = formatted_10;
|
209 284 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
210 285 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
211 286 | "target_epoch_seconds",
|
212 287 | format!(
|
213 288 | "`{}` cannot be used as a header value: {}",
|
214 289 | &header_value, err
|
215 290 | ),
|
216 291 | )
|
217 292 | })?;
|
218 293 | builder = builder.header("X-targetEpochSeconds", header_value);
|
294 + | /* HttpBindingGenerator.kt:705 */
|
219 295 | }
|
296 + | /* HttpBindingGenerator.kt:592 */
|
220 297 | }
|
298 + | /* HttpBindingGenerator.kt:592 */
|
221 299 | if let ::std::option::Option::Some(inner_11) = &input.target_http_date {
|
300 + | /* HttpBindingGenerator.kt:704 */
|
222 301 | let formatted_12 = inner_11.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
302 + | /* HttpBindingGenerator.kt:705 */
|
223 303 | if !formatted_12.is_empty() {
|
304 + | /* HttpBindingGenerator.kt:706 */
|
224 305 | let header_value = formatted_12;
|
225 306 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
226 307 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
227 308 | "target_http_date",
|
228 309 | format!(
|
229 310 | "`{}` cannot be used as a header value: {}",
|
230 311 | &header_value, err
|
231 312 | ),
|
232 313 | )
|
233 314 | })?;
|
234 315 | builder = builder.header("X-targetHttpDate", header_value);
|
316 + | /* HttpBindingGenerator.kt:705 */
|
235 317 | }
|
318 + | /* HttpBindingGenerator.kt:592 */
|
236 319 | }
|
320 + | /* HttpBindingGenerator.kt:592 */
|
237 321 | if let ::std::option::Option::Some(inner_13) = &input.target_date_time {
|
322 + | /* HttpBindingGenerator.kt:704 */
|
238 323 | let formatted_14 = inner_13.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
|
324 + | /* HttpBindingGenerator.kt:705 */
|
239 325 | if !formatted_14.is_empty() {
|
326 + | /* HttpBindingGenerator.kt:706 */
|
240 327 | let header_value = formatted_14;
|
241 328 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
242 329 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
243 330 | "target_date_time",
|
244 331 | format!(
|
245 332 | "`{}` cannot be used as a header value: {}",
|
246 333 | &header_value, err
|
247 334 | ),
|
248 335 | )
|
249 336 | })?;
|
250 337 | builder = builder.header("X-targetDateTime", header_value);
|
338 + | /* HttpBindingGenerator.kt:705 */
|
251 339 | }
|
340 + | /* HttpBindingGenerator.kt:592 */
|
252 341 | }
|
342 + | /* HttpBindingGenerator.kt:555 */
|
253 343 | Ok(builder)
|
344 + | /* HttpBindingGenerator.kt:542 */
|
254 345 | }
|