145 149 | crate::operation::transact_write_items::TransactWriteItemsError,
|
146 150 | >::new());
|
147 151 |
|
148 152 | ::std::borrow::Cow::Owned(rcb)
|
149 153 | }
|
150 154 | }
|
151 155 |
|
152 156 | #[derive(Debug)]
|
153 157 | struct TransactWriteItemsResponseDeserializer;
|
154 158 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for TransactWriteItemsResponseDeserializer {
|
155 - | fn deserialize_nonstreaming(
|
159 + | fn deserialize_nonstreaming_with_config(
|
156 160 | &self,
|
157 161 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
162 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
158 163 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
159 164 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
160 - | let headers = response.headers();
|
161 - | let body = response.body().bytes().expect("body loaded");
|
162 165 | #[allow(unused_mut)]
|
163 166 | let mut force_error = false;
|
164 167 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
165 - | let parse_result = if !success && status != 200 || force_error {
|
166 - | crate::protocol_serde::shape_transact_write_items::de_transact_write_items_http_error(status, headers, body)
|
167 - | } else {
|
168 - | crate::protocol_serde::shape_transact_write_items::de_transact_write_items_http_response(status, headers, body)
|
168 + | if !success && status != 200 || force_error {
|
169 + | let headers = response.headers();
|
170 + | let body = response.body().bytes().expect("body loaded");
|
171 + | #[allow(unused_mut)]
|
172 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
173 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
174 + | })?;
|
175 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
176 + | let generic = generic_builder.build();
|
177 + | let error_code = match generic.code() {
|
178 + | ::std::option::Option::Some(code) => code,
|
179 + | ::std::option::Option::None => {
|
180 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
181 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
182 + | crate::operation::transact_write_items::TransactWriteItemsError::unhandled(generic),
|
183 + | ),
|
184 + | ))
|
185 + | }
|
186 + | };
|
187 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
188 + | let protocol = _cfg
|
189 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
190 + | .expect("a SharedClientProtocol is required");
|
191 + | let err = match error_code {
|
192 + | "IdempotentParameterMismatchException" => {
|
193 + | crate::operation::transact_write_items::TransactWriteItemsError::IdempotentParameterMismatchException({
|
194 + | let mut tmp = match protocol
|
195 + | .deserialize_response(response, crate::types::error::IdempotentParameterMismatchException::SCHEMA, _cfg)
|
196 + | .and_then(|mut deser| {
|
197 + | crate::types::error::IdempotentParameterMismatchException::deserialize_with_response(
|
198 + | &mut *deser,
|
199 + | response.headers(),
|
200 + | response.status().into(),
|
201 + | body,
|
202 + | )
|
203 + | }) {
|
204 + | ::std::result::Result::Ok(val) => val,
|
205 + | ::std::result::Result::Err(e) => {
|
206 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
207 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
208 + | ))
|
209 + | }
|
210 + | };
|
211 + | tmp.meta = generic;
|
212 + | if tmp.message.is_none() {
|
213 + | tmp.message = _error_message;
|
214 + | }
|
215 + | tmp
|
216 + | })
|
217 + | }
|
218 + | "InternalServerError" => crate::operation::transact_write_items::TransactWriteItemsError::InternalServerError({
|
219 + | let mut tmp = match protocol
|
220 + | .deserialize_response(response, crate::types::error::InternalServerError::SCHEMA, _cfg)
|
221 + | .and_then(|mut deser| {
|
222 + | crate::types::error::InternalServerError::deserialize_with_response(
|
223 + | &mut *deser,
|
224 + | response.headers(),
|
225 + | response.status().into(),
|
226 + | body,
|
227 + | )
|
228 + | }) {
|
229 + | ::std::result::Result::Ok(val) => val,
|
230 + | ::std::result::Result::Err(e) => {
|
231 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
232 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
233 + | ))
|
234 + | }
|
235 + | };
|
236 + | tmp.meta = generic;
|
237 + | if tmp.message.is_none() {
|
238 + | tmp.message = _error_message;
|
239 + | }
|
240 + | tmp
|
241 + | }),
|
242 + | "InvalidEndpointException" => crate::operation::transact_write_items::TransactWriteItemsError::InvalidEndpointException({
|
243 + | let mut tmp = match protocol
|
244 + | .deserialize_response(response, crate::types::error::InvalidEndpointException::SCHEMA, _cfg)
|
245 + | .and_then(|mut deser| {
|
246 + | crate::types::error::InvalidEndpointException::deserialize_with_response(
|
247 + | &mut *deser,
|
248 + | response.headers(),
|
249 + | response.status().into(),
|
250 + | body,
|
251 + | )
|
252 + | }) {
|
253 + | ::std::result::Result::Ok(val) => val,
|
254 + | ::std::result::Result::Err(e) => {
|
255 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
256 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
257 + | ))
|
258 + | }
|
259 + | };
|
260 + | tmp.meta = generic;
|
261 + | if tmp.message.is_none() {
|
262 + | tmp.message = _error_message;
|
263 + | }
|
264 + | tmp
|
265 + | }),
|
266 + | "ProvisionedThroughputExceededException" => {
|
267 + | crate::operation::transact_write_items::TransactWriteItemsError::ProvisionedThroughputExceededException({
|
268 + | let mut tmp = match protocol
|
269 + | .deserialize_response(response, crate::types::error::ProvisionedThroughputExceededException::SCHEMA, _cfg)
|
270 + | .and_then(|mut deser| {
|
271 + | crate::types::error::ProvisionedThroughputExceededException::deserialize_with_response(
|
272 + | &mut *deser,
|
273 + | response.headers(),
|
274 + | response.status().into(),
|
275 + | body,
|
276 + | )
|
277 + | }) {
|
278 + | ::std::result::Result::Ok(val) => val,
|
279 + | ::std::result::Result::Err(e) => {
|
280 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
281 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
282 + | ))
|
283 + | }
|
284 + | };
|
285 + | tmp.meta = generic;
|
286 + | if tmp.message.is_none() {
|
287 + | tmp.message = _error_message;
|
288 + | }
|
289 + | tmp
|
290 + | })
|
291 + | }
|
292 + | "RequestLimitExceeded" => crate::operation::transact_write_items::TransactWriteItemsError::RequestLimitExceeded({
|
293 + | let mut tmp = match protocol
|
294 + | .deserialize_response(response, crate::types::error::RequestLimitExceeded::SCHEMA, _cfg)
|
295 + | .and_then(|mut deser| {
|
296 + | crate::types::error::RequestLimitExceeded::deserialize_with_response(
|
297 + | &mut *deser,
|
298 + | response.headers(),
|
299 + | response.status().into(),
|
300 + | body,
|
301 + | )
|
302 + | }) {
|
303 + | ::std::result::Result::Ok(val) => val,
|
304 + | ::std::result::Result::Err(e) => {
|
305 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
306 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
307 + | ))
|
308 + | }
|
309 + | };
|
310 + | tmp.meta = generic;
|
311 + | if tmp.message.is_none() {
|
312 + | tmp.message = _error_message;
|
313 + | }
|
314 + | tmp
|
315 + | }),
|
316 + | "ResourceNotFoundException" => crate::operation::transact_write_items::TransactWriteItemsError::ResourceNotFoundException({
|
317 + | let mut tmp = match protocol
|
318 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
319 + | .and_then(|mut deser| {
|
320 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
321 + | &mut *deser,
|
322 + | response.headers(),
|
323 + | response.status().into(),
|
324 + | body,
|
325 + | )
|
326 + | }) {
|
327 + | ::std::result::Result::Ok(val) => val,
|
328 + | ::std::result::Result::Err(e) => {
|
329 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
330 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
331 + | ))
|
332 + | }
|
333 + | };
|
334 + | tmp.meta = generic;
|
335 + | if tmp.message.is_none() {
|
336 + | tmp.message = _error_message;
|
337 + | }
|
338 + | tmp
|
339 + | }),
|
340 + | "ThrottlingException" => crate::operation::transact_write_items::TransactWriteItemsError::ThrottlingException({
|
341 + | let mut tmp = match protocol
|
342 + | .deserialize_response(response, crate::types::error::ThrottlingException::SCHEMA, _cfg)
|
343 + | .and_then(|mut deser| {
|
344 + | crate::types::error::ThrottlingException::deserialize_with_response(
|
345 + | &mut *deser,
|
346 + | response.headers(),
|
347 + | response.status().into(),
|
348 + | body,
|
349 + | )
|
350 + | }) {
|
351 + | ::std::result::Result::Ok(val) => val,
|
352 + | ::std::result::Result::Err(e) => {
|
353 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
354 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
355 + | ))
|
356 + | }
|
357 + | };
|
358 + | tmp.meta = generic;
|
359 + | if tmp.message.is_none() {
|
360 + | tmp.message = _error_message;
|
361 + | }
|
362 + | tmp
|
363 + | }),
|
364 + | "TransactionCanceledException" => crate::operation::transact_write_items::TransactWriteItemsError::TransactionCanceledException({
|
365 + | let mut tmp = match protocol
|
366 + | .deserialize_response(response, crate::types::error::TransactionCanceledException::SCHEMA, _cfg)
|
367 + | .and_then(|mut deser| {
|
368 + | crate::types::error::TransactionCanceledException::deserialize_with_response(
|
369 + | &mut *deser,
|
370 + | response.headers(),
|
371 + | response.status().into(),
|
372 + | body,
|
373 + | )
|
374 + | }) {
|
375 + | ::std::result::Result::Ok(val) => val,
|
376 + | ::std::result::Result::Err(e) => {
|
377 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
378 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
379 + | ))
|
380 + | }
|
381 + | };
|
382 + | tmp.meta = generic;
|
383 + | if tmp.message.is_none() {
|
384 + | tmp.message = _error_message;
|
385 + | }
|
386 + | tmp
|
387 + | }),
|
388 + | "TransactionInProgressException" => {
|
389 + | crate::operation::transact_write_items::TransactWriteItemsError::TransactionInProgressException({
|
390 + | let mut tmp = match protocol
|
391 + | .deserialize_response(response, crate::types::error::TransactionInProgressException::SCHEMA, _cfg)
|
392 + | .and_then(|mut deser| {
|
393 + | crate::types::error::TransactionInProgressException::deserialize_with_response(
|
394 + | &mut *deser,
|
395 + | response.headers(),
|
396 + | response.status().into(),
|
397 + | body,
|
398 + | )
|
399 + | }) {
|
400 + | ::std::result::Result::Ok(val) => val,
|
401 + | ::std::result::Result::Err(e) => {
|
402 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
403 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
404 + | ))
|
405 + | }
|
169 406 | };
|
170 - | crate::protocol_serde::type_erase_result(parse_result)
|
407 + | tmp.meta = generic;
|
408 + | if tmp.message.is_none() {
|
409 + | tmp.message = _error_message;
|
410 + | }
|
411 + | tmp
|
412 + | })
|
413 + | }
|
414 + | _ => crate::operation::transact_write_items::TransactWriteItemsError::generic(generic),
|
415 + | };
|
416 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
417 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
418 + | ))
|
419 + | } else {
|
420 + | let protocol = _cfg
|
421 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
422 + | .expect("a SharedClientProtocol is required");
|
423 + | let mut deser = protocol
|
424 + | .deserialize_response(response, TransactWriteItems::OUTPUT_SCHEMA, _cfg)
|
425 + | .map_err(|e| {
|
426 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
427 + | })?;
|
428 + | let body = response.body().bytes().expect("body loaded");
|
429 + | let output = crate::operation::transact_write_items::TransactWriteItemsOutput::deserialize_with_response(
|
430 + | &mut *deser,
|
431 + | response.headers(),
|
432 + | response.status().into(),
|
433 + | body,
|
434 + | )
|
435 + | .map_err(|e| {
|
436 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
437 + | })?;
|
438 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
439 + | }
|
171 440 | }
|
172 441 | }
|
173 442 | #[derive(Debug)]
|
174 443 | struct TransactWriteItemsRequestSerializer;
|
175 444 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for TransactWriteItemsRequestSerializer {
|
176 445 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
177 446 | fn serialize_input(
|
178 447 | &self,
|
179 448 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
180 449 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
181 450 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
182 451 | let input = input
|
183 452 | .downcast::<crate::operation::transact_write_items::TransactWriteItemsInput>()
|
184 453 | .expect("correct type");
|
185 - | let _header_serialization_settings = _cfg
|
186 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
187 - | .cloned()
|
188 - | .unwrap_or_default();
|
189 - | let mut request_builder = {
|
190 - | #[allow(clippy::uninlined_format_args)]
|
191 - | fn uri_base(
|
192 - | _input: &crate::operation::transact_write_items::TransactWriteItemsInput,
|
193 - | output: &mut ::std::string::String,
|
194 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
195 - | use ::std::fmt::Write as _;
|
196 - | ::std::write!(output, "/").expect("formatting should succeed");
|
197 - | ::std::result::Result::Ok(())
|
198 - | }
|
199 - | #[allow(clippy::unnecessary_wraps)]
|
200 - | fn update_http_builder(
|
201 - | input: &crate::operation::transact_write_items::TransactWriteItemsInput,
|
202 - | builder: ::http_1x::request::Builder,
|
203 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
204 - | let mut uri = ::std::string::String::new();
|
205 - | uri_base(input, &mut uri)?;
|
206 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
207 - | }
|
208 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
209 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
|
210 - | builder = _header_serialization_settings.set_default_header(
|
211 - | builder,
|
212 - | ::http_1x::header::HeaderName::from_static("x-amz-target"),
|
213 - | "DynamoDB_20120810.TransactWriteItems",
|
214 - | );
|
215 - | builder
|
216 - | };
|
217 - | let body =
|
218 - | ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_transact_write_items::ser_transact_write_items_input(&input)?);
|
219 - | if let Some(content_length) = body.content_length() {
|
220 - | let content_length = content_length.to_string();
|
221 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
222 - | }
|
223 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
454 + | let protocol = _cfg
|
455 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
456 + | .expect("a SharedClientProtocol is required");
|
457 + | let mut request = protocol
|
458 + | .serialize_request(&input, TransactWriteItems::INPUT_SCHEMA, "", _cfg)
|
459 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
460 + |
|
461 + | return ::std::result::Result::Ok(request);
|
224 462 | }
|
225 463 | }
|
226 464 | #[derive(Debug)]
|
227 465 | struct TransactWriteItemsEndpointParamsInterceptor;
|
228 466 |
|
229 467 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for TransactWriteItemsEndpointParamsInterceptor {
|
230 468 | fn name(&self) -> &'static str {
|
231 469 | "TransactWriteItemsEndpointParamsInterceptor"
|
232 470 | }
|
233 471 |
|