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
145        ::std::borrow::Cow::Owned(rcb)
146    }
147}
148
149#[derive(Debug)]
150struct CreateClusterTelemetryInputCaptureInterceptor;
151
152#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
153impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateClusterTelemetryInputCaptureInterceptor {
154    fn name(&self) -> &'static str {
155        "CreateClusterTelemetryInputCaptureInterceptor"
156    }
157
158    fn read_before_execution(
159        &self,
160        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
161            '_,
162            ::aws_smithy_runtime_api::client::interceptors::context::Input,
163            ::aws_smithy_runtime_api::client::interceptors::context::Output,
164            ::aws_smithy_runtime_api::client::interceptors::context::Error,
165        >,
166        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
167    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
168        // Nothing to do unless the customer opted in by naming members to record.
169        let ::std::option::Option::Some(requested) = cfg
170            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
171            .filter(|r| !r.is_empty())
172        else {
173            return ::std::result::Result::Ok(());
174        };
175
176        let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateClusterInput>() else {
177            // A mismatched input is not this interceptor's concern; skip quietly.
178            return ::std::result::Result::Ok(());
179        };
180
181        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
182        if requested.should_capture("ClusterName") {
183            if let ::std::option::Option::Some(value) = input.cluster_name.as_deref() {
184                captured.insert("ClusterName", value);
185            }
186        }
187        if requested.should_capture("NodeType") {
188            if let ::std::option::Option::Some(value) = input.node_type.as_deref() {
189                captured.insert("NodeType", value);
190            }
191        }
192        if requested.should_capture("MultiRegionClusterName") {
193            if let ::std::option::Option::Some(value) = input.multi_region_cluster_name.as_deref() {
194                captured.insert("MultiRegionClusterName", value);
195            }
196        }
197        if requested.should_capture("ParameterGroupName") {
198            if let ::std::option::Option::Some(value) = input.parameter_group_name.as_deref() {
199                captured.insert("ParameterGroupName", value);
200            }
201        }
202        if requested.should_capture("Description") {
203            if let ::std::option::Option::Some(value) = input.description.as_deref() {
204                captured.insert("Description", value);
205            }
206        }
207        if requested.should_capture("SubnetGroupName") {
208            if let ::std::option::Option::Some(value) = input.subnet_group_name.as_deref() {
209                captured.insert("SubnetGroupName", value);
210            }
211        }
212        if requested.should_capture("MaintenanceWindow") {
213            if let ::std::option::Option::Some(value) = input.maintenance_window.as_deref() {
214                captured.insert("MaintenanceWindow", value);
215            }
216        }
217        if requested.should_capture("SnsTopicArn") {
218            if let ::std::option::Option::Some(value) = input.sns_topic_arn.as_deref() {
219                captured.insert("SnsTopicArn", value);
220            }
221        }
222        if requested.should_capture("KmsKeyId") {
223            if let ::std::option::Option::Some(value) = input.kms_key_id.as_deref() {
224                captured.insert("KmsKeyId", value);
225            }
226        }
227        if requested.should_capture("SnapshotName") {
228            if let ::std::option::Option::Some(value) = input.snapshot_name.as_deref() {
229                captured.insert("SnapshotName", value);
230            }
231        }
232        if requested.should_capture("SnapshotWindow") {
233            if let ::std::option::Option::Some(value) = input.snapshot_window.as_deref() {
234                captured.insert("SnapshotWindow", value);
235            }
236        }
237        if requested.should_capture("ACLName") {
238            if let ::std::option::Option::Some(value) = input.acl_name.as_deref() {
239                captured.insert("ACLName", value);
240            }
241        }
242        if requested.should_capture("Engine") {
243            if let ::std::option::Option::Some(value) = input.engine.as_deref() {
244                captured.insert("Engine", value);
245            }
246        }
247        if requested.should_capture("EngineVersion") {
248            if let ::std::option::Option::Some(value) = input.engine_version.as_deref() {
249                captured.insert("EngineVersion", value);
250            }
251        }
252
253        cfg.interceptor_state().store_put(captured);
254        ::std::result::Result::Ok(())
255    }
256}
257#[derive(Debug)]
258struct CreateClusterResponseDeserializer;
259impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateClusterResponseDeserializer {
260    fn deserialize_nonstreaming_with_config(
261        &self,
262        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
263        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
264    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
265        let (success, status) = (response.status().is_success(), response.status().as_u16());
266        let headers = response.headers();
267        let body = response.body().bytes().expect("body loaded");
268        #[allow(unused_mut)]
269        let mut force_error = false;
270        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
271        let parse_result = if !success && status != 200 || force_error {
272            crate::protocol_serde::shape_create_cluster::de_create_cluster_http_error(status, headers, body)
273        } else {
274            crate::protocol_serde::shape_create_cluster::de_create_cluster_http_response(status, headers, body)
275        };
276        crate::protocol_serde::type_erase_result(parse_result)
277    }
278}
279#[derive(Debug)]
280struct CreateClusterRequestSerializer;
281impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateClusterRequestSerializer {
282    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
283    fn serialize_input(
284        &self,
285        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
286        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
287    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
288        let input = input
289            .downcast::<crate::operation::create_cluster::CreateClusterInput>()
290            .expect("correct type");
291        let _header_serialization_settings = _cfg
292            .load::<crate::serialization_settings::HeaderSerializationSettings>()
293            .cloned()
294            .unwrap_or_default();
295        let mut request_builder = {
296            #[allow(clippy::uninlined_format_args)]
297            fn uri_base(
298                _input: &crate::operation::create_cluster::CreateClusterInput,
299                output: &mut ::std::string::String,
300            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
301                use ::std::fmt::Write as _;
302                ::std::write!(output, "/").expect("formatting should succeed");
303                ::std::result::Result::Ok(())
304            }
305            #[allow(clippy::unnecessary_wraps)]
306            fn update_http_builder(
307                input: &crate::operation::create_cluster::CreateClusterInput,
308                builder: ::http_1x::request::Builder,
309            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
310                let mut uri = ::std::string::String::new();
311                uri_base(input, &mut uri)?;
312                ::std::result::Result::Ok(builder.method("POST").uri(uri))
313            }
314            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
315            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
316            builder = _header_serialization_settings.set_default_header(
317                builder,
318                ::http_1x::header::HeaderName::from_static("x-amz-target"),
319                "AmazonMemoryDB.CreateCluster",
320            );
321            builder
322        };
323        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_cluster::ser_create_cluster_input(&input)?);
324        if let Some(content_length) = body.content_length() {
325            let content_length = content_length.to_string();
326            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
327        }
328        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
329    }
330}
331#[derive(Debug)]
332struct CreateClusterEndpointParamsInterceptor;
333
334#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
335impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateClusterEndpointParamsInterceptor {
336    fn name(&self) -> &'static str {
337        "CreateClusterEndpointParamsInterceptor"
338    }
339
340    fn read_before_execution(
341        &self,
342        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
343            '_,
344            ::aws_smithy_runtime_api::client::interceptors::context::Input,
345            ::aws_smithy_runtime_api::client::interceptors::context::Output,
346            ::aws_smithy_runtime_api::client::interceptors::context::Error,
347        >,
348        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
349    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
350        let _input = context
351            .input()
352            .downcast_ref::<CreateClusterInput>()
353            .ok_or("failed to downcast to CreateClusterInput")?;
354
355        let params = crate::config::endpoint::Params::builder()
356            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
357            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
358            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
359            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
360            .build()
361            .map_err(|err| {
362                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
363            })?;
364        cfg.interceptor_state()
365            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
366        ::std::result::Result::Ok(())
367    }
368}
369
370// The get_* functions below are generated from JMESPath expressions in the
371// operationContextParams trait. They target the operation's input shape.
372
373/// Error type for the `CreateClusterError` operation.
374#[non_exhaustive]
375#[derive(::std::fmt::Debug)]
376pub enum CreateClusterError {
377    /// <p>The specified ACL does not exist.</p>
378    AclNotFoundFault(crate::types::error::AclNotFoundFault),
379    /// <p>A cluster with the specified name already exists.</p>
380    ClusterAlreadyExistsFault(crate::types::error::ClusterAlreadyExistsFault),
381    /// <p>The request cannot be processed because it would exceed the maximum number of clusters allowed for this customer.</p>
382    ClusterQuotaForCustomerExceededFault(crate::types::error::ClusterQuotaForCustomerExceededFault),
383    /// <p>The cluster does not have sufficient capacity to perform the requested operation.</p>
384    InsufficientClusterCapacityFault(crate::types::error::InsufficientClusterCapacityFault),
385    /// <p>The ACL is not in a valid state for the requested operation.</p>
386    InvalidAclStateFault(crate::types::error::InvalidAclStateFault),
387    /// <p>The provided credentials are not valid.</p>
388    InvalidCredentialsException(crate::types::error::InvalidCredentialsException),
389    /// <p>The requested operation cannot be performed on the multi-Region cluster in its current state.</p>
390    InvalidMultiRegionClusterStateFault(crate::types::error::InvalidMultiRegionClusterStateFault),
391    /// <p>The specified parameter combination is not valid.</p>
392    InvalidParameterCombinationException(crate::types::error::InvalidParameterCombinationException),
393    /// <p>The specified parameter value is not valid.</p>
394    InvalidParameterValueException(crate::types::error::InvalidParameterValueException),
395    /// <p>The VPC network is not in a valid state for the requested operation.</p>
396    InvalidVpcNetworkStateFault(crate::types::error::InvalidVpcNetworkStateFault),
397    /// <p>The specified multi-Region cluster does not exist.</p>
398    MultiRegionClusterNotFoundFault(crate::types::error::MultiRegionClusterNotFoundFault),
399    /// <p>The request cannot be processed because it would exceed the maximum number of nodes allowed for this cluster.</p>
400    NodeQuotaForClusterExceededFault(crate::types::error::NodeQuotaForClusterExceededFault),
401    /// <p>The request cannot be processed because it would exceed the maximum number of nodes allowed for this customer.</p>
402    NodeQuotaForCustomerExceededFault(crate::types::error::NodeQuotaForCustomerExceededFault),
403    /// <p>The specified parameter group does not exist.</p>
404    ParameterGroupNotFoundFault(crate::types::error::ParameterGroupNotFoundFault),
405    /// <p>The required service-linked role was not found.</p>
406    ServiceLinkedRoleNotFoundFault(crate::types::error::ServiceLinkedRoleNotFoundFault),
407    /// <p>The request cannot be processed because it would exceed the maximum number of shards allowed per cluster.</p>
408    ShardsPerClusterQuotaExceededFault(crate::types::error::ShardsPerClusterQuotaExceededFault),
409    /// <p>The specified subnet group does not exist.</p>
410    SubnetGroupNotFoundFault(crate::types::error::SubnetGroupNotFoundFault),
411    /// <p>The request cannot be processed because it would exceed the maximum number of tags allowed per resource.</p>
412    TagQuotaPerResourceExceeded(crate::types::error::TagQuotaPerResourceExceeded),
413    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
414    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
415    variable wildcard pattern and check `.code()`:
416     \
417    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
418     \
419    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateClusterError) for what information is available for the error.")]
420    Unhandled(crate::error::sealed_unhandled::Unhandled),
421}
422impl CreateClusterError {
423    /// Creates the `CreateClusterError::Unhandled` variant from any error type.
424    pub fn unhandled(
425        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
426    ) -> Self {
427        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
428            source: err.into(),
429            meta: ::std::default::Default::default(),
430        })
431    }
432
433    /// Creates the `CreateClusterError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
434    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
435        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
436            source: err.clone().into(),
437            meta: err,
438        })
439    }
440    ///
441    /// Returns error metadata, which includes the error code, message,
442    /// request ID, and potentially additional information.
443    ///
444    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
445        match self {
446            Self::AclNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
447            Self::ClusterAlreadyExistsFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
448            Self::ClusterQuotaForCustomerExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
449            Self::InsufficientClusterCapacityFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
450            Self::InvalidAclStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
451            Self::InvalidCredentialsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
452            Self::InvalidMultiRegionClusterStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
453            Self::InvalidParameterCombinationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
454            Self::InvalidParameterValueException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
455            Self::InvalidVpcNetworkStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
456            Self::MultiRegionClusterNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
457            Self::NodeQuotaForClusterExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
458            Self::NodeQuotaForCustomerExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
459            Self::ParameterGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
460            Self::ServiceLinkedRoleNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
461            Self::ShardsPerClusterQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
462            Self::SubnetGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
463            Self::TagQuotaPerResourceExceeded(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
464            Self::Unhandled(e) => &e.meta,
465        }
466    }
467    /// Returns `true` if the error kind is `CreateClusterError::AclNotFoundFault`.
468    pub fn is_acl_not_found_fault(&self) -> bool {
469        matches!(self, Self::AclNotFoundFault(_))
470    }
471    /// Returns `true` if the error kind is `CreateClusterError::ClusterAlreadyExistsFault`.
472    pub fn is_cluster_already_exists_fault(&self) -> bool {
473        matches!(self, Self::ClusterAlreadyExistsFault(_))
474    }
475    /// Returns `true` if the error kind is `CreateClusterError::ClusterQuotaForCustomerExceededFault`.
476    pub fn is_cluster_quota_for_customer_exceeded_fault(&self) -> bool {
477        matches!(self, Self::ClusterQuotaForCustomerExceededFault(_))
478    }
479    /// Returns `true` if the error kind is `CreateClusterError::InsufficientClusterCapacityFault`.
480    pub fn is_insufficient_cluster_capacity_fault(&self) -> bool {
481        matches!(self, Self::InsufficientClusterCapacityFault(_))
482    }
483    /// Returns `true` if the error kind is `CreateClusterError::InvalidAclStateFault`.
484    pub fn is_invalid_acl_state_fault(&self) -> bool {
485        matches!(self, Self::InvalidAclStateFault(_))
486    }
487    /// Returns `true` if the error kind is `CreateClusterError::InvalidCredentialsException`.
488    pub fn is_invalid_credentials_exception(&self) -> bool {
489        matches!(self, Self::InvalidCredentialsException(_))
490    }
491    /// Returns `true` if the error kind is `CreateClusterError::InvalidMultiRegionClusterStateFault`.
492    pub fn is_invalid_multi_region_cluster_state_fault(&self) -> bool {
493        matches!(self, Self::InvalidMultiRegionClusterStateFault(_))
494    }
495    /// Returns `true` if the error kind is `CreateClusterError::InvalidParameterCombinationException`.
496    pub fn is_invalid_parameter_combination_exception(&self) -> bool {
497        matches!(self, Self::InvalidParameterCombinationException(_))
498    }
499    /// Returns `true` if the error kind is `CreateClusterError::InvalidParameterValueException`.
500    pub fn is_invalid_parameter_value_exception(&self) -> bool {
501        matches!(self, Self::InvalidParameterValueException(_))
502    }
503    /// Returns `true` if the error kind is `CreateClusterError::InvalidVpcNetworkStateFault`.
504    pub fn is_invalid_vpc_network_state_fault(&self) -> bool {
505        matches!(self, Self::InvalidVpcNetworkStateFault(_))
506    }
507    /// Returns `true` if the error kind is `CreateClusterError::MultiRegionClusterNotFoundFault`.
508    pub fn is_multi_region_cluster_not_found_fault(&self) -> bool {
509        matches!(self, Self::MultiRegionClusterNotFoundFault(_))
510    }
511    /// Returns `true` if the error kind is `CreateClusterError::NodeQuotaForClusterExceededFault`.
512    pub fn is_node_quota_for_cluster_exceeded_fault(&self) -> bool {
513        matches!(self, Self::NodeQuotaForClusterExceededFault(_))
514    }
515    /// Returns `true` if the error kind is `CreateClusterError::NodeQuotaForCustomerExceededFault`.
516    pub fn is_node_quota_for_customer_exceeded_fault(&self) -> bool {
517        matches!(self, Self::NodeQuotaForCustomerExceededFault(_))
518    }
519    /// Returns `true` if the error kind is `CreateClusterError::ParameterGroupNotFoundFault`.
520    pub fn is_parameter_group_not_found_fault(&self) -> bool {
521        matches!(self, Self::ParameterGroupNotFoundFault(_))
522    }
523    /// Returns `true` if the error kind is `CreateClusterError::ServiceLinkedRoleNotFoundFault`.
524    pub fn is_service_linked_role_not_found_fault(&self) -> bool {
525        matches!(self, Self::ServiceLinkedRoleNotFoundFault(_))
526    }
527    /// Returns `true` if the error kind is `CreateClusterError::ShardsPerClusterQuotaExceededFault`.
528    pub fn is_shards_per_cluster_quota_exceeded_fault(&self) -> bool {
529        matches!(self, Self::ShardsPerClusterQuotaExceededFault(_))
530    }
531    /// Returns `true` if the error kind is `CreateClusterError::SubnetGroupNotFoundFault`.
532    pub fn is_subnet_group_not_found_fault(&self) -> bool {
533        matches!(self, Self::SubnetGroupNotFoundFault(_))
534    }
535    /// Returns `true` if the error kind is `CreateClusterError::TagQuotaPerResourceExceeded`.
536    pub fn is_tag_quota_per_resource_exceeded(&self) -> bool {
537        matches!(self, Self::TagQuotaPerResourceExceeded(_))
538    }
539}
540impl ::std::error::Error for CreateClusterError {
541    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
542        match self {
543            Self::AclNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
544            Self::ClusterAlreadyExistsFault(_inner) => ::std::option::Option::Some(_inner),
545            Self::ClusterQuotaForCustomerExceededFault(_inner) => ::std::option::Option::Some(_inner),
546            Self::InsufficientClusterCapacityFault(_inner) => ::std::option::Option::Some(_inner),
547            Self::InvalidAclStateFault(_inner) => ::std::option::Option::Some(_inner),
548            Self::InvalidCredentialsException(_inner) => ::std::option::Option::Some(_inner),
549            Self::InvalidMultiRegionClusterStateFault(_inner) => ::std::option::Option::Some(_inner),
550            Self::InvalidParameterCombinationException(_inner) => ::std::option::Option::Some(_inner),
551            Self::InvalidParameterValueException(_inner) => ::std::option::Option::Some(_inner),
552            Self::InvalidVpcNetworkStateFault(_inner) => ::std::option::Option::Some(_inner),
553            Self::MultiRegionClusterNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
554            Self::NodeQuotaForClusterExceededFault(_inner) => ::std::option::Option::Some(_inner),
555            Self::NodeQuotaForCustomerExceededFault(_inner) => ::std::option::Option::Some(_inner),
556            Self::ParameterGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
557            Self::ServiceLinkedRoleNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
558            Self::ShardsPerClusterQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
559            Self::SubnetGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
560            Self::TagQuotaPerResourceExceeded(_inner) => ::std::option::Option::Some(_inner),
561            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
562        }
563    }
564}
565impl ::std::fmt::Display for CreateClusterError {
566    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
567        match self {
568            Self::AclNotFoundFault(_inner) => _inner.fmt(f),
569            Self::ClusterAlreadyExistsFault(_inner) => _inner.fmt(f),
570            Self::ClusterQuotaForCustomerExceededFault(_inner) => _inner.fmt(f),
571            Self::InsufficientClusterCapacityFault(_inner) => _inner.fmt(f),
572            Self::InvalidAclStateFault(_inner) => _inner.fmt(f),
573            Self::InvalidCredentialsException(_inner) => _inner.fmt(f),
574            Self::InvalidMultiRegionClusterStateFault(_inner) => _inner.fmt(f),
575            Self::InvalidParameterCombinationException(_inner) => _inner.fmt(f),
576            Self::InvalidParameterValueException(_inner) => _inner.fmt(f),
577            Self::InvalidVpcNetworkStateFault(_inner) => _inner.fmt(f),
578            Self::MultiRegionClusterNotFoundFault(_inner) => _inner.fmt(f),
579            Self::NodeQuotaForClusterExceededFault(_inner) => _inner.fmt(f),
580            Self::NodeQuotaForCustomerExceededFault(_inner) => _inner.fmt(f),
581            Self::ParameterGroupNotFoundFault(_inner) => _inner.fmt(f),
582            Self::ServiceLinkedRoleNotFoundFault(_inner) => _inner.fmt(f),
583            Self::ShardsPerClusterQuotaExceededFault(_inner) => _inner.fmt(f),
584            Self::SubnetGroupNotFoundFault(_inner) => _inner.fmt(f),
585            Self::TagQuotaPerResourceExceeded(_inner) => _inner.fmt(f),
586            Self::Unhandled(_inner) => {
587                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
588                    write!(f, "unhandled error ({code})")
589                } else {
590                    f.write_str("unhandled error")
591                }
592            }
593        }
594    }
595}
596impl ::aws_smithy_types::retry::ProvideErrorKind for CreateClusterError {
597    fn code(&self) -> ::std::option::Option<&str> {
598        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
599    }
600    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
601        ::std::option::Option::None
602    }
603}
604impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateClusterError {
605    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
606        match self {
607            Self::AclNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
608            Self::ClusterAlreadyExistsFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
609            Self::ClusterQuotaForCustomerExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
610            Self::InsufficientClusterCapacityFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
611            Self::InvalidAclStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
612            Self::InvalidCredentialsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
613            Self::InvalidMultiRegionClusterStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
614            Self::InvalidParameterCombinationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
615            Self::InvalidParameterValueException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
616            Self::InvalidVpcNetworkStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
617            Self::MultiRegionClusterNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
618            Self::NodeQuotaForClusterExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
619            Self::NodeQuotaForCustomerExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
620            Self::ParameterGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
621            Self::ServiceLinkedRoleNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
622            Self::ShardsPerClusterQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
623            Self::SubnetGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
624            Self::TagQuotaPerResourceExceeded(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
625            Self::Unhandled(_inner) => &_inner.meta,
626        }
627    }
628}
629impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateClusterError {
630    fn create_unhandled_error(
631        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
632        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
633    ) -> Self {
634        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
635            source,
636            meta: meta.unwrap_or_default(),
637        })
638    }
639}
640impl ::aws_types::request_id::RequestId for crate::operation::create_cluster::CreateClusterError {
641    fn request_id(&self) -> Option<&str> {
642        self.meta().request_id()
643    }
644}
645
646pub use crate::operation::create_cluster::_create_cluster_input::CreateClusterInput;
647
648pub use crate::operation::create_cluster::_create_cluster_output::CreateClusterOutput;
649
650mod _create_cluster_input;
651
652mod _create_cluster_output;
653
654/// Builders
655pub mod builders;