aws_sdk_dynamodb/operation/
batch_write_item.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `BatchWriteItem`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct BatchWriteItem;
6impl BatchWriteItem {
7    /// Creates a new `BatchWriteItem`
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::batch_write_item::BatchWriteItemInput::SCHEMA;
13                    /// The schema for this operation's output shape.
14                    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::batch_write_item::BatchWriteItemOutput::SCHEMA;
15    pub(crate) async fn orchestrate(
16                        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17                        input: crate::operation::batch_write_item::BatchWriteItemInput,
18                    ) -> ::std::result::Result<crate::operation::batch_write_item::BatchWriteItemOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::batch_write_item::BatchWriteItemError, ::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::batch_write_item::BatchWriteItemError>().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::batch_write_item::BatchWriteItemOutput>().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::batch_write_item::BatchWriteItemInput,
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                            "BatchWriteItem",
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.BatchWriteItem",
49                                "rpc.service" = "DynamoDB",
50                                "rpc.method" = "BatchWriteItem",
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                        
64                        if let ::std::option::Option::Some(config_override) = config_override {
65                            for plugin in config_override.runtime_plugins.iter().cloned() {
66                                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
67                            }
68                            runtime_plugins = runtime_plugins.with_operation_plugin(
69                                crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components)
70                            );
71                        }
72                        runtime_plugins
73                    }
74}
75impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for BatchWriteItem {
76                fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
77                    let mut cfg = ::aws_smithy_types::config_bag::Layer::new("BatchWriteItem");
78
79                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(BatchWriteItemRequestSerializer));
80                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(BatchWriteItemResponseDeserializer));
81
82                    cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
83                        crate::config::auth::Params::builder()
84                            .operation_name("BatchWriteItem")
85                            .build()
86                            .expect("required fields set")
87                    ));
88
89                    cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
90                            "BatchWriteItem",
91                            "DynamoDB",
92                        ));
93let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
94                            signing_options.double_uri_encode = true;
95                            signing_options.content_sha256_header = false;
96                            signing_options.normalize_uri_path = true;
97                            signing_options.payload_override = None;
98
99                            cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
100                                signing_options,
101                                ..::std::default::Default::default()
102                            });
103
104                    ::std::option::Option::Some(cfg.freeze())
105                }
106
107                fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
108                    #[allow(unused_mut)]
109                    let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("BatchWriteItem")
110                            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
111.with_interceptor(BatchWriteItemEndpointParamsInterceptor)
112                            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::batch_write_item::BatchWriteItemError>::new())
113.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::batch_write_item::BatchWriteItemError>::new())
114.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::batch_write_item::BatchWriteItemError>::new());
115
116                    ::std::borrow::Cow::Owned(rcb)
117                }
118            }
119
120            
121#[derive(Debug)]
122            struct BatchWriteItemResponseDeserializer;
123            impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for BatchWriteItemResponseDeserializer {
124                
125
126                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 {
127                    let (success, status) = (response.status().is_success(), response.status().as_u16());
128            #[allow(unused_mut)]
129            let mut force_error = false;
130            ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
131            if !success && status != 200 || force_error {
132                let headers = response.headers();
133                let body = response.body().bytes().expect("body loaded");
134#[allow(unused_mut)]
135            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body)
136                .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
137            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
138            let generic = generic_builder.build();
139let error_code = match generic.code() {
140                    ::std::option::Option::Some(code) => code,
141                    ::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::batch_write_item::BatchWriteItemError::unhandled(generic)))),
142                };
143                let _error_message = generic.message().map(|msg| msg.to_owned());
144                let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
145                    .expect("a SharedClientProtocol is required");
146let err = match error_code {
147"InternalServerError" => crate::operation::batch_write_item::BatchWriteItemError::InternalServerError({
148let mut tmp = match protocol.deserialize_response(response, crate::types::error::InternalServerError::SCHEMA, _cfg)
149                        .and_then(|mut deser| crate::types::error::InternalServerError::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
150                    {
151                        ::std::result::Result::Ok(val) => val,
152                        ::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))),
153                    };
154                    tmp.meta = generic;
155if tmp.message.is_none() {
156                                tmp.message = _error_message;
157                            }
158tmp
159}),
160"InvalidEndpointException" => crate::operation::batch_write_item::BatchWriteItemError::InvalidEndpointException({
161let mut tmp = match protocol.deserialize_response(response, crate::types::error::InvalidEndpointException::SCHEMA, _cfg)
162                        .and_then(|mut deser| crate::types::error::InvalidEndpointException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
163                    {
164                        ::std::result::Result::Ok(val) => val,
165                        ::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))),
166                    };
167                    tmp.meta = generic;
168if tmp.message.is_none() {
169                                tmp.message = _error_message;
170                            }
171tmp
172}),
173"ItemCollectionSizeLimitExceededException" => crate::operation::batch_write_item::BatchWriteItemError::ItemCollectionSizeLimitExceededException({
174let mut tmp = match protocol.deserialize_response(response, crate::types::error::ItemCollectionSizeLimitExceededException::SCHEMA, _cfg)
175                        .and_then(|mut deser| crate::types::error::ItemCollectionSizeLimitExceededException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
176                    {
177                        ::std::result::Result::Ok(val) => val,
178                        ::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))),
179                    };
180                    tmp.meta = generic;
181if tmp.message.is_none() {
182                                tmp.message = _error_message;
183                            }
184tmp
185}),
186"ProvisionedThroughputExceededException" => crate::operation::batch_write_item::BatchWriteItemError::ProvisionedThroughputExceededException({
187let mut tmp = match protocol.deserialize_response(response, crate::types::error::ProvisionedThroughputExceededException::SCHEMA, _cfg)
188                        .and_then(|mut deser| crate::types::error::ProvisionedThroughputExceededException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
189                    {
190                        ::std::result::Result::Ok(val) => val,
191                        ::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))),
192                    };
193                    tmp.meta = generic;
194if tmp.message.is_none() {
195                                tmp.message = _error_message;
196                            }
197tmp
198}),
199"ReplicatedWriteConflictException" => crate::operation::batch_write_item::BatchWriteItemError::ReplicatedWriteConflictException({
200let mut tmp = match protocol.deserialize_response(response, crate::types::error::ReplicatedWriteConflictException::SCHEMA, _cfg)
201                        .and_then(|mut deser| crate::types::error::ReplicatedWriteConflictException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
202                    {
203                        ::std::result::Result::Ok(val) => val,
204                        ::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))),
205                    };
206                    tmp.meta = generic;
207if tmp.message.is_none() {
208                                tmp.message = _error_message;
209                            }
210tmp
211}),
212"RequestLimitExceeded" => crate::operation::batch_write_item::BatchWriteItemError::RequestLimitExceeded({
213let mut tmp = match protocol.deserialize_response(response, crate::types::error::RequestLimitExceeded::SCHEMA, _cfg)
214                        .and_then(|mut deser| crate::types::error::RequestLimitExceeded::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
215                    {
216                        ::std::result::Result::Ok(val) => val,
217                        ::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))),
218                    };
219                    tmp.meta = generic;
220if tmp.message.is_none() {
221                                tmp.message = _error_message;
222                            }
223tmp
224}),
225"ResourceNotFoundException" => crate::operation::batch_write_item::BatchWriteItemError::ResourceNotFoundException({
226let mut tmp = match protocol.deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
227                        .and_then(|mut deser| crate::types::error::ResourceNotFoundException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
228                    {
229                        ::std::result::Result::Ok(val) => val,
230                        ::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))),
231                    };
232                    tmp.meta = generic;
233if tmp.message.is_none() {
234                                tmp.message = _error_message;
235                            }
236tmp
237}),
238"ThrottlingException" => crate::operation::batch_write_item::BatchWriteItemError::ThrottlingException({
239let mut tmp = match protocol.deserialize_response(response, crate::types::error::ThrottlingException::SCHEMA, _cfg)
240                        .and_then(|mut deser| crate::types::error::ThrottlingException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
241                    {
242                        ::std::result::Result::Ok(val) => val,
243                        ::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))),
244                    };
245                    tmp.meta = generic;
246if tmp.message.is_none() {
247                                tmp.message = _error_message;
248                            }
249tmp
250}),
251_ => crate::operation::batch_write_item::BatchWriteItemError::generic(generic)
252};
253                ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err)))
254} else {
255                let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
256                    .expect("a SharedClientProtocol is required");
257                let mut deser = protocol.deserialize_response(response, BatchWriteItem::OUTPUT_SCHEMA, _cfg)
258                    .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
259                let body = response.body().bytes().expect("body loaded");
260                let output = crate::operation::batch_write_item::BatchWriteItemOutput::deserialize_with_response(
261                    &mut *deser,
262                    response.headers(),
263                    response.status().into(),
264                    body,
265                ).map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
266                ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
267            }
268                }
269            }
270#[derive(Debug)]
271            struct BatchWriteItemRequestSerializer;
272            impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for BatchWriteItemRequestSerializer {
273                #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
274                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> {
275                    let input = input.downcast::<crate::operation::batch_write_item::BatchWriteItemInput>().expect("correct type");
276                    let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
277                        .expect("a SharedClientProtocol is required");
278                    let mut request = protocol.serialize_request(
279                            &input, BatchWriteItem::INPUT_SCHEMA, "", _cfg,
280                        ).map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
281                        
282                        return ::std::result::Result::Ok(request);
283                }
284            }
285#[derive(Debug)]
286            struct BatchWriteItemEndpointParamsInterceptor;
287
288            impl ::aws_smithy_runtime_api::client::interceptors::Intercept for BatchWriteItemEndpointParamsInterceptor {
289                fn name(&self) -> &'static str {
290                    "BatchWriteItemEndpointParamsInterceptor"
291                }
292
293                fn read_before_execution(
294                    &self,
295                    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>,
296                    cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
297                ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
298                    let _input = context.input()
299                        .downcast_ref::<BatchWriteItemInput>()
300                        .ok_or("failed to downcast to BatchWriteItemInput")?;
301
302                    
303
304                    let params = crate::config::endpoint::Params::builder()
305                        .set_region(cfg.load::<::aws_types::region::Region>().map(|r|r.as_ref().to_owned()))
306.set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
307.set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
308.set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
309.set_account_id_endpoint_mode(::std::option::Option::Some(cfg.load::<::aws_types::endpoint_config::AccountIdEndpointMode>().cloned().unwrap_or_default().to_string()))
310.set_resource_arn_list(get_resource_arn_list(_input))
311                        .build()
312                        .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?;
313                    cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
314                    ::std::result::Result::Ok(())
315                }
316            }
317
318            // The get_* functions below are generated from JMESPath expressions in the
319            // operationContextParams trait. They target the operation's input shape.
320
321            // Generated from JMESPath Expression: keys(RequestItems)
322fn get_resource_arn_list(input: &crate::operation::batch_write_item::BatchWriteItemInput) -> Option<::std::vec::Vec::<::std::string::String>> {
323    let _fld_2 = input.request_items.as_ref()?;
324    let _ret_1 = _fld_2.keys().map(Clone::clone).collect::<Vec<String>>();
325    Some(_ret_1)
326}
327
328/// Error type for the `BatchWriteItemError` operation.
329#[non_exhaustive]
330#[derive(::std::fmt::Debug)]
331pub enum BatchWriteItemError {
332    /// <p>An error occurred on the server side.</p>
333    InternalServerError(crate::types::error::InternalServerError),
334    #[allow(missing_docs)] // documentation missing in model
335    InvalidEndpointException(crate::types::error::InvalidEndpointException),
336    /// <p>An item collection is too large. This exception is only returned for tables that have one or more local secondary indexes.</p>
337    ItemCollectionSizeLimitExceededException(crate::types::error::ItemCollectionSizeLimitExceededException),
338    /// <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>
339    ProvisionedThroughputExceededException(crate::types::error::ProvisionedThroughputExceededException),
340    /// <p>The request was rejected because one or more items in the request are being modified by a request in another Region.</p>
341    ReplicatedWriteConflictException(crate::types::error::ReplicatedWriteConflictException),
342    /// <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>
343    RequestLimitExceeded(crate::types::error::RequestLimitExceeded),
344    /// <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>
345    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
346    /// <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>
347    ThrottlingException(crate::types::error::ThrottlingException),
348    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
349                    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
350    variable wildcard pattern and check `.code()`:
351     \
352    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
353     \
354    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-BatchWriteItemError) for what information is available for the error.")]
355                    Unhandled(crate::error::sealed_unhandled::Unhandled),
356}
357impl BatchWriteItemError {
358    /// Creates the `BatchWriteItemError::Unhandled` variant from any error type.
359                    pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>) -> Self {
360                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() })
361                    }
362    
363                    /// Creates the `BatchWriteItemError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
364                    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
365                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err })
366                    }
367    /// 
368    /// Returns error metadata, which includes the error code, message,
369    /// request ID, and potentially additional information.
370    /// 
371    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
372        match self {
373            Self::InternalServerError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
374            Self::InvalidEndpointException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
375            Self::ItemCollectionSizeLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
376            Self::ProvisionedThroughputExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
377            Self::ReplicatedWriteConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
378            Self::RequestLimitExceeded(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
379            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
380            Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
381            Self::Unhandled(e) => &e.meta,
382        }
383    }
384    /// Returns `true` if the error kind is `BatchWriteItemError::InternalServerError`.
385    pub fn is_internal_server_error(&self) -> bool {
386        matches!(self, Self::InternalServerError(_))
387    }
388    /// Returns `true` if the error kind is `BatchWriteItemError::InvalidEndpointException`.
389    pub fn is_invalid_endpoint_exception(&self) -> bool {
390        matches!(self, Self::InvalidEndpointException(_))
391    }
392    /// Returns `true` if the error kind is `BatchWriteItemError::ItemCollectionSizeLimitExceededException`.
393    pub fn is_item_collection_size_limit_exceeded_exception(&self) -> bool {
394        matches!(self, Self::ItemCollectionSizeLimitExceededException(_))
395    }
396    /// Returns `true` if the error kind is `BatchWriteItemError::ProvisionedThroughputExceededException`.
397    pub fn is_provisioned_throughput_exceeded_exception(&self) -> bool {
398        matches!(self, Self::ProvisionedThroughputExceededException(_))
399    }
400    /// Returns `true` if the error kind is `BatchWriteItemError::ReplicatedWriteConflictException`.
401    pub fn is_replicated_write_conflict_exception(&self) -> bool {
402        matches!(self, Self::ReplicatedWriteConflictException(_))
403    }
404    /// Returns `true` if the error kind is `BatchWriteItemError::RequestLimitExceeded`.
405    pub fn is_request_limit_exceeded(&self) -> bool {
406        matches!(self, Self::RequestLimitExceeded(_))
407    }
408    /// Returns `true` if the error kind is `BatchWriteItemError::ResourceNotFoundException`.
409    pub fn is_resource_not_found_exception(&self) -> bool {
410        matches!(self, Self::ResourceNotFoundException(_))
411    }
412    /// Returns `true` if the error kind is `BatchWriteItemError::ThrottlingException`.
413    pub fn is_throttling_exception(&self) -> bool {
414        matches!(self, Self::ThrottlingException(_))
415    }
416}
417impl ::std::error::Error for BatchWriteItemError {
418    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
419        match self {
420            Self::InternalServerError(_inner) =>
421            ::std::option::Option::Some(_inner)
422            ,
423            Self::InvalidEndpointException(_inner) =>
424            ::std::option::Option::Some(_inner)
425            ,
426            Self::ItemCollectionSizeLimitExceededException(_inner) =>
427            ::std::option::Option::Some(_inner)
428            ,
429            Self::ProvisionedThroughputExceededException(_inner) =>
430            ::std::option::Option::Some(_inner)
431            ,
432            Self::ReplicatedWriteConflictException(_inner) =>
433            ::std::option::Option::Some(_inner)
434            ,
435            Self::RequestLimitExceeded(_inner) =>
436            ::std::option::Option::Some(_inner)
437            ,
438            Self::ResourceNotFoundException(_inner) =>
439            ::std::option::Option::Some(_inner)
440            ,
441            Self::ThrottlingException(_inner) =>
442            ::std::option::Option::Some(_inner)
443            ,
444            Self::Unhandled(_inner) => {
445                ::std::option::Option::Some(&*_inner.source)
446            }
447        }
448    }
449}
450impl ::std::fmt::Display for BatchWriteItemError {
451    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
452        match self {
453            Self::InternalServerError(_inner) =>
454            _inner.fmt(f)
455            ,
456            Self::InvalidEndpointException(_inner) =>
457            _inner.fmt(f)
458            ,
459            Self::ItemCollectionSizeLimitExceededException(_inner) =>
460            _inner.fmt(f)
461            ,
462            Self::ProvisionedThroughputExceededException(_inner) =>
463            _inner.fmt(f)
464            ,
465            Self::ReplicatedWriteConflictException(_inner) =>
466            _inner.fmt(f)
467            ,
468            Self::RequestLimitExceeded(_inner) =>
469            _inner.fmt(f)
470            ,
471            Self::ResourceNotFoundException(_inner) =>
472            _inner.fmt(f)
473            ,
474            Self::ThrottlingException(_inner) =>
475            _inner.fmt(f)
476            ,
477            Self::Unhandled(_inner) => {
478                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
479                                                        write!(f, "unhandled error ({code})")
480                                                    } else {
481                                                        f.write_str("unhandled error")
482                                                    }
483            }
484        }
485    }
486}
487impl ::aws_smithy_types::retry::ProvideErrorKind for BatchWriteItemError {
488    fn code(&self) -> ::std::option::Option<&str> {
489        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
490    }
491    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
492        match self {
493            Self::ReplicatedWriteConflictException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
494            _ => ::std::option::Option::None
495        }
496    }
497}
498impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for BatchWriteItemError {
499    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
500        match self {
501            Self::InternalServerError(_inner) =>
502            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
503            ,
504            Self::InvalidEndpointException(_inner) =>
505            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
506            ,
507            Self::ItemCollectionSizeLimitExceededException(_inner) =>
508            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
509            ,
510            Self::ProvisionedThroughputExceededException(_inner) =>
511            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
512            ,
513            Self::ReplicatedWriteConflictException(_inner) =>
514            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
515            ,
516            Self::RequestLimitExceeded(_inner) =>
517            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
518            ,
519            Self::ResourceNotFoundException(_inner) =>
520            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
521            ,
522            Self::ThrottlingException(_inner) =>
523            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
524            ,
525            Self::Unhandled(_inner) => {
526                &_inner.meta
527            }
528        }
529    }
530}
531impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for BatchWriteItemError {
532    fn create_unhandled_error(
533                        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
534                        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>
535                    ) -> Self {
536        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() })
537    }
538}
539impl ::aws_types::request_id::RequestId for crate::operation::batch_write_item::BatchWriteItemError {
540                                fn request_id(&self) -> Option<&str> {
541                                    self.meta().request_id()
542                                }
543                            }
544
545pub use crate::operation::batch_write_item::_batch_write_item_input::BatchWriteItemInput;
546
547pub use crate::operation::batch_write_item::_batch_write_item_output::BatchWriteItemOutput;
548
549mod _batch_write_item_input;
550
551mod _batch_write_item_output;
552
553/// Builders
554pub mod builders;
555