aws_sdk_dynamodb/operation/
transact_write_items.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `TransactWriteItems`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct TransactWriteItems;
6impl TransactWriteItems {
7    /// Creates a new `TransactWriteItems`
8    pub fn new() -> Self {
9        Self
10    }
11    /// The schema for this operation's input shape.
12                    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::transact_write_items::TransactWriteItemsInput::SCHEMA;
13                    /// The schema for this operation's output shape.
14                    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::transact_write_items::TransactWriteItemsOutput::SCHEMA;
15    pub(crate) async fn orchestrate(
16                        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17                        input: crate::operation::transact_write_items::TransactWriteItemsInput,
18                    ) -> ::std::result::Result<crate::operation::transact_write_items::TransactWriteItemsOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::transact_write_items::TransactWriteItemsError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
19                        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| {
20                            err.map_service_error(|err| {
21                                err.downcast::<crate::operation::transact_write_items::TransactWriteItemsError>().expect("correct error type")
22                            })
23                        };
24                        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
25                            .await
26                            .map_err(map_err)?;
27                        let output = context.finalize().map_err(map_err)?;
28                        ::std::result::Result::Ok(output.downcast::<crate::operation::transact_write_items::TransactWriteItemsOutput>().expect("correct output type"))
29                    }
30    
31                    pub(crate) async fn orchestrate_with_stop_point(
32                        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
33                        input: crate::operation::transact_write_items::TransactWriteItemsInput,
34                        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
35                    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
36                        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
37                        use ::tracing::Instrument;
38                        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
39                            "DynamoDB",
40                            "TransactWriteItems",
41                            input,
42                            runtime_plugins,
43                            stop_point
44                        )
45                        // Create a parent span for the entire operation. Includes a random, internal-only,
46                        // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
47                        .instrument(::tracing::debug_span!(
48                                "DynamoDB.TransactWriteItems",
49                                "rpc.service" = "DynamoDB",
50                                "rpc.method" = "TransactWriteItems",
51                                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
52                                "rpc.system" = "aws-api",
53                            ))
54                        .await
55                    }
56    
57                    pub(crate) fn operation_runtime_plugins(
58                        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
59                        client_config: &crate::config::Config,
60                        config_override: ::std::option::Option<crate::config::Builder>,
61                    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
62                        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
63                        runtime_plugins = runtime_plugins
64                                        .with_operation_plugin(crate::client_idempotency_token::IdempotencyTokenRuntimePlugin::new(|token_provider, input| {
65                                    let input: &mut crate::operation::transact_write_items::TransactWriteItemsInput = input.downcast_mut().expect("correct type");
66                                    if input.client_request_token.is_none() {
67                                        input.client_request_token = ::std::option::Option::Some(token_provider.make_idempotency_token());
68                                    }
69                                }));
70                        if let ::std::option::Option::Some(config_override) = config_override {
71                            for plugin in config_override.runtime_plugins.iter().cloned() {
72                                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
73                            }
74                            runtime_plugins = runtime_plugins.with_operation_plugin(
75                                crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components)
76                            );
77                        }
78                        runtime_plugins
79                    }
80}
81impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for TransactWriteItems {
82                fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
83                    let mut cfg = ::aws_smithy_types::config_bag::Layer::new("TransactWriteItems");
84
85                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(TransactWriteItemsRequestSerializer));
86                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(TransactWriteItemsResponseDeserializer));
87
88                    cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
89                        crate::config::auth::Params::builder()
90                            .operation_name("TransactWriteItems")
91                            .build()
92                            .expect("required fields set")
93                    ));
94
95                    cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
96                            "TransactWriteItems",
97                            "DynamoDB",
98                        ));
99let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
100                            signing_options.double_uri_encode = true;
101                            signing_options.content_sha256_header = false;
102                            signing_options.normalize_uri_path = true;
103                            signing_options.payload_override = None;
104
105                            cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
106                                signing_options,
107                                ..::std::default::Default::default()
108                            });
109
110                    ::std::option::Option::Some(cfg.freeze())
111                }
112
113                fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
114                    #[allow(unused_mut)]
115                    let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("TransactWriteItems")
116                            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
117.with_interceptor(TransactWriteItemsEndpointParamsInterceptor)
118                            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::transact_write_items::TransactWriteItemsError>::new())
119.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::transact_write_items::TransactWriteItemsError>::new())
120.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::transact_write_items::TransactWriteItemsError>::new());
121
122                    ::std::borrow::Cow::Owned(rcb)
123                }
124            }
125
126            
127#[derive(Debug)]
128            struct TransactWriteItemsResponseDeserializer;
129            impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for TransactWriteItemsResponseDeserializer {
130                
131
132                fn deserialize_nonstreaming_with_config(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse, _cfg: &::aws_smithy_types::config_bag::ConfigBag) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
133                    let (success, status) = (response.status().is_success(), response.status().as_u16());
134            #[allow(unused_mut)]
135            let mut force_error = false;
136            ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
137            if !success && status != 200 || force_error {
138                let headers = response.headers();
139                let body = response.body().bytes().expect("body loaded");
140#[allow(unused_mut)]
141            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body)
142                .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
143            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
144            let generic = generic_builder.build();
145let error_code = match generic.code() {
146                    ::std::option::Option::Some(code) => code,
147                    ::std::option::Option::None => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::transact_write_items::TransactWriteItemsError::unhandled(generic)))),
148                };
149                let _error_message = generic.message().map(|msg| msg.to_owned());
150                let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
151                    .expect("a SharedClientProtocol is required");
152let err = match error_code {
153"IdempotentParameterMismatchException" => crate::operation::transact_write_items::TransactWriteItemsError::IdempotentParameterMismatchException({
154let mut tmp = match protocol.deserialize_response(response, crate::types::error::IdempotentParameterMismatchException::SCHEMA, _cfg)
155                        .and_then(|mut deser| crate::types::error::IdempotentParameterMismatchException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
156                    {
157                        ::std::result::Result::Ok(val) => val,
158                        ::std::result::Result::Err(e) => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))),
159                    };
160                    tmp.meta = generic;
161if tmp.message.is_none() {
162                                tmp.message = _error_message;
163                            }
164tmp
165}),
166"InternalServerError" => crate::operation::transact_write_items::TransactWriteItemsError::InternalServerError({
167let mut tmp = match protocol.deserialize_response(response, crate::types::error::InternalServerError::SCHEMA, _cfg)
168                        .and_then(|mut deser| crate::types::error::InternalServerError::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
169                    {
170                        ::std::result::Result::Ok(val) => val,
171                        ::std::result::Result::Err(e) => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))),
172                    };
173                    tmp.meta = generic;
174if tmp.message.is_none() {
175                                tmp.message = _error_message;
176                            }
177tmp
178}),
179"InvalidEndpointException" => crate::operation::transact_write_items::TransactWriteItemsError::InvalidEndpointException({
180let mut tmp = match protocol.deserialize_response(response, crate::types::error::InvalidEndpointException::SCHEMA, _cfg)
181                        .and_then(|mut deser| crate::types::error::InvalidEndpointException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
182                    {
183                        ::std::result::Result::Ok(val) => val,
184                        ::std::result::Result::Err(e) => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))),
185                    };
186                    tmp.meta = generic;
187if tmp.message.is_none() {
188                                tmp.message = _error_message;
189                            }
190tmp
191}),
192"ProvisionedThroughputExceededException" => crate::operation::transact_write_items::TransactWriteItemsError::ProvisionedThroughputExceededException({
193let mut tmp = match protocol.deserialize_response(response, crate::types::error::ProvisionedThroughputExceededException::SCHEMA, _cfg)
194                        .and_then(|mut deser| crate::types::error::ProvisionedThroughputExceededException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
195                    {
196                        ::std::result::Result::Ok(val) => val,
197                        ::std::result::Result::Err(e) => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))),
198                    };
199                    tmp.meta = generic;
200if tmp.message.is_none() {
201                                tmp.message = _error_message;
202                            }
203tmp
204}),
205"RequestLimitExceeded" => crate::operation::transact_write_items::TransactWriteItemsError::RequestLimitExceeded({
206let mut tmp = match protocol.deserialize_response(response, crate::types::error::RequestLimitExceeded::SCHEMA, _cfg)
207                        .and_then(|mut deser| crate::types::error::RequestLimitExceeded::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
208                    {
209                        ::std::result::Result::Ok(val) => val,
210                        ::std::result::Result::Err(e) => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))),
211                    };
212                    tmp.meta = generic;
213if tmp.message.is_none() {
214                                tmp.message = _error_message;
215                            }
216tmp
217}),
218"ResourceNotFoundException" => crate::operation::transact_write_items::TransactWriteItemsError::ResourceNotFoundException({
219let mut tmp = match protocol.deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
220                        .and_then(|mut deser| crate::types::error::ResourceNotFoundException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
221                    {
222                        ::std::result::Result::Ok(val) => val,
223                        ::std::result::Result::Err(e) => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))),
224                    };
225                    tmp.meta = generic;
226if tmp.message.is_none() {
227                                tmp.message = _error_message;
228                            }
229tmp
230}),
231"ThrottlingException" => crate::operation::transact_write_items::TransactWriteItemsError::ThrottlingException({
232let mut tmp = match protocol.deserialize_response(response, crate::types::error::ThrottlingException::SCHEMA, _cfg)
233                        .and_then(|mut deser| crate::types::error::ThrottlingException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
234                    {
235                        ::std::result::Result::Ok(val) => val,
236                        ::std::result::Result::Err(e) => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))),
237                    };
238                    tmp.meta = generic;
239if tmp.message.is_none() {
240                                tmp.message = _error_message;
241                            }
242tmp
243}),
244"TransactionCanceledException" => crate::operation::transact_write_items::TransactWriteItemsError::TransactionCanceledException({
245let mut tmp = match protocol.deserialize_response(response, crate::types::error::TransactionCanceledException::SCHEMA, _cfg)
246                        .and_then(|mut deser| crate::types::error::TransactionCanceledException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
247                    {
248                        ::std::result::Result::Ok(val) => val,
249                        ::std::result::Result::Err(e) => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))),
250                    };
251                    tmp.meta = generic;
252if tmp.message.is_none() {
253                                tmp.message = _error_message;
254                            }
255tmp
256}),
257"TransactionInProgressException" => crate::operation::transact_write_items::TransactWriteItemsError::TransactionInProgressException({
258let mut tmp = match protocol.deserialize_response(response, crate::types::error::TransactionInProgressException::SCHEMA, _cfg)
259                        .and_then(|mut deser| crate::types::error::TransactionInProgressException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
260                    {
261                        ::std::result::Result::Ok(val) => val,
262                        ::std::result::Result::Err(e) => return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))),
263                    };
264                    tmp.meta = generic;
265if tmp.message.is_none() {
266                                tmp.message = _error_message;
267                            }
268tmp
269}),
270_ => crate::operation::transact_write_items::TransactWriteItemsError::generic(generic)
271};
272                ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err)))
273} else {
274                let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
275                    .expect("a SharedClientProtocol is required");
276                let mut deser = protocol.deserialize_response(response, TransactWriteItems::OUTPUT_SCHEMA, _cfg)
277                    .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
278                let body = response.body().bytes().expect("body loaded");
279                let output = crate::operation::transact_write_items::TransactWriteItemsOutput::deserialize_with_response(
280                    &mut *deser,
281                    response.headers(),
282                    response.status().into(),
283                    body,
284                ).map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
285                ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
286            }
287                }
288            }
289#[derive(Debug)]
290            struct TransactWriteItemsRequestSerializer;
291            impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for TransactWriteItemsRequestSerializer {
292                #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
293                fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
294                    let input = input.downcast::<crate::operation::transact_write_items::TransactWriteItemsInput>().expect("correct type");
295                    let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
296                        .expect("a SharedClientProtocol is required");
297                    let mut request = protocol.serialize_request(
298                            &input, TransactWriteItems::INPUT_SCHEMA, "", _cfg,
299                        ).map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
300                        
301                        return ::std::result::Result::Ok(request);
302                }
303            }
304#[derive(Debug)]
305            struct TransactWriteItemsEndpointParamsInterceptor;
306
307            impl ::aws_smithy_runtime_api::client::interceptors::Intercept for TransactWriteItemsEndpointParamsInterceptor {
308                fn name(&self) -> &'static str {
309                    "TransactWriteItemsEndpointParamsInterceptor"
310                }
311
312                fn read_before_execution(
313                    &self,
314                    context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>,
315                    cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
316                ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
317                    let _input = context.input()
318                        .downcast_ref::<TransactWriteItemsInput>()
319                        .ok_or("failed to downcast to TransactWriteItemsInput")?;
320
321                    
322
323                    let params = crate::config::endpoint::Params::builder()
324                        .set_region(cfg.load::<::aws_types::region::Region>().map(|r|r.as_ref().to_owned()))
325.set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
326.set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
327.set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
328.set_account_id_endpoint_mode(::std::option::Option::Some(cfg.load::<::aws_types::endpoint_config::AccountIdEndpointMode>().cloned().unwrap_or_default().to_string()))
329.set_resource_arn_list(get_resource_arn_list(_input).map(|v| v.into_iter().cloned().collect::<Vec<_>>()))
330                        .build()
331                        .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?;
332                    cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
333                    ::std::result::Result::Ok(())
334                }
335            }
336
337            // The get_* functions below are generated from JMESPath expressions in the
338            // operationContextParams trait. They target the operation's input shape.
339
340            // Generated from JMESPath Expression: TransactItems[*].[ConditionCheck.TableName, Put.TableName, Delete.TableName, Update.TableName][]
341fn get_resource_arn_list(input: &crate::operation::transact_write_items::TransactWriteItemsInput) -> Option<::std::vec::Vec::<&::std::string::String>> {
342    let _fld_1 = input.transact_items.as_ref()?;
343    let _prj_11 = _fld_1.iter()
344    .flat_map(|v| {
345        #[allow(clippy::let_and_return)]
346        fn map(_v: &crate::types::TransactWriteItem) -> ::std::option::Option<::std::vec::Vec::<::std::option::Option<&::std::string::String>>> {
347            let _fld_2 = _v.condition_check.as_ref();
348            let _fld_3 = _fld_2.map(|v| &v.table_name);
349            let _fld_4 = _v.put.as_ref();
350            let _fld_5 = _fld_4.map(|v| &v.table_name);
351            let _fld_6 = _v.delete.as_ref();
352            let _fld_7 = _fld_6.map(|v| &v.table_name);
353            let _fld_8 = _v.update.as_ref();
354            let _fld_9 = _fld_8.map(|v| &v.table_name);
355            let _msl_10 = vec![_fld_3, _fld_5, _fld_7, _fld_9];
356            ::std::option::Option::Some(_msl_10)
357        }
358        map(v)
359    })
360    .flatten()
361    .flatten()
362    .collect::<::std::vec::Vec<_>>();
363    Some(_prj_11)
364}
365
366/// Error type for the `TransactWriteItemsError` operation.
367#[non_exhaustive]
368#[derive(::std::fmt::Debug)]
369pub enum TransactWriteItemsError {
370    /// <p>DynamoDB rejected the request because you retried a request with a different payload but with an idempotent token that was already used.</p>
371    IdempotentParameterMismatchException(crate::types::error::IdempotentParameterMismatchException),
372    /// <p>An error occurred on the server side.</p>
373    InternalServerError(crate::types::error::InternalServerError),
374    #[allow(missing_docs)] // documentation missing in model
375    InvalidEndpointException(crate::types::error::InvalidEndpointException),
376    /// <p>The request was denied due to request throttling. For detailed information about why the request was throttled and the ARN of the impacted resource, find the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> field in the returned exception. The Amazon Web Services SDKs for DynamoDB automatically retry requests that receive this exception. Your request is eventually successful, unless your retry queue is too large to finish. Reduce the frequency of requests and use exponential backoff. For more information, go to <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html#Programming.Errors.RetryAndBackoff">Error Retries and Exponential Backoff</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
377    ProvisionedThroughputExceededException(crate::types::error::ProvisionedThroughputExceededException),
378    /// <p>Throughput exceeds the current throughput quota for your account. For detailed information about why the request was throttled and the ARN of the impacted resource, find the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> field in the returned exception. Contact <a href="https://aws.amazon.com/support">Amazon Web Services Support</a> to request a quota increase.</p>
379    RequestLimitExceeded(crate::types::error::RequestLimitExceeded),
380    /// <p>The operation tried to access a nonexistent table or index. The resource might not be specified correctly, or its status might not be <code>ACTIVE</code>.</p>
381    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
382    /// <p>The request was denied due to request throttling. For detailed information about why the request was throttled and the ARN of the impacted resource, find the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> field in the returned exception.</p>
383    ThrottlingException(crate::types::error::ThrottlingException),
384    /// <p>The entire transaction request was canceled.</p>
385    /// <p>DynamoDB cancels a <code>TransactWriteItems</code> request under the following circumstances:</p>
386    /// <ul>
387    /// <li>
388    /// <p>A condition in one of the condition expressions is not met.</p></li>
389    /// <li>
390    /// <p>A table in the <code>TransactWriteItems</code> request is in a different account or region.</p></li>
391    /// <li>
392    /// <p>More than one action in the <code>TransactWriteItems</code> operation targets the same item.</p></li>
393    /// <li>
394    /// <p>There is insufficient provisioned capacity for the transaction to be completed.</p></li>
395    /// <li>
396    /// <p>An item size becomes too large (larger than 400 KB), or a local secondary index (LSI) becomes too large, or a similar validation error occurs because of changes made by the transaction.</p></li>
397    /// <li>
398    /// <p>There is a user error, such as an invalid data format.</p></li>
399    /// <li>
400    /// <p>There is an ongoing <code>TransactWriteItems</code> operation that conflicts with a concurrent <code>TransactWriteItems</code> request. In this case the <code>TransactWriteItems</code> operation fails with a <code>TransactionCanceledException</code>.</p></li>
401    /// </ul>
402    /// <p>DynamoDB cancels a <code>TransactGetItems</code> request under the following circumstances:</p>
403    /// <ul>
404    /// <li>
405    /// <p>There is an ongoing <code>TransactGetItems</code> operation that conflicts with a concurrent <code>PutItem</code>, <code>UpdateItem</code>, <code>DeleteItem</code> or <code>TransactWriteItems</code> request. In this case the <code>TransactGetItems</code> operation fails with a <code>TransactionCanceledException</code>.</p></li>
406    /// <li>
407    /// <p>A table in the <code>TransactGetItems</code> request is in a different account or region.</p></li>
408    /// <li>
409    /// <p>There is insufficient provisioned capacity for the transaction to be completed.</p></li>
410    /// <li>
411    /// <p>There is a user error, such as an invalid data format.</p></li>
412    /// </ul><note>
413    /// <p>If using Java, DynamoDB lists the cancellation reasons on the <code>CancellationReasons</code> property. This property is not set for other languages. Transaction cancellation reasons are ordered in the order of requested items, if an item has no error it will have <code>None</code> code and <code>Null</code> message.</p>
414    /// </note>
415    /// <p>Cancellation reason codes and possible error messages:</p>
416    /// <ul>
417    /// <li>
418    /// <p>No Errors:</p>
419    /// <ul>
420    /// <li>
421    /// <p>Code: <code>None</code></p></li>
422    /// <li>
423    /// <p>Message: <code>null</code></p></li>
424    /// </ul></li>
425    /// <li>
426    /// <p>Conditional Check Failed:</p>
427    /// <ul>
428    /// <li>
429    /// <p>Code: <code>ConditionalCheckFailed</code></p></li>
430    /// <li>
431    /// <p>Message: The conditional request failed.</p></li>
432    /// </ul></li>
433    /// <li>
434    /// <p>Item Collection Size Limit Exceeded:</p>
435    /// <ul>
436    /// <li>
437    /// <p>Code: <code>ItemCollectionSizeLimitExceeded</code></p></li>
438    /// <li>
439    /// <p>Message: Collection size exceeded.</p></li>
440    /// </ul></li>
441    /// <li>
442    /// <p>Transaction Conflict:</p>
443    /// <ul>
444    /// <li>
445    /// <p>Code: <code>TransactionConflict</code></p></li>
446    /// <li>
447    /// <p>Message: Transaction is ongoing for the item.</p></li>
448    /// </ul></li>
449    /// <li>
450    /// <p>Provisioned Throughput Exceeded:</p>
451    /// <ul>
452    /// <li>
453    /// <p>Code: <code>ProvisionedThroughputExceeded</code></p></li>
454    /// <li>
455    /// <p>Messages:</p>
456    /// <ul>
457    /// <li>
458    /// <p>The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.</p><note>
459    /// <p>This Message is received when provisioned throughput is exceeded is on a provisioned DynamoDB table.</p>
460    /// </note></li>
461    /// <li>
462    /// <p>The level of configured provisioned throughput for one or more global secondary indexes of the table was exceeded. Consider increasing your provisioning level for the under-provisioned global secondary indexes with the UpdateTable API.</p><note>
463    /// <p>This message is returned when provisioned throughput is exceeded is on a provisioned GSI.</p>
464    /// </note></li>
465    /// </ul></li>
466    /// </ul></li>
467    /// <li>
468    /// <p>Throttling Error:</p>
469    /// <ul>
470    /// <li>
471    /// <p>Code: <code>ThrottlingError</code></p></li>
472    /// <li>
473    /// <p>Messages:</p>
474    /// <ul>
475    /// <li>
476    /// <p>Throughput exceeds the current capacity of your table or index. DynamoDB is automatically scaling your table or index so please try again shortly. If exceptions persist, check if you have a hot key: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html.</p><note>
477    /// <p>This message is returned when writes get throttled on an On-Demand table as DynamoDB is automatically scaling the table.</p>
478    /// </note></li>
479    /// <li>
480    /// <p>Throughput exceeds the current capacity for one or more global secondary indexes. DynamoDB is automatically scaling your index so please try again shortly.</p><note>
481    /// <p>This message is returned when writes get throttled on an On-Demand GSI as DynamoDB is automatically scaling the GSI.</p>
482    /// </note></li>
483    /// </ul></li>
484    /// </ul></li>
485    /// <li>
486    /// <p>Validation Error:</p>
487    /// <ul>
488    /// <li>
489    /// <p>Code: <code>ValidationError</code></p></li>
490    /// <li>
491    /// <p>Messages:</p>
492    /// <ul>
493    /// <li>
494    /// <p>One or more parameter values were invalid.</p></li>
495    /// <li>
496    /// <p>The update expression attempted to update the secondary index key beyond allowed size limits.</p></li>
497    /// <li>
498    /// <p>The update expression attempted to update the secondary index key to unsupported type.</p></li>
499    /// <li>
500    /// <p>An operand in the update expression has an incorrect data type.</p></li>
501    /// <li>
502    /// <p>Item size to update has exceeded the maximum allowed size.</p></li>
503    /// <li>
504    /// <p>Number overflow. Attempting to store a number with magnitude larger than supported range.</p></li>
505    /// <li>
506    /// <p>Type mismatch for attribute to update.</p></li>
507    /// <li>
508    /// <p>Nesting Levels have exceeded supported limits.</p></li>
509    /// <li>
510    /// <p>The document path provided in the update expression is invalid for update.</p></li>
511    /// <li>
512    /// <p>The provided expression refers to an attribute that does not exist in the item.</p></li>
513    /// </ul></li>
514    /// </ul></li>
515    /// </ul>
516    TransactionCanceledException(crate::types::error::TransactionCanceledException),
517    /// <p>The transaction with the given request token is already in progress.</p>
518    /// <p>Recommended Settings</p><note>
519    /// <p>This is a general recommendation for handling the <code>TransactionInProgressException</code>. These settings help ensure that the client retries will trigger completion of the ongoing <code>TransactWriteItems</code> request.</p>
520    /// </note>
521    /// <ul>
522    /// <li>
523    /// <p>Set <code>clientExecutionTimeout</code> to a value that allows at least one retry to be processed after 5 seconds have elapsed since the first attempt for the <code>TransactWriteItems</code> operation.</p></li>
524    /// <li>
525    /// <p>Set <code>socketTimeout</code> to a value a little lower than the <code>requestTimeout</code> setting.</p></li>
526    /// <li>
527    /// <p><code>requestTimeout</code> should be set based on the time taken for the individual retries of a single HTTP request for your use case, but setting it to 1 second or higher should work well to reduce chances of retries and <code>TransactionInProgressException</code> errors.</p></li>
528    /// <li>
529    /// <p>Use exponential backoff when retrying and tune backoff if needed.</p></li>
530    /// </ul>
531    /// <p>Assuming <a href="https://github.com/aws/aws-sdk-java/blob/fd409dee8ae23fb8953e0bb4dbde65536a7e0514/aws-java-sdk-core/src/main/java/com/amazonaws/retry/PredefinedRetryPolicies.java#L97">default retry policy</a>, example timeout settings based on the guidelines above are as follows:</p>
532    /// <p>Example timeline:</p>
533    /// <ul>
534    /// <li>
535    /// <p>0-1000 first attempt</p></li>
536    /// <li>
537    /// <p>1000-1500 first sleep/delay (default retry policy uses 500 ms as base delay for 4xx errors)</p></li>
538    /// <li>
539    /// <p>1500-2500 second attempt</p></li>
540    /// <li>
541    /// <p>2500-3500 second sleep/delay (500 * 2, exponential backoff)</p></li>
542    /// <li>
543    /// <p>3500-4500 third attempt</p></li>
544    /// <li>
545    /// <p>4500-6500 third sleep/delay (500 * 2^2)</p></li>
546    /// <li>
547    /// <p>6500-7500 fourth attempt (this can trigger inline recovery since 5 seconds have elapsed since the first attempt reached TC)</p></li>
548    /// </ul>
549    TransactionInProgressException(crate::types::error::TransactionInProgressException),
550    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
551                    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
552    variable wildcard pattern and check `.code()`:
553     \
554    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
555     \
556    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-TransactWriteItemsError) for what information is available for the error.")]
557                    Unhandled(crate::error::sealed_unhandled::Unhandled),
558}
559impl TransactWriteItemsError {
560    /// Creates the `TransactWriteItemsError::Unhandled` variant from any error type.
561                    pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>) -> Self {
562                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() })
563                    }
564    
565                    /// Creates the `TransactWriteItemsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
566                    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
567                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err })
568                    }
569    /// 
570    /// Returns error metadata, which includes the error code, message,
571    /// request ID, and potentially additional information.
572    /// 
573    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
574        match self {
575            Self::IdempotentParameterMismatchException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
576            Self::InternalServerError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
577            Self::InvalidEndpointException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
578            Self::ProvisionedThroughputExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
579            Self::RequestLimitExceeded(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
580            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
581            Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
582            Self::TransactionCanceledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
583            Self::TransactionInProgressException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
584            Self::Unhandled(e) => &e.meta,
585        }
586    }
587    /// Returns `true` if the error kind is `TransactWriteItemsError::IdempotentParameterMismatchException`.
588    pub fn is_idempotent_parameter_mismatch_exception(&self) -> bool {
589        matches!(self, Self::IdempotentParameterMismatchException(_))
590    }
591    /// Returns `true` if the error kind is `TransactWriteItemsError::InternalServerError`.
592    pub fn is_internal_server_error(&self) -> bool {
593        matches!(self, Self::InternalServerError(_))
594    }
595    /// Returns `true` if the error kind is `TransactWriteItemsError::InvalidEndpointException`.
596    pub fn is_invalid_endpoint_exception(&self) -> bool {
597        matches!(self, Self::InvalidEndpointException(_))
598    }
599    /// Returns `true` if the error kind is `TransactWriteItemsError::ProvisionedThroughputExceededException`.
600    pub fn is_provisioned_throughput_exceeded_exception(&self) -> bool {
601        matches!(self, Self::ProvisionedThroughputExceededException(_))
602    }
603    /// Returns `true` if the error kind is `TransactWriteItemsError::RequestLimitExceeded`.
604    pub fn is_request_limit_exceeded(&self) -> bool {
605        matches!(self, Self::RequestLimitExceeded(_))
606    }
607    /// Returns `true` if the error kind is `TransactWriteItemsError::ResourceNotFoundException`.
608    pub fn is_resource_not_found_exception(&self) -> bool {
609        matches!(self, Self::ResourceNotFoundException(_))
610    }
611    /// Returns `true` if the error kind is `TransactWriteItemsError::ThrottlingException`.
612    pub fn is_throttling_exception(&self) -> bool {
613        matches!(self, Self::ThrottlingException(_))
614    }
615    /// Returns `true` if the error kind is `TransactWriteItemsError::TransactionCanceledException`.
616    pub fn is_transaction_canceled_exception(&self) -> bool {
617        matches!(self, Self::TransactionCanceledException(_))
618    }
619    /// Returns `true` if the error kind is `TransactWriteItemsError::TransactionInProgressException`.
620    pub fn is_transaction_in_progress_exception(&self) -> bool {
621        matches!(self, Self::TransactionInProgressException(_))
622    }
623}
624impl ::std::error::Error for TransactWriteItemsError {
625    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
626        match self {
627            Self::IdempotentParameterMismatchException(_inner) =>
628            ::std::option::Option::Some(_inner)
629            ,
630            Self::InternalServerError(_inner) =>
631            ::std::option::Option::Some(_inner)
632            ,
633            Self::InvalidEndpointException(_inner) =>
634            ::std::option::Option::Some(_inner)
635            ,
636            Self::ProvisionedThroughputExceededException(_inner) =>
637            ::std::option::Option::Some(_inner)
638            ,
639            Self::RequestLimitExceeded(_inner) =>
640            ::std::option::Option::Some(_inner)
641            ,
642            Self::ResourceNotFoundException(_inner) =>
643            ::std::option::Option::Some(_inner)
644            ,
645            Self::ThrottlingException(_inner) =>
646            ::std::option::Option::Some(_inner)
647            ,
648            Self::TransactionCanceledException(_inner) =>
649            ::std::option::Option::Some(_inner)
650            ,
651            Self::TransactionInProgressException(_inner) =>
652            ::std::option::Option::Some(_inner)
653            ,
654            Self::Unhandled(_inner) => {
655                ::std::option::Option::Some(&*_inner.source)
656            }
657        }
658    }
659}
660impl ::std::fmt::Display for TransactWriteItemsError {
661    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
662        match self {
663            Self::IdempotentParameterMismatchException(_inner) =>
664            _inner.fmt(f)
665            ,
666            Self::InternalServerError(_inner) =>
667            _inner.fmt(f)
668            ,
669            Self::InvalidEndpointException(_inner) =>
670            _inner.fmt(f)
671            ,
672            Self::ProvisionedThroughputExceededException(_inner) =>
673            _inner.fmt(f)
674            ,
675            Self::RequestLimitExceeded(_inner) =>
676            _inner.fmt(f)
677            ,
678            Self::ResourceNotFoundException(_inner) =>
679            _inner.fmt(f)
680            ,
681            Self::ThrottlingException(_inner) =>
682            _inner.fmt(f)
683            ,
684            Self::TransactionCanceledException(_inner) =>
685            _inner.fmt(f)
686            ,
687            Self::TransactionInProgressException(_inner) =>
688            _inner.fmt(f)
689            ,
690            Self::Unhandled(_inner) => {
691                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
692                                                        write!(f, "unhandled error ({code})")
693                                                    } else {
694                                                        f.write_str("unhandled error")
695                                                    }
696            }
697        }
698    }
699}
700impl ::aws_smithy_types::retry::ProvideErrorKind for TransactWriteItemsError {
701    fn code(&self) -> ::std::option::Option<&str> {
702        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
703    }
704    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
705        ::std::option::Option::None
706    }
707}
708impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for TransactWriteItemsError {
709    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
710        match self {
711            Self::IdempotentParameterMismatchException(_inner) =>
712            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
713            ,
714            Self::InternalServerError(_inner) =>
715            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
716            ,
717            Self::InvalidEndpointException(_inner) =>
718            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
719            ,
720            Self::ProvisionedThroughputExceededException(_inner) =>
721            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
722            ,
723            Self::RequestLimitExceeded(_inner) =>
724            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
725            ,
726            Self::ResourceNotFoundException(_inner) =>
727            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
728            ,
729            Self::ThrottlingException(_inner) =>
730            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
731            ,
732            Self::TransactionCanceledException(_inner) =>
733            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
734            ,
735            Self::TransactionInProgressException(_inner) =>
736            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
737            ,
738            Self::Unhandled(_inner) => {
739                &_inner.meta
740            }
741        }
742    }
743}
744impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for TransactWriteItemsError {
745    fn create_unhandled_error(
746                        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
747                        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>
748                    ) -> Self {
749        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() })
750    }
751}
752impl ::aws_types::request_id::RequestId for crate::operation::transact_write_items::TransactWriteItemsError {
753                                fn request_id(&self) -> Option<&str> {
754                                    self.meta().request_id()
755                                }
756                            }
757
758pub use crate::operation::transact_write_items::_transact_write_items_input::TransactWriteItemsInput;
759
760pub use crate::operation::transact_write_items::_transact_write_items_output::TransactWriteItemsOutput;
761
762mod _transact_write_items_input;
763
764mod _transact_write_items_output;
765
766/// Builders
767pub mod builders;
768