133 137 | ::std::borrow::Cow::Owned(rcb)
|
134 138 | }
|
135 139 | }
|
136 140 |
|
137 141 | #[derive(Debug)]
|
138 142 | struct TimestampFormatHeadersResponseDeserializer;
|
139 143 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for TimestampFormatHeadersResponseDeserializer {
|
140 144 | fn deserialize_nonstreaming(
|
141 145 | &self,
|
142 146 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
147 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
143 148 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
144 149 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
150 + | #[allow(unused_mut)]
|
151 + | let mut force_error = false;
|
152 + |
|
153 + | if !success && status != 200 || force_error {
|
145 154 | let headers = response.headers();
|
146 155 | let body = response.body().bytes().expect("body loaded");
|
147 156 | #[allow(unused_mut)]
|
148 - | let mut force_error = false;
|
157 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
158 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
159 + | })?;
|
149 160 |
|
150 - | let parse_result = if !success && status != 200 || force_error {
|
151 - | crate::protocol_serde::shape_timestamp_format_headers::de_timestamp_format_headers_http_error(status, headers, body)
|
161 + | let generic = generic_builder.build();
|
162 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
163 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
|
164 + | crate::operation::timestamp_format_headers::TimestampFormatHeadersError::generic(generic),
|
165 + | ),
|
166 + | ))
|
152 167 | } else {
|
153 - | crate::protocol_serde::shape_timestamp_format_headers::de_timestamp_format_headers_http_response(status, headers, body)
|
154 - | };
|
155 - | crate::protocol_serde::type_erase_result(parse_result)
|
168 + | let protocol = _cfg
|
169 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
170 + | .expect("a SharedClientProtocol is required");
|
171 + | let mut deser = protocol
|
172 + | .deserialize_response(response, TimestampFormatHeaders::OUTPUT_SCHEMA, _cfg)
|
173 + | .map_err(|e| {
|
174 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
175 + | })?;
|
176 + | let body = response.body().bytes().expect("body loaded");
|
177 + | let output = crate::operation::timestamp_format_headers::TimestampFormatHeadersOutput::deserialize_with_response(
|
178 + | &mut *deser,
|
179 + | response.headers(),
|
180 + | response.status().into(),
|
181 + | body,
|
182 + | )
|
183 + | .map_err(|e| {
|
184 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
185 + | })?;
|
186 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
187 + | }
|
156 188 | }
|
157 189 | }
|
158 190 | #[derive(Debug)]
|
159 191 | struct TimestampFormatHeadersRequestSerializer;
|
160 192 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for TimestampFormatHeadersRequestSerializer {
|
161 193 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
162 194 | fn serialize_input(
|
163 195 | &self,
|
164 196 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
165 197 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
166 198 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
167 199 | let input = input
|
168 200 | .downcast::<crate::operation::timestamp_format_headers::TimestampFormatHeadersInput>()
|
169 201 | .expect("correct type");
|
170 - | let _header_serialization_settings = _cfg
|
171 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
172 - | .cloned()
|
173 - | .unwrap_or_default();
|
174 - | let mut request_builder = {
|
175 - | #[allow(clippy::uninlined_format_args)]
|
176 - | fn uri_base(
|
177 - | _input: &crate::operation::timestamp_format_headers::TimestampFormatHeadersInput,
|
178 - | output: &mut ::std::string::String,
|
179 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
180 - | use ::std::fmt::Write as _;
|
181 - | ::std::write!(output, "/TimestampFormatHeaders").expect("formatting should succeed");
|
182 - | ::std::result::Result::Ok(())
|
202 + | let protocol = _cfg
|
203 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
204 + | .expect("a SharedClientProtocol is required");
|
205 + | if protocol.supports_http_bindings() {
|
206 + | let mut request = protocol
|
207 + | .serialize_body(&input, TimestampFormatHeaders::INPUT_SCHEMA, "", _cfg)
|
208 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
209 + | {
|
210 + | let mut uri = "/TimestampFormatHeaders".to_string();
|
211 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
212 + | if let Some(ref val) = input.member_epoch_seconds {
|
213 + | request.headers_mut().insert(
|
214 + | "X-memberEpochSeconds",
|
215 + | val.fmt(::aws_smithy_types::date_time::Format::EpochSeconds).expect("valid timestamp"),
|
216 + | );
|
183 217 | }
|
184 - | #[allow(clippy::unnecessary_wraps)]
|
185 - | fn update_http_builder(
|
186 - | input: &crate::operation::timestamp_format_headers::TimestampFormatHeadersInput,
|
187 - | builder: ::http_1x::request::Builder,
|
188 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
189 - | let mut uri = ::std::string::String::new();
|
190 - | uri_base(input, &mut uri)?;
|
191 - | let builder = crate::protocol_serde::shape_timestamp_format_headers::ser_timestamp_format_headers_headers(input, builder)?;
|
192 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
193 - | }
|
194 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
195 - | builder
|
196 - | };
|
197 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
218 + | if let Some(ref val) = input.member_http_date {
|
219 + | request.headers_mut().insert(
|
220 + | "X-memberHttpDate",
|
221 + | val.fmt(::aws_smithy_types::date_time::Format::HttpDate).expect("valid timestamp"),
|
222 + | );
|
223 + | }
|
224 + | if let Some(ref val) = input.member_date_time {
|
225 + | request.headers_mut().insert(
|
226 + | "X-memberDateTime",
|
227 + | val.fmt(::aws_smithy_types::date_time::Format::DateTime).expect("valid timestamp"),
|
228 + | );
|
229 + | }
|
230 + | if let Some(ref val) = input.default_format {
|
231 + | request.headers_mut().insert(
|
232 + | "X-defaultFormat",
|
233 + | val.fmt(::aws_smithy_types::date_time::Format::HttpDate).expect("valid timestamp"),
|
234 + | );
|
235 + | }
|
236 + | if let Some(ref val) = input.target_epoch_seconds {
|
237 + | request.headers_mut().insert(
|
238 + | "X-targetEpochSeconds",
|
239 + | val.fmt(::aws_smithy_types::date_time::Format::EpochSeconds).expect("valid timestamp"),
|
240 + | );
|
241 + | }
|
242 + | if let Some(ref val) = input.target_http_date {
|
243 + | request.headers_mut().insert(
|
244 + | "X-targetHttpDate",
|
245 + | val.fmt(::aws_smithy_types::date_time::Format::HttpDate).expect("valid timestamp"),
|
246 + | );
|
247 + | }
|
248 + | if let Some(ref val) = input.target_date_time {
|
249 + | request.headers_mut().insert(
|
250 + | "X-targetDateTime",
|
251 + | val.fmt(::aws_smithy_types::date_time::Format::DateTime).expect("valid timestamp"),
|
252 + | );
|
253 + | }
|
254 + | if !query_params.is_empty() {
|
255 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
256 + | let pairs: Vec<String> = query_params
|
257 + | .iter()
|
258 + | .map(|(k, v)| {
|
259 + | format!(
|
260 + | "{}={}",
|
261 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
262 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
263 + | )
|
264 + | })
|
265 + | .collect();
|
266 + | uri.push_str(&pairs.join("&"));
|
267 + | }
|
268 + | request.set_uri(uri.as_str()).expect("valid URI");
|
269 + | }
|
270 + |
|
271 + | return ::std::result::Result::Ok(request);
|
272 + | } else {
|
273 + | let mut request = protocol
|
274 + | .serialize_request(&input, TimestampFormatHeaders::INPUT_SCHEMA, "", _cfg)
|
275 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
198 276 |
|
199 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
277 + | return ::std::result::Result::Ok(request);
|
278 + | }
|
200 279 | }
|
201 280 | }
|
202 281 | #[derive(Debug)]
|
203 282 | struct TimestampFormatHeadersEndpointParamsInterceptor;
|
204 283 |
|
205 284 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for TimestampFormatHeadersEndpointParamsInterceptor {
|
206 285 | fn name(&self) -> &'static str {
|
207 286 | "TimestampFormatHeadersEndpointParamsInterceptor"
|
208 287 | }
|
209 288 |
|