Skip to main content

aws_sdk_glue/operation/
batch_create_partition.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `BatchCreatePartition`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct BatchCreatePartition;
6impl BatchCreatePartition {
7    /// Creates a new `BatchCreatePartition`
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<'static> =
13        crate::operation::batch_create_partition::BatchCreatePartitionInput::SCHEMA;
14    /// The schema for this operation's output shape.
15    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
16        crate::operation::batch_create_partition::BatchCreatePartitionOutput::SCHEMA;
17    pub(crate) async fn orchestrate(
18        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
19        input: crate::operation::batch_create_partition::BatchCreatePartitionInput,
20    ) -> ::std::result::Result<
21        crate::operation::batch_create_partition::BatchCreatePartitionOutput,
22        ::aws_smithy_runtime_api::client::result::SdkError<
23            crate::operation::batch_create_partition::BatchCreatePartitionError,
24            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
25        >,
26    > {
27        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
28            ::aws_smithy_runtime_api::client::interceptors::context::Error,
29            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
30        >| {
31            err.map_service_error(|err| {
32                err.downcast::<crate::operation::batch_create_partition::BatchCreatePartitionError>()
33                    .expect("correct error type")
34            })
35        };
36        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
37            .await
38            .map_err(map_err)?;
39        let output = context.finalize().map_err(map_err)?;
40        ::std::result::Result::Ok(
41            output
42                .downcast::<crate::operation::batch_create_partition::BatchCreatePartitionOutput>()
43                .expect("correct output type"),
44        )
45    }
46
47    pub(crate) async fn orchestrate_with_stop_point(
48        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
49        input: crate::operation::batch_create_partition::BatchCreatePartitionInput,
50        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
51    ) -> ::std::result::Result<
52        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
53        ::aws_smithy_runtime_api::client::result::SdkError<
54            ::aws_smithy_runtime_api::client::interceptors::context::Error,
55            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
56        >,
57    > {
58        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
59        use ::tracing::Instrument;
60        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("Glue", "BatchCreatePartition", input, runtime_plugins, stop_point)
61            // Create a parent span for the entire operation. Includes a random, internal-only,
62            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
63            .instrument(::tracing::debug_span!(
64                "Glue.BatchCreatePartition",
65                "rpc.service" = "Glue",
66                "rpc.method" = "BatchCreatePartition",
67                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
68                "rpc.system" = "aws-api",
69            ))
70            .await
71    }
72
73    pub(crate) fn operation_runtime_plugins(
74        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
75        client_config: &crate::config::Config,
76        config_override: ::std::option::Option<crate::config::Builder>,
77    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
78        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
79
80        if let ::std::option::Option::Some(config_override) = config_override {
81            for plugin in config_override.runtime_plugins.iter().cloned() {
82                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
83            }
84            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
85                config_override,
86                client_config.config.clone(),
87                &client_config.runtime_components,
88            ));
89        }
90        runtime_plugins
91    }
92}
93/// Per-operation error registry. Contains an entry for every modeled
94/// error this operation can throw.
95///
96/// Used by the schema-serde error path as the operation-scoped lookup
97/// for registry-backed error reification: an error code that does not
98/// match one of the operation's modeled errors directly is resolved
99/// against this registry first, then widened to the service-wide error
100/// registry.
101pub(crate) mod error_registry {
102    pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
103        ::aws_smithy_schema::registry::TypeRegistry::builder()
104                            .insert_error_shape(
105                        crate::types::error::AlreadyExistsException::SCHEMA,
106                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
107                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::AlreadyExistsException::deserialize(d)?))
108                        },
109                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
110                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::AlreadyExistsException::deserialize(d)?))
111                        },
112                    )
113.insert_error_shape(
114                        crate::types::error::ConcurrentModificationException::SCHEMA,
115                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
116                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ConcurrentModificationException::deserialize(d)?))
117                        },
118                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
119                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ConcurrentModificationException::deserialize(d)?))
120                        },
121                    )
122.insert_error_shape(
123                        crate::types::error::EntityNotFoundException::SCHEMA,
124                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
125                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::EntityNotFoundException::deserialize(d)?))
126                        },
127                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
128                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::EntityNotFoundException::deserialize(d)?))
129                        },
130                    )
131.insert_error_shape(
132                        crate::types::error::GlueEncryptionException::SCHEMA,
133                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
134                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::GlueEncryptionException::deserialize(d)?))
135                        },
136                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
137                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::GlueEncryptionException::deserialize(d)?))
138                        },
139                    )
140.insert_error_shape(
141                        crate::types::error::InternalServiceException::SCHEMA,
142                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
143                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InternalServiceException::deserialize(d)?))
144                        },
145                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
146                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InternalServiceException::deserialize(d)?))
147                        },
148                    )
149.insert_error_shape(
150                        crate::types::error::InvalidInputException::SCHEMA,
151                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
152                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidInputException::deserialize(d)?))
153                        },
154                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
155                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidInputException::deserialize(d)?))
156                        },
157                    )
158.insert_error_shape(
159                        crate::types::error::OperationTimeoutException::SCHEMA,
160                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
161                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::OperationTimeoutException::deserialize(d)?))
162                        },
163                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
164                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::OperationTimeoutException::deserialize(d)?))
165                        },
166                    )
167.insert_error_shape(
168                        crate::types::error::ResourceNumberLimitExceededException::SCHEMA,
169                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
170                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceNumberLimitExceededException::deserialize(d)?))
171                        },
172                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
173                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceNumberLimitExceededException::deserialize(d)?))
174                        },
175                    )
176                            .build()
177    });
178}
179impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for BatchCreatePartition {
180    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
181        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("BatchCreatePartition");
182
183        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
184            BatchCreatePartitionRequestSerializer,
185        ));
186        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
187            BatchCreatePartitionResponseDeserializer,
188        ));
189
190        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
191            crate::config::auth::Params::builder()
192                .operation_name("BatchCreatePartition")
193                .build()
194                .expect("required fields set"),
195        ));
196
197        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
198            "BatchCreatePartition",
199            "Glue",
200        ));
201        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
202        signing_options.double_uri_encode = true;
203        signing_options.content_sha256_header = false;
204        signing_options.normalize_uri_path = true;
205        signing_options.payload_override = None;
206
207        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
208            signing_options,
209            ..::std::default::Default::default()
210        });
211
212        ::std::option::Option::Some(cfg.freeze())
213    }
214
215    fn runtime_components(
216        &self,
217        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
218    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
219        #[allow(unused_mut)]
220        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("BatchCreatePartition")
221            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
222                BatchCreatePartitionTelemetryInputCaptureInterceptor,
223            ))
224            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
225                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
226            ))
227            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
228                BatchCreatePartitionEndpointParamsInterceptor,
229            ))
230            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
231                crate::operation::batch_create_partition::BatchCreatePartitionError,
232            >::new())
233            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
234                crate::operation::batch_create_partition::BatchCreatePartitionError,
235            >::new())
236            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
237                crate::operation::batch_create_partition::BatchCreatePartitionError,
238            >::new())
239            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
240                crate::operation::batch_create_partition::BatchCreatePartitionError,
241            >::new());
242
243        ::std::borrow::Cow::Owned(rcb)
244    }
245}
246
247#[derive(Debug)]
248struct BatchCreatePartitionTelemetryInputCaptureInterceptor;
249
250#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
251impl ::aws_smithy_runtime_api::client::interceptors::Intercept for BatchCreatePartitionTelemetryInputCaptureInterceptor {
252    fn name(&self) -> &'static str {
253        "BatchCreatePartitionTelemetryInputCaptureInterceptor"
254    }
255
256    fn read_before_execution(
257        &self,
258        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
259            '_,
260            ::aws_smithy_runtime_api::client::interceptors::context::Input,
261            ::aws_smithy_runtime_api::client::interceptors::context::Output,
262            ::aws_smithy_runtime_api::client::interceptors::context::Error,
263        >,
264        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
265    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
266        // Nothing to do unless the customer opted in by naming members to record.
267        let ::std::option::Option::Some(requested) = cfg
268            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
269            .filter(|r| !r.is_empty())
270        else {
271            return ::std::result::Result::Ok(());
272        };
273
274        let ::std::option::Option::Some(input) = context.input().downcast_ref::<BatchCreatePartitionInput>() else {
275            // A mismatched input is not this interceptor's concern; skip quietly.
276            return ::std::result::Result::Ok(());
277        };
278
279        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
280        if requested.should_capture("CatalogId") {
281            if let ::std::option::Option::Some(value) = input.catalog_id.as_deref() {
282                captured.insert("CatalogId", value);
283            }
284        }
285        if requested.should_capture("DatabaseName") {
286            if let ::std::option::Option::Some(value) = input.database_name.as_deref() {
287                captured.insert("DatabaseName", value);
288            }
289        }
290        if requested.should_capture("TableName") {
291            if let ::std::option::Option::Some(value) = input.table_name.as_deref() {
292                captured.insert("TableName", value);
293            }
294        }
295
296        cfg.interceptor_state().store_put(captured);
297        ::std::result::Result::Ok(())
298    }
299}
300#[derive(Debug)]
301struct BatchCreatePartitionResponseDeserializer;
302impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for BatchCreatePartitionResponseDeserializer {
303    fn deserialize_nonstreaming_with_config(
304        &self,
305        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
306        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
307    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
308        let (success, status) = (response.status().is_success(), response.status().as_u16());
309        // Load body and headers BEFORE BeforeParseResponse so customizations
310        // (e.g., S3's `body_is_error` check that detects errors returned with
311        // HTTP 200) can inspect them. The legacy non-streaming path also
312        // loads `body` before firing this hook.
313        #[allow(unused_variables)]
314        let body = response.body().bytes().expect("body loaded");
315        let headers = response.headers();
316        #[allow(unused_mut)]
317        let mut force_error = false;
318        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
319        if !success && status != 200 || force_error {
320            let protocol = _cfg
321                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
322                .expect("a SharedClientProtocol is required");
323            #[allow(unused_mut)]
324            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
325                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
326            })?;
327            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
328            let generic = generic_builder.build();
329            let error_code = match generic.code() {
330                ::std::option::Option::Some(code) => code,
331                ::std::option::Option::None => {
332                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
333                        ::aws_smithy_runtime_api::box_error::BoxError::from(
334                            crate::operation::batch_create_partition::BatchCreatePartitionError::unhandled(generic),
335                        ),
336                    ))
337                }
338            };
339            let _error_message = generic.message().map(|msg| msg.to_owned());
340            let err = match error_code {
341                "AlreadyExistsException" => crate::operation::batch_create_partition::BatchCreatePartitionError::AlreadyExistsException({
342                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
343                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
344                            e,
345                        ))
346                    })?;
347                    let mut tmp = <crate::types::error::builders::AlreadyExistsExceptionBuilder>::default();
348                    tmp.deserialize_members(&mut *deser).map_err(|e| {
349                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
350                            e,
351                        ))
352                    })?;
353                    if tmp.message.is_none() {
354                        tmp.message = _error_message;
355                    }
356                    let tmp = tmp.meta(generic);
357                    tmp.build()
358                }),
359                "ConcurrentModificationException" => {
360                    crate::operation::batch_create_partition::BatchCreatePartitionError::ConcurrentModificationException({
361                        let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
362                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
363                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
364                            )
365                        })?;
366                        let mut tmp = <crate::types::error::builders::ConcurrentModificationExceptionBuilder>::default();
367                        tmp.deserialize_members(&mut *deser).map_err(|e| {
368                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
369                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
370                            )
371                        })?;
372                        if tmp.message.is_none() {
373                            tmp.message = _error_message;
374                        }
375                        let tmp = tmp.meta(generic);
376                        tmp.build()
377                    })
378                }
379                "EntityNotFoundException" => crate::operation::batch_create_partition::BatchCreatePartitionError::EntityNotFoundException({
380                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
381                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
382                            e,
383                        ))
384                    })?;
385                    let mut tmp = <crate::types::error::builders::EntityNotFoundExceptionBuilder>::default();
386                    tmp.deserialize_members(&mut *deser).map_err(|e| {
387                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
388                            e,
389                        ))
390                    })?;
391                    if tmp.message.is_none() {
392                        tmp.message = _error_message;
393                    }
394                    let tmp = tmp.meta(generic);
395                    tmp.build()
396                }),
397                "GlueEncryptionException" => crate::operation::batch_create_partition::BatchCreatePartitionError::GlueEncryptionException({
398                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
399                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
400                            e,
401                        ))
402                    })?;
403                    let mut tmp = <crate::types::error::builders::GlueEncryptionExceptionBuilder>::default();
404                    tmp.deserialize_members(&mut *deser).map_err(|e| {
405                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
406                            e,
407                        ))
408                    })?;
409                    if tmp.message.is_none() {
410                        tmp.message = _error_message;
411                    }
412                    let tmp = tmp.meta(generic);
413                    tmp.build()
414                }),
415                "InternalServiceException" => crate::operation::batch_create_partition::BatchCreatePartitionError::InternalServiceException({
416                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
417                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
418                            e,
419                        ))
420                    })?;
421                    let mut tmp = <crate::types::error::builders::InternalServiceExceptionBuilder>::default();
422                    tmp.deserialize_members(&mut *deser).map_err(|e| {
423                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
424                            e,
425                        ))
426                    })?;
427                    if tmp.message.is_none() {
428                        tmp.message = _error_message;
429                    }
430                    let tmp = tmp.meta(generic);
431                    tmp.build()
432                }),
433                "InvalidInputException" => crate::operation::batch_create_partition::BatchCreatePartitionError::InvalidInputException({
434                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
435                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
436                            e,
437                        ))
438                    })?;
439                    let mut tmp = <crate::types::error::builders::InvalidInputExceptionBuilder>::default();
440                    tmp.deserialize_members(&mut *deser).map_err(|e| {
441                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
442                            e,
443                        ))
444                    })?;
445                    if tmp.message.is_none() {
446                        tmp.message = _error_message;
447                    }
448                    let tmp = tmp.meta(generic);
449                    tmp.build()
450                }),
451                "OperationTimeoutException" => crate::operation::batch_create_partition::BatchCreatePartitionError::OperationTimeoutException({
452                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
453                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
454                            e,
455                        ))
456                    })?;
457                    let mut tmp = <crate::types::error::builders::OperationTimeoutExceptionBuilder>::default();
458                    tmp.deserialize_members(&mut *deser).map_err(|e| {
459                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
460                            e,
461                        ))
462                    })?;
463                    if tmp.message.is_none() {
464                        tmp.message = _error_message;
465                    }
466                    let tmp = tmp.meta(generic);
467                    tmp.build()
468                }),
469                "ResourceNumberLimitExceededException" => {
470                    crate::operation::batch_create_partition::BatchCreatePartitionError::ResourceNumberLimitExceededException({
471                        let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
472                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
473                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
474                            )
475                        })?;
476                        let mut tmp = <crate::types::error::builders::ResourceNumberLimitExceededExceptionBuilder>::default();
477                        tmp.deserialize_members(&mut *deser).map_err(|e| {
478                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
479                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
480                            )
481                        })?;
482                        if tmp.message.is_none() {
483                            tmp.message = _error_message;
484                        }
485                        let tmp = tmp.meta(generic);
486                        tmp.build()
487                    })
488                }
489                _ => {
490                    // Registry-backed, operation-scoped reification of an error whose
491                    // code this operation does not model directly: the operation's own
492                    // error registry is consulted first, then the lookup widens to the
493                    // service-wide error registry. On a hit, the reified error is attached
494                    // as the source of the returned unhandled error while its metadata
495                    // (code, message, request id) is preserved; on a miss the generic
496                    // error is returned unchanged.
497                    match protocol
498                        .deserialize_error_response(response, _cfg)
499                        .ok()
500                        .and_then(|mut deser| {
501                            ::aws_smithy_schema::registry::reify_error(
502                                crate::operation::batch_create_partition::error_registry::REGISTRY
503                                    .or(&crate::error_type_registry::REGISTRY),
504                                error_code,
505                                &mut *deser,
506                            )
507                        }) {
508                        ::std::option::Option::Some(source) => <crate::operation::batch_create_partition::BatchCreatePartitionError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
509                        ::std::option::Option::None => crate::operation::batch_create_partition::BatchCreatePartitionError::generic(generic),
510                    }
511                }
512            };
513            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
514                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
515            ))
516        } else {
517            let protocol = _cfg
518                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
519                .expect("a SharedClientProtocol is required");
520            let mut deser = protocol
521                .deserialize_response(response, BatchCreatePartition::OUTPUT_SCHEMA, _cfg)
522                .map_err(|e| {
523                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
524                })?;
525            // `headers` is already in scope from the top of the function; alias it as
526            // `_response_headers` so MutateOutput customizations have a stable name to
527            // read from.
528            let _response_headers = headers;
529            // `mut` is required because `deserialize_members` and the `MutateOutput`
530            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
531            // empty output has no members and no customizations to run.
532            #[allow(unused_mut)]
533            let mut output = <crate::operation::batch_create_partition::builders::BatchCreatePartitionOutputBuilder>::default();
534            output.deserialize_members(&mut *deser).map_err(|e| {
535                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
536            })?;
537            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
538            let output = output.build();
539            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
540        }
541    }
542}
543#[derive(Debug)]
544struct BatchCreatePartitionRequestSerializer;
545impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for BatchCreatePartitionRequestSerializer {
546    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
547    fn serialize_input(
548        &self,
549        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
550        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
551    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
552        let input = input
553            .downcast::<crate::operation::batch_create_partition::BatchCreatePartitionInput>()
554            .expect("correct type");
555
556        let protocol = _cfg
557            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
558            .expect("a SharedClientProtocol is required");
559        let mut request = protocol
560            .serialize_request(&input, BatchCreatePartition::INPUT_SCHEMA, "/", _cfg)
561            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
562
563        return ::std::result::Result::Ok(request);
564    }
565}
566#[derive(Debug)]
567struct BatchCreatePartitionEndpointParamsInterceptor;
568
569#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
570impl ::aws_smithy_runtime_api::client::interceptors::Intercept for BatchCreatePartitionEndpointParamsInterceptor {
571    fn name(&self) -> &'static str {
572        "BatchCreatePartitionEndpointParamsInterceptor"
573    }
574
575    fn read_before_execution(
576        &self,
577        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
578            '_,
579            ::aws_smithy_runtime_api::client::interceptors::context::Input,
580            ::aws_smithy_runtime_api::client::interceptors::context::Output,
581            ::aws_smithy_runtime_api::client::interceptors::context::Error,
582        >,
583        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
584    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
585        let _input = context
586            .input()
587            .downcast_ref::<BatchCreatePartitionInput>()
588            .ok_or("failed to downcast to BatchCreatePartitionInput")?;
589
590        let params = crate::config::endpoint::Params::builder()
591            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
592            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
593            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
594            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
595            .build()
596            .map_err(|err| {
597                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
598            })?;
599        cfg.interceptor_state()
600            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
601        ::std::result::Result::Ok(())
602    }
603}
604
605// The get_* functions below are generated from JMESPath expressions in the
606// operationContextParams trait. They target the operation's input shape.
607
608/// Error type for the `BatchCreatePartitionError` operation.
609#[non_exhaustive]
610#[derive(::std::fmt::Debug)]
611pub enum BatchCreatePartitionError {
612    /// <p>A resource to be created or added already exists.</p>
613    AlreadyExistsException(crate::types::error::AlreadyExistsException),
614    /// <p>Two processes are trying to modify a resource simultaneously.</p>
615    ConcurrentModificationException(crate::types::error::ConcurrentModificationException),
616    /// <p>A specified entity does not exist</p>
617    EntityNotFoundException(crate::types::error::EntityNotFoundException),
618    /// <p>An encryption operation failed.</p>
619    GlueEncryptionException(crate::types::error::GlueEncryptionException),
620    /// <p>An internal service error occurred.</p>
621    InternalServiceException(crate::types::error::InternalServiceException),
622    /// <p>The input provided was not valid.</p>
623    InvalidInputException(crate::types::error::InvalidInputException),
624    /// <p>The operation timed out.</p>
625    OperationTimeoutException(crate::types::error::OperationTimeoutException),
626    /// <p>A resource numerical limit was exceeded.</p>
627    ResourceNumberLimitExceededException(crate::types::error::ResourceNumberLimitExceededException),
628    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
629    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
630    variable wildcard pattern and check `.code()`:
631     \
632    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
633     \
634    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-BatchCreatePartitionError) for what information is available for the error.")]
635    Unhandled(crate::error::sealed_unhandled::Unhandled),
636}
637impl BatchCreatePartitionError {
638    /// Creates the `BatchCreatePartitionError::Unhandled` variant from any error type.
639    pub fn unhandled(
640        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
641    ) -> Self {
642        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
643            source: err.into(),
644            meta: ::std::default::Default::default(),
645        })
646    }
647
648    /// Creates the `BatchCreatePartitionError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
649    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
650        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
651            source: err.clone().into(),
652            meta: err,
653        })
654    }
655    ///
656    /// Returns error metadata, which includes the error code, message,
657    /// request ID, and potentially additional information.
658    ///
659    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
660        match self {
661            Self::AlreadyExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
662            Self::ConcurrentModificationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
663            Self::EntityNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
664            Self::GlueEncryptionException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
665            Self::InternalServiceException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
666            Self::InvalidInputException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
667            Self::OperationTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
668            Self::ResourceNumberLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
669            Self::Unhandled(e) => &e.meta,
670        }
671    }
672    /// Returns `true` if the error kind is `BatchCreatePartitionError::AlreadyExistsException`.
673    pub fn is_already_exists_exception(&self) -> bool {
674        matches!(self, Self::AlreadyExistsException(_))
675    }
676    /// Returns `true` if the error kind is `BatchCreatePartitionError::ConcurrentModificationException`.
677    pub fn is_concurrent_modification_exception(&self) -> bool {
678        matches!(self, Self::ConcurrentModificationException(_))
679    }
680    /// Returns `true` if the error kind is `BatchCreatePartitionError::EntityNotFoundException`.
681    pub fn is_entity_not_found_exception(&self) -> bool {
682        matches!(self, Self::EntityNotFoundException(_))
683    }
684    /// Returns `true` if the error kind is `BatchCreatePartitionError::GlueEncryptionException`.
685    pub fn is_glue_encryption_exception(&self) -> bool {
686        matches!(self, Self::GlueEncryptionException(_))
687    }
688    /// Returns `true` if the error kind is `BatchCreatePartitionError::InternalServiceException`.
689    pub fn is_internal_service_exception(&self) -> bool {
690        matches!(self, Self::InternalServiceException(_))
691    }
692    /// Returns `true` if the error kind is `BatchCreatePartitionError::InvalidInputException`.
693    pub fn is_invalid_input_exception(&self) -> bool {
694        matches!(self, Self::InvalidInputException(_))
695    }
696    /// Returns `true` if the error kind is `BatchCreatePartitionError::OperationTimeoutException`.
697    pub fn is_operation_timeout_exception(&self) -> bool {
698        matches!(self, Self::OperationTimeoutException(_))
699    }
700    /// Returns `true` if the error kind is `BatchCreatePartitionError::ResourceNumberLimitExceededException`.
701    pub fn is_resource_number_limit_exceeded_exception(&self) -> bool {
702        matches!(self, Self::ResourceNumberLimitExceededException(_))
703    }
704}
705impl ::std::error::Error for BatchCreatePartitionError {
706    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
707        match self {
708            Self::AlreadyExistsException(_inner) => ::std::option::Option::Some(_inner),
709            Self::ConcurrentModificationException(_inner) => ::std::option::Option::Some(_inner),
710            Self::EntityNotFoundException(_inner) => ::std::option::Option::Some(_inner),
711            Self::GlueEncryptionException(_inner) => ::std::option::Option::Some(_inner),
712            Self::InternalServiceException(_inner) => ::std::option::Option::Some(_inner),
713            Self::InvalidInputException(_inner) => ::std::option::Option::Some(_inner),
714            Self::OperationTimeoutException(_inner) => ::std::option::Option::Some(_inner),
715            Self::ResourceNumberLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
716            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
717        }
718    }
719}
720impl ::std::fmt::Display for BatchCreatePartitionError {
721    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
722        match self {
723            Self::AlreadyExistsException(_inner) => _inner.fmt(f),
724            Self::ConcurrentModificationException(_inner) => _inner.fmt(f),
725            Self::EntityNotFoundException(_inner) => _inner.fmt(f),
726            Self::GlueEncryptionException(_inner) => _inner.fmt(f),
727            Self::InternalServiceException(_inner) => _inner.fmt(f),
728            Self::InvalidInputException(_inner) => _inner.fmt(f),
729            Self::OperationTimeoutException(_inner) => _inner.fmt(f),
730            Self::ResourceNumberLimitExceededException(_inner) => _inner.fmt(f),
731            Self::Unhandled(_inner) => {
732                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
733                    write!(f, "unhandled error ({code})")
734                } else {
735                    f.write_str("unhandled error")
736                }
737            }
738        }
739    }
740}
741impl ::aws_smithy_types::retry::ProvideErrorKind for BatchCreatePartitionError {
742    fn code(&self) -> ::std::option::Option<&str> {
743        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
744    }
745    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
746        ::std::option::Option::None
747    }
748}
749impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for BatchCreatePartitionError {
750    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
751        match self {
752            Self::AlreadyExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
753            Self::ConcurrentModificationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
754            Self::EntityNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
755            Self::GlueEncryptionException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
756            Self::InternalServiceException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
757            Self::InvalidInputException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
758            Self::OperationTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
759            Self::ResourceNumberLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
760            Self::Unhandled(_inner) => &_inner.meta,
761        }
762    }
763}
764impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for BatchCreatePartitionError {
765    fn create_unhandled_error(
766        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
767        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
768    ) -> Self {
769        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
770            source,
771            meta: meta.unwrap_or_default(),
772        })
773    }
774}
775impl ::aws_types::request_id::RequestId for crate::operation::batch_create_partition::BatchCreatePartitionError {
776    fn request_id(&self) -> Option<&str> {
777        self.meta().request_id()
778    }
779}
780
781pub use crate::operation::batch_create_partition::_batch_create_partition_input::BatchCreatePartitionInput;
782
783pub use crate::operation::batch_create_partition::_batch_create_partition_output::BatchCreatePartitionOutput;
784
785mod _batch_create_partition_input;
786
787mod _batch_create_partition_output;
788
789/// Builders
790pub mod builders;