1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_timestamp_format_headers_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<
|
8 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersOutput,
|
9 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersError,
|
10 - | > {
|
11 - | #[allow(unused_mut)]
|
12 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
13 - | .map_err(crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled)?;
|
14 - | let generic = generic_builder.build();
|
15 - | Err(crate::operation::timestamp_format_headers::TimestampFormatHeadersError::generic(generic))
|
16 - | }
|
17 - |
|
18 - | #[allow(clippy::unnecessary_wraps)]
|
19 - | pub fn de_timestamp_format_headers_http_response(
|
20 - | _response_status: u16,
|
21 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
22 - | _response_body: &[u8],
|
23 - | ) -> std::result::Result<
|
24 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersOutput,
|
25 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersError,
|
26 - | > {
|
27 - | Ok({
|
28 - | #[allow(unused_mut)]
|
29 - | let mut output = crate::operation::timestamp_format_headers::builders::TimestampFormatHeadersOutputBuilder::default();
|
30 - | output = output.set_default_format(
|
31 - | crate::protocol_serde::shape_timestamp_format_headers_output::de_default_format_header(_response_headers).map_err(|_| {
|
32 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
|
33 - | "Failed to parse defaultFormat from header `X-defaultFormat",
|
34 - | )
|
35 - | })?,
|
36 - | );
|
37 - | output = output.set_member_date_time(
|
38 - | crate::protocol_serde::shape_timestamp_format_headers_output::de_member_date_time_header(_response_headers).map_err(|_| {
|
39 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
|
40 - | "Failed to parse memberDateTime from header `X-memberDateTime",
|
41 - | )
|
42 - | })?,
|
43 - | );
|
44 - | output = output.set_member_epoch_seconds(
|
45 - | crate::protocol_serde::shape_timestamp_format_headers_output::de_member_epoch_seconds_header(_response_headers).map_err(|_| {
|
46 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
|
47 - | "Failed to parse memberEpochSeconds from header `X-memberEpochSeconds",
|
48 - | )
|
49 - | })?,
|
50 - | );
|
51 - | output = output.set_member_http_date(
|
52 - | crate::protocol_serde::shape_timestamp_format_headers_output::de_member_http_date_header(_response_headers).map_err(|_| {
|
53 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
|
54 - | "Failed to parse memberHttpDate from header `X-memberHttpDate",
|
55 - | )
|
56 - | })?,
|
57 - | );
|
58 - | output = output.set_target_date_time(
|
59 - | crate::protocol_serde::shape_timestamp_format_headers_output::de_target_date_time_header(_response_headers).map_err(|_| {
|
60 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
|
61 - | "Failed to parse targetDateTime from header `X-targetDateTime",
|
62 - | )
|
63 - | })?,
|
64 - | );
|
65 - | output = output.set_target_epoch_seconds(
|
66 - | crate::protocol_serde::shape_timestamp_format_headers_output::de_target_epoch_seconds_header(_response_headers).map_err(|_| {
|
67 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
|
68 - | "Failed to parse targetEpochSeconds from header `X-targetEpochSeconds",
|
69 - | )
|
70 - | })?,
|
71 - | );
|
72 - | output = output.set_target_http_date(
|
73 - | crate::protocol_serde::shape_timestamp_format_headers_output::de_target_http_date_header(_response_headers).map_err(|_| {
|
74 - | crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
|
75 - | "Failed to parse targetHttpDate from header `X-targetHttpDate",
|
76 - | )
|
77 - | })?,
|
78 - | );
|
79 - | output.build()
|
80 - | })
|
81 - | }
|
82 - |
|
83 - | pub fn ser_timestamp_format_headers_headers(
|
84 - | input: &crate::operation::timestamp_format_headers::TimestampFormatHeadersInput,
|
85 - | mut builder: ::http_1x::request::Builder,
|
86 - | ) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
87 - | if let ::std::option::Option::Some(inner_1) = &input.member_epoch_seconds {
|
88 - | let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
|
89 - | let header_value = formatted_2;
|
90 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
91 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
92 - | "member_epoch_seconds",
|
93 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
94 - | )
|
95 - | })?;
|
96 - | builder = builder.header("X-memberEpochSeconds", header_value);
|
97 - | }
|
98 - | if let ::std::option::Option::Some(inner_3) = &input.member_http_date {
|
99 - | let formatted_4 = inner_3.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
100 - | let header_value = formatted_4;
|
101 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
102 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
103 - | "member_http_date",
|
104 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
105 - | )
|
106 - | })?;
|
107 - | builder = builder.header("X-memberHttpDate", header_value);
|
108 - | }
|
109 - | if let ::std::option::Option::Some(inner_5) = &input.member_date_time {
|
110 - | let formatted_6 = inner_5.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
|
111 - | let header_value = formatted_6;
|
112 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
113 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
114 - | "member_date_time",
|
115 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
116 - | )
|
117 - | })?;
|
118 - | builder = builder.header("X-memberDateTime", header_value);
|
119 - | }
|
120 - | if let ::std::option::Option::Some(inner_7) = &input.default_format {
|
121 - | let formatted_8 = inner_7.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
122 - | let header_value = formatted_8;
|
123 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
124 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
125 - | "default_format",
|
126 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
127 - | )
|
128 - | })?;
|
129 - | builder = builder.header("X-defaultFormat", header_value);
|
130 - | }
|
131 - | if let ::std::option::Option::Some(inner_9) = &input.target_epoch_seconds {
|
132 - | let formatted_10 = inner_9.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
|
133 - | let header_value = formatted_10;
|
134 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
135 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
136 - | "target_epoch_seconds",
|
137 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
138 - | )
|
139 - | })?;
|
140 - | builder = builder.header("X-targetEpochSeconds", header_value);
|
141 - | }
|
142 - | if let ::std::option::Option::Some(inner_11) = &input.target_http_date {
|
143 - | let formatted_12 = inner_11.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
144 - | let header_value = formatted_12;
|
145 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
146 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
147 - | "target_http_date",
|
148 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
149 - | )
|
150 - | })?;
|
151 - | builder = builder.header("X-targetHttpDate", header_value);
|
152 - | }
|
153 - | if let ::std::option::Option::Some(inner_13) = &input.target_date_time {
|
154 - | let formatted_14 = inner_13.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
|
155 - | let header_value = formatted_14;
|
156 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
157 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
158 - | "target_date_time",
|
159 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
160 - | )
|
161 - | })?;
|
162 - | builder = builder.header("X-targetDateTime", header_value);
|
163 - | }
|
164 - | Ok(builder)
|
165 - | }
|