aws_sdk_dynamodb/operation/
execute_transaction.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `ExecuteTransaction`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct ExecuteTransaction;
6impl ExecuteTransaction {
7    /// Creates a new `ExecuteTransaction`
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::execute_transaction::ExecuteTransactionInput::SCHEMA;
13                    /// The schema for this operation's output shape.
14                    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::execute_transaction::ExecuteTransactionOutput::SCHEMA;
15    pub(crate) async fn orchestrate(
16                        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17                        input: crate::operation::execute_transaction::ExecuteTransactionInput,
18                    ) -> ::std::result::Result<crate::operation::execute_transaction::ExecuteTransactionOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::execute_transaction::ExecuteTransactionError, ::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::execute_transaction::ExecuteTransactionError>().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::execute_transaction::ExecuteTransactionOutput>().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::execute_transaction::ExecuteTransactionInput,
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                            "ExecuteTransaction",
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.ExecuteTransaction",
49                                "rpc.service" = "DynamoDB",
50                                "rpc.method" = "ExecuteTransaction",
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::execute_transaction::ExecuteTransactionInput = 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 ExecuteTransaction {
82                fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
83                    let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ExecuteTransaction");
84
85                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(ExecuteTransactionRequestSerializer));
86                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(ExecuteTransactionResponseDeserializer));
87
88                    cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
89                        crate::config::auth::Params::builder()
90                            .operation_name("ExecuteTransaction")
91                            .build()
92                            .expect("required fields set")
93                    ));
94
95                    cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
96                            "ExecuteTransaction",
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("ExecuteTransaction")
116                            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
117.with_interceptor(ExecuteTransactionEndpointParamsInterceptor)
118                            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::execute_transaction::ExecuteTransactionError>::new())
119.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::execute_transaction::ExecuteTransactionError>::new())
120.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::execute_transaction::ExecuteTransactionError>::new());
121
122                    ::std::borrow::Cow::Owned(rcb)
123                }
124            }
125
126            
127#[derive(Debug)]
128            struct ExecuteTransactionResponseDeserializer;
129            impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ExecuteTransactionResponseDeserializer {
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::execute_transaction::ExecuteTransactionError::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::execute_transaction::ExecuteTransactionError::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::execute_transaction::ExecuteTransactionError::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"ProvisionedThroughputExceededException" => crate::operation::execute_transaction::ExecuteTransactionError::ProvisionedThroughputExceededException({
180let mut tmp = match protocol.deserialize_response(response, crate::types::error::ProvisionedThroughputExceededException::SCHEMA, _cfg)
181                        .and_then(|mut deser| crate::types::error::ProvisionedThroughputExceededException::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"RequestLimitExceeded" => crate::operation::execute_transaction::ExecuteTransactionError::RequestLimitExceeded({
193let mut tmp = match protocol.deserialize_response(response, crate::types::error::RequestLimitExceeded::SCHEMA, _cfg)
194                        .and_then(|mut deser| crate::types::error::RequestLimitExceeded::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"ResourceNotFoundException" => crate::operation::execute_transaction::ExecuteTransactionError::ResourceNotFoundException({
206let mut tmp = match protocol.deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
207                        .and_then(|mut deser| crate::types::error::ResourceNotFoundException::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"ThrottlingException" => crate::operation::execute_transaction::ExecuteTransactionError::ThrottlingException({
219let mut tmp = match protocol.deserialize_response(response, crate::types::error::ThrottlingException::SCHEMA, _cfg)
220                        .and_then(|mut deser| crate::types::error::ThrottlingException::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"TransactionCanceledException" => crate::operation::execute_transaction::ExecuteTransactionError::TransactionCanceledException({
232let mut tmp = match protocol.deserialize_response(response, crate::types::error::TransactionCanceledException::SCHEMA, _cfg)
233                        .and_then(|mut deser| crate::types::error::TransactionCanceledException::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"TransactionInProgressException" => crate::operation::execute_transaction::ExecuteTransactionError::TransactionInProgressException({
245let mut tmp = match protocol.deserialize_response(response, crate::types::error::TransactionInProgressException::SCHEMA, _cfg)
246                        .and_then(|mut deser| crate::types::error::TransactionInProgressException::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_ => crate::operation::execute_transaction::ExecuteTransactionError::generic(generic)
258};
259                ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err)))
260} else {
261                let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
262                    .expect("a SharedClientProtocol is required");
263                let mut deser = protocol.deserialize_response(response, ExecuteTransaction::OUTPUT_SCHEMA, _cfg)
264                    .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
265                let body = response.body().bytes().expect("body loaded");
266                let output = crate::operation::execute_transaction::ExecuteTransactionOutput::deserialize_with_response(
267                    &mut *deser,
268                    response.headers(),
269                    response.status().into(),
270                    body,
271                ).map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
272                ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
273            }
274                }
275            }
276#[derive(Debug)]
277            struct ExecuteTransactionRequestSerializer;
278            impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ExecuteTransactionRequestSerializer {
279                #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
280                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> {
281                    let input = input.downcast::<crate::operation::execute_transaction::ExecuteTransactionInput>().expect("correct type");
282                    let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
283                        .expect("a SharedClientProtocol is required");
284                    let mut request = protocol.serialize_request(
285                            &input, ExecuteTransaction::INPUT_SCHEMA, "", _cfg,
286                        ).map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
287                        
288                        return ::std::result::Result::Ok(request);
289                }
290            }
291#[derive(Debug)]
292            struct ExecuteTransactionEndpointParamsInterceptor;
293
294            impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ExecuteTransactionEndpointParamsInterceptor {
295                fn name(&self) -> &'static str {
296                    "ExecuteTransactionEndpointParamsInterceptor"
297                }
298
299                fn read_before_execution(
300                    &self,
301                    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>,
302                    cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
303                ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
304                    let _input = context.input()
305                        .downcast_ref::<ExecuteTransactionInput>()
306                        .ok_or("failed to downcast to ExecuteTransactionInput")?;
307
308                    
309
310                    let params = crate::config::endpoint::Params::builder()
311                        .set_region(cfg.load::<::aws_types::region::Region>().map(|r|r.as_ref().to_owned()))
312.set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
313.set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
314.set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
315.set_account_id_endpoint_mode(::std::option::Option::Some(cfg.load::<::aws_types::endpoint_config::AccountIdEndpointMode>().cloned().unwrap_or_default().to_string()))
316                        .build()
317                        .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?;
318                    cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
319                    ::std::result::Result::Ok(())
320                }
321            }
322
323            // The get_* functions below are generated from JMESPath expressions in the
324            // operationContextParams trait. They target the operation's input shape.
325
326            
327
328/// Error type for the `ExecuteTransactionError` operation.
329#[non_exhaustive]
330#[derive(::std::fmt::Debug)]
331pub enum ExecuteTransactionError {
332    /// <p>DynamoDB rejected the request because you retried a request with a different payload but with an idempotent token that was already used.</p>
333    IdempotentParameterMismatchException(crate::types::error::IdempotentParameterMismatchException),
334    /// <p>An error occurred on the server side.</p>
335    InternalServerError(crate::types::error::InternalServerError),
336    /// <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>
337    ProvisionedThroughputExceededException(crate::types::error::ProvisionedThroughputExceededException),
338    /// <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>
339    RequestLimitExceeded(crate::types::error::RequestLimitExceeded),
340    /// <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>
341    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
342    /// <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>
343    ThrottlingException(crate::types::error::ThrottlingException),
344    /// <p>The entire transaction request was canceled.</p>
345    /// <p>DynamoDB cancels a <code>TransactWriteItems</code> request under the following circumstances:</p>
346    /// <ul>
347    /// <li>
348    /// <p>A condition in one of the condition expressions is not met.</p></li>
349    /// <li>
350    /// <p>A table in the <code>TransactWriteItems</code> request is in a different account or region.</p></li>
351    /// <li>
352    /// <p>More than one action in the <code>TransactWriteItems</code> operation targets the same item.</p></li>
353    /// <li>
354    /// <p>There is insufficient provisioned capacity for the transaction to be completed.</p></li>
355    /// <li>
356    /// <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>
357    /// <li>
358    /// <p>There is a user error, such as an invalid data format.</p></li>
359    /// <li>
360    /// <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>
361    /// </ul>
362    /// <p>DynamoDB cancels a <code>TransactGetItems</code> request under the following circumstances:</p>
363    /// <ul>
364    /// <li>
365    /// <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>
366    /// <li>
367    /// <p>A table in the <code>TransactGetItems</code> request is in a different account or region.</p></li>
368    /// <li>
369    /// <p>There is insufficient provisioned capacity for the transaction to be completed.</p></li>
370    /// <li>
371    /// <p>There is a user error, such as an invalid data format.</p></li>
372    /// </ul><note>
373    /// <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>
374    /// </note>
375    /// <p>Cancellation reason codes and possible error messages:</p>
376    /// <ul>
377    /// <li>
378    /// <p>No Errors:</p>
379    /// <ul>
380    /// <li>
381    /// <p>Code: <code>None</code></p></li>
382    /// <li>
383    /// <p>Message: <code>null</code></p></li>
384    /// </ul></li>
385    /// <li>
386    /// <p>Conditional Check Failed:</p>
387    /// <ul>
388    /// <li>
389    /// <p>Code: <code>ConditionalCheckFailed</code></p></li>
390    /// <li>
391    /// <p>Message: The conditional request failed.</p></li>
392    /// </ul></li>
393    /// <li>
394    /// <p>Item Collection Size Limit Exceeded:</p>
395    /// <ul>
396    /// <li>
397    /// <p>Code: <code>ItemCollectionSizeLimitExceeded</code></p></li>
398    /// <li>
399    /// <p>Message: Collection size exceeded.</p></li>
400    /// </ul></li>
401    /// <li>
402    /// <p>Transaction Conflict:</p>
403    /// <ul>
404    /// <li>
405    /// <p>Code: <code>TransactionConflict</code></p></li>
406    /// <li>
407    /// <p>Message: Transaction is ongoing for the item.</p></li>
408    /// </ul></li>
409    /// <li>
410    /// <p>Provisioned Throughput Exceeded:</p>
411    /// <ul>
412    /// <li>
413    /// <p>Code: <code>ProvisionedThroughputExceeded</code></p></li>
414    /// <li>
415    /// <p>Messages:</p>
416    /// <ul>
417    /// <li>
418    /// <p>The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.</p><note>
419    /// <p>This Message is received when provisioned throughput is exceeded is on a provisioned DynamoDB table.</p>
420    /// </note></li>
421    /// <li>
422    /// <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>
423    /// <p>This message is returned when provisioned throughput is exceeded is on a provisioned GSI.</p>
424    /// </note></li>
425    /// </ul></li>
426    /// </ul></li>
427    /// <li>
428    /// <p>Throttling Error:</p>
429    /// <ul>
430    /// <li>
431    /// <p>Code: <code>ThrottlingError</code></p></li>
432    /// <li>
433    /// <p>Messages:</p>
434    /// <ul>
435    /// <li>
436    /// <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>
437    /// <p>This message is returned when writes get throttled on an On-Demand table as DynamoDB is automatically scaling the table.</p>
438    /// </note></li>
439    /// <li>
440    /// <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>
441    /// <p>This message is returned when writes get throttled on an On-Demand GSI as DynamoDB is automatically scaling the GSI.</p>
442    /// </note></li>
443    /// </ul></li>
444    /// </ul></li>
445    /// <li>
446    /// <p>Validation Error:</p>
447    /// <ul>
448    /// <li>
449    /// <p>Code: <code>ValidationError</code></p></li>
450    /// <li>
451    /// <p>Messages:</p>
452    /// <ul>
453    /// <li>
454    /// <p>One or more parameter values were invalid.</p></li>
455    /// <li>
456    /// <p>The update expression attempted to update the secondary index key beyond allowed size limits.</p></li>
457    /// <li>
458    /// <p>The update expression attempted to update the secondary index key to unsupported type.</p></li>
459    /// <li>
460    /// <p>An operand in the update expression has an incorrect data type.</p></li>
461    /// <li>
462    /// <p>Item size to update has exceeded the maximum allowed size.</p></li>
463    /// <li>
464    /// <p>Number overflow. Attempting to store a number with magnitude larger than supported range.</p></li>
465    /// <li>
466    /// <p>Type mismatch for attribute to update.</p></li>
467    /// <li>
468    /// <p>Nesting Levels have exceeded supported limits.</p></li>
469    /// <li>
470    /// <p>The document path provided in the update expression is invalid for update.</p></li>
471    /// <li>
472    /// <p>The provided expression refers to an attribute that does not exist in the item.</p></li>
473    /// </ul></li>
474    /// </ul></li>
475    /// </ul>
476    TransactionCanceledException(crate::types::error::TransactionCanceledException),
477    /// <p>The transaction with the given request token is already in progress.</p>
478    /// <p>Recommended Settings</p><note>
479    /// <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>
480    /// </note>
481    /// <ul>
482    /// <li>
483    /// <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>
484    /// <li>
485    /// <p>Set <code>socketTimeout</code> to a value a little lower than the <code>requestTimeout</code> setting.</p></li>
486    /// <li>
487    /// <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>
488    /// <li>
489    /// <p>Use exponential backoff when retrying and tune backoff if needed.</p></li>
490    /// </ul>
491    /// <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>
492    /// <p>Example timeline:</p>
493    /// <ul>
494    /// <li>
495    /// <p>0-1000 first attempt</p></li>
496    /// <li>
497    /// <p>1000-1500 first sleep/delay (default retry policy uses 500 ms as base delay for 4xx errors)</p></li>
498    /// <li>
499    /// <p>1500-2500 second attempt</p></li>
500    /// <li>
501    /// <p>2500-3500 second sleep/delay (500 * 2, exponential backoff)</p></li>
502    /// <li>
503    /// <p>3500-4500 third attempt</p></li>
504    /// <li>
505    /// <p>4500-6500 third sleep/delay (500 * 2^2)</p></li>
506    /// <li>
507    /// <p>6500-7500 fourth attempt (this can trigger inline recovery since 5 seconds have elapsed since the first attempt reached TC)</p></li>
508    /// </ul>
509    TransactionInProgressException(crate::types::error::TransactionInProgressException),
510    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
511                    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
512    variable wildcard pattern and check `.code()`:
513     \
514    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
515     \
516    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ExecuteTransactionError) for what information is available for the error.")]
517                    Unhandled(crate::error::sealed_unhandled::Unhandled),
518}
519impl ExecuteTransactionError {
520    /// Creates the `ExecuteTransactionError::Unhandled` variant from any error type.
521                    pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>) -> Self {
522                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() })
523                    }
524    
525                    /// Creates the `ExecuteTransactionError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
526                    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
527                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err })
528                    }
529    /// 
530    /// Returns error metadata, which includes the error code, message,
531    /// request ID, and potentially additional information.
532    /// 
533    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
534        match self {
535            Self::IdempotentParameterMismatchException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
536            Self::InternalServerError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
537            Self::ProvisionedThroughputExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
538            Self::RequestLimitExceeded(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
539            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
540            Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
541            Self::TransactionCanceledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
542            Self::TransactionInProgressException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
543            Self::Unhandled(e) => &e.meta,
544        }
545    }
546    /// Returns `true` if the error kind is `ExecuteTransactionError::IdempotentParameterMismatchException`.
547    pub fn is_idempotent_parameter_mismatch_exception(&self) -> bool {
548        matches!(self, Self::IdempotentParameterMismatchException(_))
549    }
550    /// Returns `true` if the error kind is `ExecuteTransactionError::InternalServerError`.
551    pub fn is_internal_server_error(&self) -> bool {
552        matches!(self, Self::InternalServerError(_))
553    }
554    /// Returns `true` if the error kind is `ExecuteTransactionError::ProvisionedThroughputExceededException`.
555    pub fn is_provisioned_throughput_exceeded_exception(&self) -> bool {
556        matches!(self, Self::ProvisionedThroughputExceededException(_))
557    }
558    /// Returns `true` if the error kind is `ExecuteTransactionError::RequestLimitExceeded`.
559    pub fn is_request_limit_exceeded(&self) -> bool {
560        matches!(self, Self::RequestLimitExceeded(_))
561    }
562    /// Returns `true` if the error kind is `ExecuteTransactionError::ResourceNotFoundException`.
563    pub fn is_resource_not_found_exception(&self) -> bool {
564        matches!(self, Self::ResourceNotFoundException(_))
565    }
566    /// Returns `true` if the error kind is `ExecuteTransactionError::ThrottlingException`.
567    pub fn is_throttling_exception(&self) -> bool {
568        matches!(self, Self::ThrottlingException(_))
569    }
570    /// Returns `true` if the error kind is `ExecuteTransactionError::TransactionCanceledException`.
571    pub fn is_transaction_canceled_exception(&self) -> bool {
572        matches!(self, Self::TransactionCanceledException(_))
573    }
574    /// Returns `true` if the error kind is `ExecuteTransactionError::TransactionInProgressException`.
575    pub fn is_transaction_in_progress_exception(&self) -> bool {
576        matches!(self, Self::TransactionInProgressException(_))
577    }
578}
579impl ::std::error::Error for ExecuteTransactionError {
580    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
581        match self {
582            Self::IdempotentParameterMismatchException(_inner) =>
583            ::std::option::Option::Some(_inner)
584            ,
585            Self::InternalServerError(_inner) =>
586            ::std::option::Option::Some(_inner)
587            ,
588            Self::ProvisionedThroughputExceededException(_inner) =>
589            ::std::option::Option::Some(_inner)
590            ,
591            Self::RequestLimitExceeded(_inner) =>
592            ::std::option::Option::Some(_inner)
593            ,
594            Self::ResourceNotFoundException(_inner) =>
595            ::std::option::Option::Some(_inner)
596            ,
597            Self::ThrottlingException(_inner) =>
598            ::std::option::Option::Some(_inner)
599            ,
600            Self::TransactionCanceledException(_inner) =>
601            ::std::option::Option::Some(_inner)
602            ,
603            Self::TransactionInProgressException(_inner) =>
604            ::std::option::Option::Some(_inner)
605            ,
606            Self::Unhandled(_inner) => {
607                ::std::option::Option::Some(&*_inner.source)
608            }
609        }
610    }
611}
612impl ::std::fmt::Display for ExecuteTransactionError {
613    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
614        match self {
615            Self::IdempotentParameterMismatchException(_inner) =>
616            _inner.fmt(f)
617            ,
618            Self::InternalServerError(_inner) =>
619            _inner.fmt(f)
620            ,
621            Self::ProvisionedThroughputExceededException(_inner) =>
622            _inner.fmt(f)
623            ,
624            Self::RequestLimitExceeded(_inner) =>
625            _inner.fmt(f)
626            ,
627            Self::ResourceNotFoundException(_inner) =>
628            _inner.fmt(f)
629            ,
630            Self::ThrottlingException(_inner) =>
631            _inner.fmt(f)
632            ,
633            Self::TransactionCanceledException(_inner) =>
634            _inner.fmt(f)
635            ,
636            Self::TransactionInProgressException(_inner) =>
637            _inner.fmt(f)
638            ,
639            Self::Unhandled(_inner) => {
640                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
641                                                        write!(f, "unhandled error ({code})")
642                                                    } else {
643                                                        f.write_str("unhandled error")
644                                                    }
645            }
646        }
647    }
648}
649impl ::aws_smithy_types::retry::ProvideErrorKind for ExecuteTransactionError {
650    fn code(&self) -> ::std::option::Option<&str> {
651        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
652    }
653    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
654        ::std::option::Option::None
655    }
656}
657impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ExecuteTransactionError {
658    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
659        match self {
660            Self::IdempotentParameterMismatchException(_inner) =>
661            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
662            ,
663            Self::InternalServerError(_inner) =>
664            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
665            ,
666            Self::ProvisionedThroughputExceededException(_inner) =>
667            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
668            ,
669            Self::RequestLimitExceeded(_inner) =>
670            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
671            ,
672            Self::ResourceNotFoundException(_inner) =>
673            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
674            ,
675            Self::ThrottlingException(_inner) =>
676            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
677            ,
678            Self::TransactionCanceledException(_inner) =>
679            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
680            ,
681            Self::TransactionInProgressException(_inner) =>
682            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
683            ,
684            Self::Unhandled(_inner) => {
685                &_inner.meta
686            }
687        }
688    }
689}
690impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ExecuteTransactionError {
691    fn create_unhandled_error(
692                        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
693                        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>
694                    ) -> Self {
695        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() })
696    }
697}
698impl ::aws_types::request_id::RequestId for crate::operation::execute_transaction::ExecuteTransactionError {
699                                fn request_id(&self) -> Option<&str> {
700                                    self.meta().request_id()
701                                }
702                            }
703
704pub use crate::operation::execute_transaction::_execute_transaction_input::ExecuteTransactionInput;
705
706pub use crate::operation::execute_transaction::_execute_transaction_output::ExecuteTransactionOutput;
707
708mod _execute_transaction_input;
709
710mod _execute_transaction_output;
711
712/// Builders
713pub mod builders;
714