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_timestamp_format_headers_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::TimestampFormatHeadersInput,
|
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::timestamp_format_headers_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:856 */
|
30 + | if let Some(value) =
|
31 + | crate::protocol_serde::shape_timestamp_format_headers_input::de_default_format_header(
|
32 + | &headers,
|
33 + | )?
|
34 + | {
|
35 + | input = input.set_default_format(Some(value))
|
36 + | }
|
37 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
38 + | if let Some(value) =
|
39 + | crate::protocol_serde::shape_timestamp_format_headers_input::de_member_date_time_header(
|
40 + | &headers,
|
41 + | )?
|
42 + | {
|
43 + | input = input.set_member_date_time(Some(value))
|
44 + | }
|
45 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
46 + | if let Some(value) = crate::protocol_serde::shape_timestamp_format_headers_input::de_member_epoch_seconds_header(&headers)? {
|
47 + | input = input.set_member_epoch_seconds(Some(value))
|
48 + | }
|
49 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
50 + | if let Some(value) =
|
51 + | crate::protocol_serde::shape_timestamp_format_headers_input::de_member_http_date_header(
|
52 + | &headers,
|
53 + | )?
|
54 + | {
|
55 + | input = input.set_member_http_date(Some(value))
|
56 + | }
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
58 + | if let Some(value) =
|
59 + | crate::protocol_serde::shape_timestamp_format_headers_input::de_target_date_time_header(
|
60 + | &headers,
|
61 + | )?
|
62 + | {
|
63 + | input = input.set_target_date_time(Some(value))
|
64 + | }
|
65 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
66 + | if let Some(value) = crate::protocol_serde::shape_timestamp_format_headers_input::de_target_epoch_seconds_header(&headers)? {
|
67 + | input = input.set_target_epoch_seconds(Some(value))
|
68 + | }
|
69 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
70 + | if let Some(value) =
|
71 + | crate::protocol_serde::shape_timestamp_format_headers_input::de_target_http_date_header(
|
72 + | &headers,
|
73 + | )?
|
74 + | {
|
75 + | input = input.set_target_http_date(Some(value))
|
76 + | }
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
78 + | input.build()
|
79 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
80 + | })
|
81 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
82 + | }
|
83 + |
|
84 + | /* RustType.kt:534 */
|
85 + | #[allow(clippy::unnecessary_wraps)]
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
87 + | pub fn ser_timestamp_format_headers_http_response(
|
88 + | #[allow(unused_variables)] output: crate::output::TimestampFormatHeadersOutput,
|
89 + | ) -> std::result::Result<
|
90 + | ::aws_smithy_legacy_http_server::response::Response,
|
91 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
92 + | > {
|
93 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
94 + | Ok({
|
95 + | /* RustType.kt:534 */
|
96 + | #[allow(unused_mut)]
|
97 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
98 + | let mut builder = ::http::Response::builder();
|
99 + | /* ServerHttpBoundProtocolGenerator.kt:665 */
|
100 + | builder = crate::protocol_serde::shape_timestamp_format_headers::ser_timestamp_format_headers_headers(&output, builder)?;
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
102 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
103 + | builder,
|
104 + | ::http::header::CONTENT_TYPE,
|
105 + | "application/json",
|
106 + | );
|
107 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
108 + | let http_status: u16 = 200;
|
109 + | builder = builder.status(http_status);
|
110 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
111 + | let payload =
|
112 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_timestamp_format_headers_output::ser_timestamp_format_headers_output_output_output(&output)?
|
113 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
114 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
115 + | let content_length = payload.len();
|
116 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
117 + | builder,
|
118 + | ::http::header::CONTENT_LENGTH,
|
119 + | content_length,
|
120 + | );
|
121 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
122 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
124 + | builder.body(body)?
|
125 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
126 + | })
|
127 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
128 + | }
|
129 + |
|
130 + | /* HttpBindingGenerator.kt:565 */
|
131 + | pub fn ser_timestamp_format_headers_headers(
|
132 + | input: &crate::output::TimestampFormatHeadersOutput,
|
133 + | mut builder: ::http::response::Builder,
|
134 + | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
135 + | {
|
136 + | /* HttpBindingGenerator.kt:615 */
|
137 + | if let ::std::option::Option::Some(inner_1) = &input.member_epoch_seconds {
|
138 + | /* HttpBindingGenerator.kt:727 */
|
139 + | let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
|
140 + | /* HttpBindingGenerator.kt:728 */
|
141 + | if !formatted_2.is_empty() {
|
142 + | /* HttpBindingGenerator.kt:729 */
|
143 + | let header_value = formatted_2;
|
144 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
145 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
146 + | "member_epoch_seconds",
|
147 + | format!(
|
148 + | "`{}` cannot be used as a header value: {}",
|
149 + | &header_value, err
|
150 + | ),
|
151 + | )
|
152 + | })?;
|
153 + | builder = builder.header("X-memberEpochSeconds", header_value);
|
154 + | /* HttpBindingGenerator.kt:728 */
|
155 + | }
|
156 + | /* HttpBindingGenerator.kt:615 */
|
157 + | }
|
158 + | /* HttpBindingGenerator.kt:615 */
|
159 + | if let ::std::option::Option::Some(inner_3) = &input.member_http_date {
|
160 + | /* HttpBindingGenerator.kt:727 */
|
161 + | let formatted_4 = inner_3.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
162 + | /* HttpBindingGenerator.kt:728 */
|
163 + | if !formatted_4.is_empty() {
|
164 + | /* HttpBindingGenerator.kt:729 */
|
165 + | let header_value = formatted_4;
|
166 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
167 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
168 + | "member_http_date",
|
169 + | format!(
|
170 + | "`{}` cannot be used as a header value: {}",
|
171 + | &header_value, err
|
172 + | ),
|
173 + | )
|
174 + | })?;
|
175 + | builder = builder.header("X-memberHttpDate", header_value);
|
176 + | /* HttpBindingGenerator.kt:728 */
|
177 + | }
|
178 + | /* HttpBindingGenerator.kt:615 */
|
179 + | }
|
180 + | /* HttpBindingGenerator.kt:615 */
|
181 + | if let ::std::option::Option::Some(inner_5) = &input.member_date_time {
|
182 + | /* HttpBindingGenerator.kt:727 */
|
183 + | let formatted_6 = inner_5.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
|
184 + | /* HttpBindingGenerator.kt:728 */
|
185 + | if !formatted_6.is_empty() {
|
186 + | /* HttpBindingGenerator.kt:729 */
|
187 + | let header_value = formatted_6;
|
188 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
189 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
190 + | "member_date_time",
|
191 + | format!(
|
192 + | "`{}` cannot be used as a header value: {}",
|
193 + | &header_value, err
|
194 + | ),
|
195 + | )
|
196 + | })?;
|
197 + | builder = builder.header("X-memberDateTime", header_value);
|
198 + | /* HttpBindingGenerator.kt:728 */
|
199 + | }
|
200 + | /* HttpBindingGenerator.kt:615 */
|
201 + | }
|
202 + | /* HttpBindingGenerator.kt:615 */
|
203 + | if let ::std::option::Option::Some(inner_7) = &input.default_format {
|
204 + | /* HttpBindingGenerator.kt:727 */
|
205 + | let formatted_8 = inner_7.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
206 + | /* HttpBindingGenerator.kt:728 */
|
207 + | if !formatted_8.is_empty() {
|
208 + | /* HttpBindingGenerator.kt:729 */
|
209 + | let header_value = formatted_8;
|
210 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
211 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
212 + | "default_format",
|
213 + | format!(
|
214 + | "`{}` cannot be used as a header value: {}",
|
215 + | &header_value, err
|
216 + | ),
|
217 + | )
|
218 + | })?;
|
219 + | builder = builder.header("X-defaultFormat", header_value);
|
220 + | /* HttpBindingGenerator.kt:728 */
|
221 + | }
|
222 + | /* HttpBindingGenerator.kt:615 */
|
223 + | }
|
224 + | /* HttpBindingGenerator.kt:615 */
|
225 + | if let ::std::option::Option::Some(inner_9) = &input.target_epoch_seconds {
|
226 + | /* HttpBindingGenerator.kt:727 */
|
227 + | let formatted_10 = inner_9.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
|
228 + | /* HttpBindingGenerator.kt:728 */
|
229 + | if !formatted_10.is_empty() {
|
230 + | /* HttpBindingGenerator.kt:729 */
|
231 + | let header_value = formatted_10;
|
232 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
233 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
234 + | "target_epoch_seconds",
|
235 + | format!(
|
236 + | "`{}` cannot be used as a header value: {}",
|
237 + | &header_value, err
|
238 + | ),
|
239 + | )
|
240 + | })?;
|
241 + | builder = builder.header("X-targetEpochSeconds", header_value);
|
242 + | /* HttpBindingGenerator.kt:728 */
|
243 + | }
|
244 + | /* HttpBindingGenerator.kt:615 */
|
245 + | }
|
246 + | /* HttpBindingGenerator.kt:615 */
|
247 + | if let ::std::option::Option::Some(inner_11) = &input.target_http_date {
|
248 + | /* HttpBindingGenerator.kt:727 */
|
249 + | let formatted_12 = inner_11.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
250 + | /* HttpBindingGenerator.kt:728 */
|
251 + | if !formatted_12.is_empty() {
|
252 + | /* HttpBindingGenerator.kt:729 */
|
253 + | let header_value = formatted_12;
|
254 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
255 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
256 + | "target_http_date",
|
257 + | format!(
|
258 + | "`{}` cannot be used as a header value: {}",
|
259 + | &header_value, err
|
260 + | ),
|
261 + | )
|
262 + | })?;
|
263 + | builder = builder.header("X-targetHttpDate", header_value);
|
264 + | /* HttpBindingGenerator.kt:728 */
|
265 + | }
|
266 + | /* HttpBindingGenerator.kt:615 */
|
267 + | }
|
268 + | /* HttpBindingGenerator.kt:615 */
|
269 + | if let ::std::option::Option::Some(inner_13) = &input.target_date_time {
|
270 + | /* HttpBindingGenerator.kt:727 */
|
271 + | let formatted_14 = inner_13.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
|
272 + | /* HttpBindingGenerator.kt:728 */
|
273 + | if !formatted_14.is_empty() {
|
274 + | /* HttpBindingGenerator.kt:729 */
|
275 + | let header_value = formatted_14;
|
276 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
277 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
278 + | "target_date_time",
|
279 + | format!(
|
280 + | "`{}` cannot be used as a header value: {}",
|
281 + | &header_value, err
|
282 + | ),
|
283 + | )
|
284 + | })?;
|
285 + | builder = builder.header("X-targetDateTime", header_value);
|
286 + | /* HttpBindingGenerator.kt:728 */
|
287 + | }
|
288 + | /* HttpBindingGenerator.kt:615 */
|
289 + | }
|
290 + | /* HttpBindingGenerator.kt:578 */
|
291 + | Ok(builder)
|
292 + | /* HttpBindingGenerator.kt:565 */
|
293 + | }
|