Skip to main content

aws_sdk_memorydb/operation/
create_cluster.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `CreateCluster`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateCluster;
6impl CreateCluster {
7    /// Creates a new `CreateCluster`
8    pub fn new() -> Self {
9        Self
10    }
11    pub(crate) async fn orchestrate(
12        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13        input: crate::operation::create_cluster::CreateClusterInput,
14    ) -> ::std::result::Result<
15        crate::operation::create_cluster::CreateClusterOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::create_cluster::CreateClusterError,
18            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19        >,
20    > {
21        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22            ::aws_smithy_runtime_api::client::interceptors::context::Error,
23            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24        >| {
25            err.map_service_error(|err| {
26                err.downcast::<crate::operation::create_cluster::CreateClusterError>()
27                    .expect("correct error type")
28            })
29        };
30        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31            .await
32            .map_err(map_err)?;
33        let output = context.finalize().map_err(map_err)?;
34        ::std::result::Result::Ok(
35            output
36                .downcast::<crate::operation::create_cluster::CreateClusterOutput>()
37                .expect("correct output type"),
38        )
39    }
40
41    pub(crate) async fn orchestrate_with_stop_point(
42        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43        input: crate::operation::create_cluster::CreateClusterInput,
44        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45    ) -> ::std::result::Result<
46        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47        ::aws_smithy_runtime_api::client::result::SdkError<
48            ::aws_smithy_runtime_api::client::interceptors::context::Error,
49            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50        >,
51    > {
52        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53        use ::tracing::Instrument;
54        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("MemoryDB", "CreateCluster", input, runtime_plugins, stop_point)
55            // Create a parent span for the entire operation. Includes a random, internal-only,
56            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
57            .instrument(::tracing::debug_span!(
58                "MemoryDB.CreateCluster",
59                "rpc.service" = "MemoryDB",
60                "rpc.method" = "CreateCluster",
61                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62                "rpc.system" = "aws-api",
63            ))
64            .await
65    }
66
67    pub(crate) fn operation_runtime_plugins(
68        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69        client_config: &crate::config::Config,
70        config_override: ::std::option::Option<crate::config::Builder>,
71    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73
74        if let ::std::option::Option::Some(config_override) = config_override {
75            for plugin in config_override.runtime_plugins.iter().cloned() {
76                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
77            }
78            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
79                config_override,
80                client_config.config.clone(),
81                &client_config.runtime_components,
82            ));
83        }
84        runtime_plugins
85    }
86}
87impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateCluster {
88    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateCluster");
90
91        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92            CreateClusterRequestSerializer,
93        ));
94        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95            CreateClusterResponseDeserializer,
96        ));
97
98        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99            crate::config::auth::Params::builder()
100                .operation_name("CreateCluster")
101                .build()
102                .expect("required fields set"),
103        ));
104
105        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("CreateCluster", "MemoryDB"));
106        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
107        signing_options.double_uri_encode = true;
108        signing_options.content_sha256_header = false;
109        signing_options.normalize_uri_path = true;
110        signing_options.payload_override = None;
111
112        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
113            signing_options,
114            ..::std::default::Default::default()
115        });
116
117        ::std::option::Option::Some(cfg.freeze())
118    }
119
120    fn runtime_components(
121        &self,
122        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
123    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
124        #[allow(unused_mut)]
125        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateCluster")
126            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
127                CreateClusterTelemetryInputCaptureInterceptor,
128            ))
129            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
130                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
131            ))
132            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
133                CreateClusterEndpointParamsInterceptor,
134            ))
135            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
136                crate::operation::create_cluster::CreateClusterError,
137            >::new())
138            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
139                crate::operation::create_cluster::CreateClusterError,
140            >::new())
141            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
142                crate::operation::create_cluster::CreateClusterError,
143            >::new())
144            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
145                crate::operation::create_cluster::CreateClusterError,
146            >::new());
147
148        ::std::borrow::Cow::Owned(rcb)
149    }
150}
151
152#[derive(Debug)]
153struct CreateClusterTelemetryInputCaptureInterceptor;
154
155#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
156impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateClusterTelemetryInputCaptureInterceptor {
157    fn name(&self) -> &'static str {
158        "CreateClusterTelemetryInputCaptureInterceptor"
159    }
160
161    fn read_before_execution(
162        &self,
163        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
164            '_,
165            ::aws_smithy_runtime_api::client::interceptors::context::Input,
166            ::aws_smithy_runtime_api::client::interceptors::context::Output,
167            ::aws_smithy_runtime_api::client::interceptors::context::Error,
168        >,
169        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
170    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
171        // Nothing to do unless the customer opted in by naming members to record.
172        let ::std::option::Option::Some(requested) = cfg
173            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
174            .filter(|r| !r.is_empty())
175        else {
176            return ::std::result::Result::Ok(());
177        };
178
179        let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateClusterInput>() else {
180            // A mismatched input is not this interceptor's concern; skip quietly.
181            return ::std::result::Result::Ok(());
182        };
183
184        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
185        if requested.should_capture("ClusterName") {
186            if let ::std::option::Option::Some(value) = input.cluster_name.as_deref() {
187                captured.insert("ClusterName", value);
188            }
189        }
190        if requested.should_capture("NodeType") {
191            if let ::std::option::Option::Some(value) = input.node_type.as_deref() {
192                captured.insert("NodeType", value);
193            }
194        }
195        if requested.should_capture("MultiRegionClusterName") {
196            if let ::std::option::Option::Some(value) = input.multi_region_cluster_name.as_deref() {
197                captured.insert("MultiRegionClusterName", value);
198            }
199        }
200        if requested.should_capture("ParameterGroupName") {
201            if let ::std::option::Option::Some(value) = input.parameter_group_name.as_deref() {
202                captured.insert("ParameterGroupName", value);
203            }
204        }
205        if requested.should_capture("Description") {
206            if let ::std::option::Option::Some(value) = input.description.as_deref() {
207                captured.insert("Description", value);
208            }
209        }
210        if requested.should_capture("SubnetGroupName") {
211            if let ::std::option::Option::Some(value) = input.subnet_group_name.as_deref() {
212                captured.insert("SubnetGroupName", value);
213            }
214        }
215        if requested.should_capture("MaintenanceWindow") {
216            if let ::std::option::Option::Some(value) = input.maintenance_window.as_deref() {
217                captured.insert("MaintenanceWindow", value);
218            }
219        }
220        if requested.should_capture("SnsTopicArn") {
221            if let ::std::option::Option::Some(value) = input.sns_topic_arn.as_deref() {
222                captured.insert("SnsTopicArn", value);
223            }
224        }
225        if requested.should_capture("KmsKeyId") {
226            if let ::std::option::Option::Some(value) = input.kms_key_id.as_deref() {
227                captured.insert("KmsKeyId", value);
228            }
229        }
230        if requested.should_capture("SnapshotName") {
231            if let ::std::option::Option::Some(value) = input.snapshot_name.as_deref() {
232                captured.insert("SnapshotName", value);
233            }
234        }
235        if requested.should_capture("SnapshotWindow") {
236            if let ::std::option::Option::Some(value) = input.snapshot_window.as_deref() {
237                captured.insert("SnapshotWindow", value);
238            }
239        }
240        if requested.should_capture("ACLName") {
241            if let ::std::option::Option::Some(value) = input.acl_name.as_deref() {
242                captured.insert("ACLName", value);
243            }
244        }
245        if requested.should_capture("Engine") {
246            if let ::std::option::Option::Some(value) = input.engine.as_deref() {
247                captured.insert("Engine", value);
248            }
249        }
250        if requested.should_capture("EngineVersion") {
251            if let ::std::option::Option::Some(value) = input.engine_version.as_deref() {
252                captured.insert("EngineVersion", value);
253            }
254        }
255
256        cfg.interceptor_state().store_put(captured);
257        ::std::result::Result::Ok(())
258    }
259}
260#[derive(Debug)]
261struct CreateClusterResponseDeserializer;
262impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateClusterResponseDeserializer {
263    fn deserialize_nonstreaming_with_config(
264        &self,
265        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
266        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
267    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
268        let (success, status) = (response.status().is_success(), response.status().as_u16());
269        let headers = response.headers();
270        let body = response.body().bytes().expect("body loaded");
271        #[allow(unused_mut)]
272        let mut force_error = false;
273        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
274        let parse_result = if !success && status != 200 || force_error {
275            crate::protocol_serde::shape_create_cluster::de_create_cluster_http_error(status, headers, body)
276        } else {
277            crate::protocol_serde::shape_create_cluster::de_create_cluster_http_response(status, headers, body)
278        };
279        crate::protocol_serde::type_erase_result(parse_result)
280    }
281}
282#[derive(Debug)]
283struct CreateClusterRequestSerializer;
284impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateClusterRequestSerializer {
285    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
286    fn serialize_input(
287        &self,
288        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
289        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
290    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
291        let input = input
292            .downcast::<crate::operation::create_cluster::CreateClusterInput>()
293            .expect("correct type");
294        let _header_serialization_settings = _cfg
295            .load::<crate::serialization_settings::HeaderSerializationSettings>()
296            .cloned()
297            .unwrap_or_default();
298        let mut request_builder = {
299            #[allow(clippy::uninlined_format_args)]
300            fn uri_base(
301                _input: &crate::operation::create_cluster::CreateClusterInput,
302                output: &mut ::std::string::String,
303            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
304                use ::std::fmt::Write as _;
305                ::std::write!(output, "/").expect("formatting should succeed");
306                ::std::result::Result::Ok(())
307            }
308            #[allow(clippy::unnecessary_wraps)]
309            fn update_http_builder(
310                input: &crate::operation::create_cluster::CreateClusterInput,
311                builder: ::http_1x::request::Builder,
312            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
313                let mut uri = ::std::string::String::new();
314                uri_base(input, &mut uri)?;
315                ::std::result::Result::Ok(builder.method("POST").uri(uri))
316            }
317            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
318            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
319            builder = _header_serialization_settings.set_default_header(
320                builder,
321                ::http_1x::header::HeaderName::from_static("x-amz-target"),
322                "AmazonMemoryDB.CreateCluster",
323            );
324            builder
325        };
326        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_cluster::ser_create_cluster_input(&input)?);
327        if let Some(content_length) = body.content_length() {
328            let content_length = content_length.to_string();
329            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
330        }
331        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
332    }
333}
334#[derive(Debug)]
335struct CreateClusterEndpointParamsInterceptor;
336
337#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
338impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateClusterEndpointParamsInterceptor {
339    fn name(&self) -> &'static str {
340        "CreateClusterEndpointParamsInterceptor"
341    }
342
343    fn read_before_execution(
344        &self,
345        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
346            '_,
347            ::aws_smithy_runtime_api::client::interceptors::context::Input,
348            ::aws_smithy_runtime_api::client::interceptors::context::Output,
349            ::aws_smithy_runtime_api::client::interceptors::context::Error,
350        >,
351        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
352    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
353        let _input = context
354            .input()
355            .downcast_ref::<CreateClusterInput>()
356            .ok_or("failed to downcast to CreateClusterInput")?;
357
358        let params = crate::config::endpoint::Params::builder()
359            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
360            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
361            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
362            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
363            .build()
364            .map_err(|err| {
365                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
366            })?;
367        cfg.interceptor_state()
368            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
369        ::std::result::Result::Ok(())
370    }
371}
372
373// The get_* functions below are generated from JMESPath expressions in the
374// operationContextParams trait. They target the operation's input shape.
375
376/// Error type for the `CreateClusterError` operation.
377#[non_exhaustive]
378#[derive(::std::fmt::Debug)]
379pub enum CreateClusterError {
380    /// <p>The specified ACL does not exist.</p>
381    AclNotFoundFault(crate::types::error::AclNotFoundFault),
382    /// <p>A cluster with the specified name already exists.</p>
383    ClusterAlreadyExistsFault(crate::types::error::ClusterAlreadyExistsFault),
384    /// <p>The request cannot be processed because it would exceed the maximum number of clusters allowed for this customer.</p>
385    ClusterQuotaForCustomerExceededFault(crate::types::error::ClusterQuotaForCustomerExceededFault),
386    /// <p>The cluster does not have sufficient capacity to perform the requested operation.</p>
387    InsufficientClusterCapacityFault(crate::types::error::InsufficientClusterCapacityFault),
388    /// <p>The ACL is not in a valid state for the requested operation.</p>
389    InvalidAclStateFault(crate::types::error::InvalidAclStateFault),
390    /// <p>The provided credentials are not valid.</p>
391    InvalidCredentialsException(crate::types::error::InvalidCredentialsException),
392    /// <p>The requested operation cannot be performed on the multi-Region cluster in its current state.</p>
393    InvalidMultiRegionClusterStateFault(crate::types::error::InvalidMultiRegionClusterStateFault),
394    /// <p>The specified parameter combination is not valid.</p>
395    InvalidParameterCombinationException(crate::types::error::InvalidParameterCombinationException),
396    /// <p>The specified parameter value is not valid.</p>
397    InvalidParameterValueException(crate::types::error::InvalidParameterValueException),
398    /// <p>The VPC network is not in a valid state for the requested operation.</p>
399    InvalidVpcNetworkStateFault(crate::types::error::InvalidVpcNetworkStateFault),
400    /// <p>The specified multi-Region cluster does not exist.</p>
401    MultiRegionClusterNotFoundFault(crate::types::error::MultiRegionClusterNotFoundFault),
402    /// <p>The request cannot be processed because it would exceed the maximum number of nodes allowed for this cluster.</p>
403    NodeQuotaForClusterExceededFault(crate::types::error::NodeQuotaForClusterExceededFault),
404    /// <p>The request cannot be processed because it would exceed the maximum number of nodes allowed for this customer.</p>
405    NodeQuotaForCustomerExceededFault(crate::types::error::NodeQuotaForCustomerExceededFault),
406    /// <p>The specified parameter group does not exist.</p>
407    ParameterGroupNotFoundFault(crate::types::error::ParameterGroupNotFoundFault),
408    /// <p>The required service-linked role was not found.</p>
409    ServiceLinkedRoleNotFoundFault(crate::types::error::ServiceLinkedRoleNotFoundFault),
410    /// <p>The request cannot be processed because it would exceed the maximum number of shards allowed per cluster.</p>
411    ShardsPerClusterQuotaExceededFault(crate::types::error::ShardsPerClusterQuotaExceededFault),
412    /// <p>The specified subnet group does not exist.</p>
413    SubnetGroupNotFoundFault(crate::types::error::SubnetGroupNotFoundFault),
414    /// <p>The request cannot be processed because it would exceed the maximum number of tags allowed per resource.</p>
415    TagQuotaPerResourceExceeded(crate::types::error::TagQuotaPerResourceExceeded),
416    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
417    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
418    variable wildcard pattern and check `.code()`:
419     \
420    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
421     \
422    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateClusterError) for what information is available for the error.")]
423    Unhandled(crate::error::sealed_unhandled::Unhandled),
424}
425impl CreateClusterError {
426    /// Creates the `CreateClusterError::Unhandled` variant from any error type.
427    pub fn unhandled(
428        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
429    ) -> Self {
430        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
431            source: err.into(),
432            meta: ::std::default::Default::default(),
433        })
434    }
435
436    /// Creates the `CreateClusterError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
437    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
438        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
439            source: err.clone().into(),
440            meta: err,
441        })
442    }
443    ///
444    /// Returns error metadata, which includes the error code, message,
445    /// request ID, and potentially additional information.
446    ///
447    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
448        match self {
449            Self::AclNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
450            Self::ClusterAlreadyExistsFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
451            Self::ClusterQuotaForCustomerExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
452            Self::InsufficientClusterCapacityFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
453            Self::InvalidAclStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
454            Self::InvalidCredentialsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
455            Self::InvalidMultiRegionClusterStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
456            Self::InvalidParameterCombinationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
457            Self::InvalidParameterValueException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
458            Self::InvalidVpcNetworkStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
459            Self::MultiRegionClusterNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
460            Self::NodeQuotaForClusterExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
461            Self::NodeQuotaForCustomerExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
462            Self::ParameterGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
463            Self::ServiceLinkedRoleNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
464            Self::ShardsPerClusterQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
465            Self::SubnetGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
466            Self::TagQuotaPerResourceExceeded(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
467            Self::Unhandled(e) => &e.meta,
468        }
469    }
470    /// Returns `true` if the error kind is `CreateClusterError::AclNotFoundFault`.
471    pub fn is_acl_not_found_fault(&self) -> bool {
472        matches!(self, Self::AclNotFoundFault(_))
473    }
474    /// Returns `true` if the error kind is `CreateClusterError::ClusterAlreadyExistsFault`.
475    pub fn is_cluster_already_exists_fault(&self) -> bool {
476        matches!(self, Self::ClusterAlreadyExistsFault(_))
477    }
478    /// Returns `true` if the error kind is `CreateClusterError::ClusterQuotaForCustomerExceededFault`.
479    pub fn is_cluster_quota_for_customer_exceeded_fault(&self) -> bool {
480        matches!(self, Self::ClusterQuotaForCustomerExceededFault(_))
481    }
482    /// Returns `true` if the error kind is `CreateClusterError::InsufficientClusterCapacityFault`.
483    pub fn is_insufficient_cluster_capacity_fault(&self) -> bool {
484        matches!(self, Self::InsufficientClusterCapacityFault(_))
485    }
486    /// Returns `true` if the error kind is `CreateClusterError::InvalidAclStateFault`.
487    pub fn is_invalid_acl_state_fault(&self) -> bool {
488        matches!(self, Self::InvalidAclStateFault(_))
489    }
490    /// Returns `true` if the error kind is `CreateClusterError::InvalidCredentialsException`.
491    pub fn is_invalid_credentials_exception(&self) -> bool {
492        matches!(self, Self::InvalidCredentialsException(_))
493    }
494    /// Returns `true` if the error kind is `CreateClusterError::InvalidMultiRegionClusterStateFault`.
495    pub fn is_invalid_multi_region_cluster_state_fault(&self) -> bool {
496        matches!(self, Self::InvalidMultiRegionClusterStateFault(_))
497    }
498    /// Returns `true` if the error kind is `CreateClusterError::InvalidParameterCombinationException`.
499    pub fn is_invalid_parameter_combination_exception(&self) -> bool {
500        matches!(self, Self::InvalidParameterCombinationException(_))
501    }
502    /// Returns `true` if the error kind is `CreateClusterError::InvalidParameterValueException`.
503    pub fn is_invalid_parameter_value_exception(&self) -> bool {
504        matches!(self, Self::InvalidParameterValueException(_))
505    }
506    /// Returns `true` if the error kind is `CreateClusterError::InvalidVpcNetworkStateFault`.
507    pub fn is_invalid_vpc_network_state_fault(&self) -> bool {
508        matches!(self, Self::InvalidVpcNetworkStateFault(_))
509    }
510    /// Returns `true` if the error kind is `CreateClusterError::MultiRegionClusterNotFoundFault`.
511    pub fn is_multi_region_cluster_not_found_fault(&self) -> bool {
512        matches!(self, Self::MultiRegionClusterNotFoundFault(_))
513    }
514    /// Returns `true` if the error kind is `CreateClusterError::NodeQuotaForClusterExceededFault`.
515    pub fn is_node_quota_for_cluster_exceeded_fault(&self) -> bool {
516        matches!(self, Self::NodeQuotaForClusterExceededFault(_))
517    }
518    /// Returns `true` if the error kind is `CreateClusterError::NodeQuotaForCustomerExceededFault`.
519    pub fn is_node_quota_for_customer_exceeded_fault(&self) -> bool {
520        matches!(self, Self::NodeQuotaForCustomerExceededFault(_))
521    }
522    /// Returns `true` if the error kind is `CreateClusterError::ParameterGroupNotFoundFault`.
523    pub fn is_parameter_group_not_found_fault(&self) -> bool {
524        matches!(self, Self::ParameterGroupNotFoundFault(_))
525    }
526    /// Returns `true` if the error kind is `CreateClusterError::ServiceLinkedRoleNotFoundFault`.
527    pub fn is_service_linked_role_not_found_fault(&self) -> bool {
528        matches!(self, Self::ServiceLinkedRoleNotFoundFault(_))
529    }
530    /// Returns `true` if the error kind is `CreateClusterError::ShardsPerClusterQuotaExceededFault`.
531    pub fn is_shards_per_cluster_quota_exceeded_fault(&self) -> bool {
532        matches!(self, Self::ShardsPerClusterQuotaExceededFault(_))
533    }
534    /// Returns `true` if the error kind is `CreateClusterError::SubnetGroupNotFoundFault`.
535    pub fn is_subnet_group_not_found_fault(&self) -> bool {
536        matches!(self, Self::SubnetGroupNotFoundFault(_))
537    }
538    /// Returns `true` if the error kind is `CreateClusterError::TagQuotaPerResourceExceeded`.
539    pub fn is_tag_quota_per_resource_exceeded(&self) -> bool {
540        matches!(self, Self::TagQuotaPerResourceExceeded(_))
541    }
542}
543impl ::std::error::Error for CreateClusterError {
544    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
545        match self {
546            Self::AclNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
547            Self::ClusterAlreadyExistsFault(_inner) => ::std::option::Option::Some(_inner),
548            Self::ClusterQuotaForCustomerExceededFault(_inner) => ::std::option::Option::Some(_inner),
549            Self::InsufficientClusterCapacityFault(_inner) => ::std::option::Option::Some(_inner),
550            Self::InvalidAclStateFault(_inner) => ::std::option::Option::Some(_inner),
551            Self::InvalidCredentialsException(_inner) => ::std::option::Option::Some(_inner),
552            Self::InvalidMultiRegionClusterStateFault(_inner) => ::std::option::Option::Some(_inner),
553            Self::InvalidParameterCombinationException(_inner) => ::std::option::Option::Some(_inner),
554            Self::InvalidParameterValueException(_inner) => ::std::option::Option::Some(_inner),
555            Self::InvalidVpcNetworkStateFault(_inner) => ::std::option::Option::Some(_inner),
556            Self::MultiRegionClusterNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
557            Self::NodeQuotaForClusterExceededFault(_inner) => ::std::option::Option::Some(_inner),
558            Self::NodeQuotaForCustomerExceededFault(_inner) => ::std::option::Option::Some(_inner),
559            Self::ParameterGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
560            Self::ServiceLinkedRoleNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
561            Self::ShardsPerClusterQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
562            Self::SubnetGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
563            Self::TagQuotaPerResourceExceeded(_inner) => ::std::option::Option::Some(_inner),
564            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
565        }
566    }
567}
568impl ::std::fmt::Display for CreateClusterError {
569    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
570        match self {
571            Self::AclNotFoundFault(_inner) => _inner.fmt(f),
572            Self::ClusterAlreadyExistsFault(_inner) => _inner.fmt(f),
573            Self::ClusterQuotaForCustomerExceededFault(_inner) => _inner.fmt(f),
574            Self::InsufficientClusterCapacityFault(_inner) => _inner.fmt(f),
575            Self::InvalidAclStateFault(_inner) => _inner.fmt(f),
576            Self::InvalidCredentialsException(_inner) => _inner.fmt(f),
577            Self::InvalidMultiRegionClusterStateFault(_inner) => _inner.fmt(f),
578            Self::InvalidParameterCombinationException(_inner) => _inner.fmt(f),
579            Self::InvalidParameterValueException(_inner) => _inner.fmt(f),
580            Self::InvalidVpcNetworkStateFault(_inner) => _inner.fmt(f),
581            Self::MultiRegionClusterNotFoundFault(_inner) => _inner.fmt(f),
582            Self::NodeQuotaForClusterExceededFault(_inner) => _inner.fmt(f),
583            Self::NodeQuotaForCustomerExceededFault(_inner) => _inner.fmt(f),
584            Self::ParameterGroupNotFoundFault(_inner) => _inner.fmt(f),
585            Self::ServiceLinkedRoleNotFoundFault(_inner) => _inner.fmt(f),
586            Self::ShardsPerClusterQuotaExceededFault(_inner) => _inner.fmt(f),
587            Self::SubnetGroupNotFoundFault(_inner) => _inner.fmt(f),
588            Self::TagQuotaPerResourceExceeded(_inner) => _inner.fmt(f),
589            Self::Unhandled(_inner) => {
590                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
591                    write!(f, "unhandled error ({code})")
592                } else {
593                    f.write_str("unhandled error")
594                }
595            }
596        }
597    }
598}
599impl ::aws_smithy_types::retry::ProvideErrorKind for CreateClusterError {
600    fn code(&self) -> ::std::option::Option<&str> {
601        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
602    }
603    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
604        ::std::option::Option::None
605    }
606}
607impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateClusterError {
608    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
609        match self {
610            Self::AclNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
611            Self::ClusterAlreadyExistsFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
612            Self::ClusterQuotaForCustomerExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
613            Self::InsufficientClusterCapacityFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
614            Self::InvalidAclStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
615            Self::InvalidCredentialsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
616            Self::InvalidMultiRegionClusterStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
617            Self::InvalidParameterCombinationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
618            Self::InvalidParameterValueException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
619            Self::InvalidVpcNetworkStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
620            Self::MultiRegionClusterNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
621            Self::NodeQuotaForClusterExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
622            Self::NodeQuotaForCustomerExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
623            Self::ParameterGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
624            Self::ServiceLinkedRoleNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
625            Self::ShardsPerClusterQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
626            Self::SubnetGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
627            Self::TagQuotaPerResourceExceeded(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
628            Self::Unhandled(_inner) => &_inner.meta,
629        }
630    }
631}
632impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateClusterError {
633    fn create_unhandled_error(
634        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
635        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
636    ) -> Self {
637        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
638            source,
639            meta: meta.unwrap_or_default(),
640        })
641    }
642}
643impl ::aws_types::request_id::RequestId for crate::operation::create_cluster::CreateClusterError {
644    fn request_id(&self) -> Option<&str> {
645        self.meta().request_id()
646    }
647}
648
649pub use crate::operation::create_cluster::_create_cluster_input::CreateClusterInput;
650
651pub use crate::operation::create_cluster::_create_cluster_output::CreateClusterOutput;
652
653mod _create_cluster_input;
654
655mod _create_cluster_output;
656
657/// Builders
658pub mod builders;