Skip to main content

aws_sdk_rds/operation/
restore_db_cluster_from_snapshot.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `RestoreDBClusterFromSnapshot`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct RestoreDBClusterFromSnapshot;
6impl RestoreDBClusterFromSnapshot {
7    /// Creates a new `RestoreDBClusterFromSnapshot`
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::restore_db_cluster_from_snapshot::RestoreDbClusterFromSnapshotInput,
14    ) -> ::std::result::Result<
15        crate::operation::restore_db_cluster_from_snapshot::RestoreDbClusterFromSnapshotOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::restore_db_cluster_from_snapshot::RestoreDBClusterFromSnapshotError,
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::restore_db_cluster_from_snapshot::RestoreDBClusterFromSnapshotError>()
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::restore_db_cluster_from_snapshot::RestoreDbClusterFromSnapshotOutput>()
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::restore_db_cluster_from_snapshot::RestoreDbClusterFromSnapshotInput,
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("RDS", "RestoreDBClusterFromSnapshot", 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                "RDS.RestoreDBClusterFromSnapshot",
59                "rpc.service" = "RDS",
60                "rpc.method" = "RestoreDBClusterFromSnapshot",
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 RestoreDBClusterFromSnapshot {
88    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("RestoreDBClusterFromSnapshot");
90
91        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92            RestoreDBClusterFromSnapshotRequestSerializer,
93        ));
94        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95            RestoreDBClusterFromSnapshotResponseDeserializer,
96        ));
97
98        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99            crate::config::auth::Params::builder()
100                .operation_name("RestoreDBClusterFromSnapshot")
101                .build()
102                .expect("required fields set"),
103        ));
104
105        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
106        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
107            "RestoreDBClusterFromSnapshot",
108            "RDS",
109        ));
110        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
111        signing_options.double_uri_encode = true;
112        signing_options.content_sha256_header = false;
113        signing_options.normalize_uri_path = true;
114        signing_options.payload_override = None;
115
116        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
117            signing_options,
118            ..::std::default::Default::default()
119        });
120
121        ::std::option::Option::Some(cfg.freeze())
122    }
123
124    fn runtime_components(
125        &self,
126        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
127    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
128        #[allow(unused_mut)]
129        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("RestoreDBClusterFromSnapshot")
130            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
131                RestoreDBClusterFromSnapshotTelemetryInputCaptureInterceptor,
132            ))
133            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
134                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
135            ))
136            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
137                RestoreDBClusterFromSnapshotEndpointParamsInterceptor,
138            ))
139            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
140                crate::operation::restore_db_cluster_from_snapshot::RestoreDBClusterFromSnapshotError,
141            >::new())
142            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
143                crate::operation::restore_db_cluster_from_snapshot::RestoreDBClusterFromSnapshotError,
144            >::new())
145            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
146                crate::operation::restore_db_cluster_from_snapshot::RestoreDBClusterFromSnapshotError,
147            >::new());
148
149        ::std::borrow::Cow::Owned(rcb)
150    }
151}
152
153#[derive(Debug)]
154struct RestoreDBClusterFromSnapshotTelemetryInputCaptureInterceptor;
155
156#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
157impl ::aws_smithy_runtime_api::client::interceptors::Intercept for RestoreDBClusterFromSnapshotTelemetryInputCaptureInterceptor {
158    fn name(&self) -> &'static str {
159        "RestoreDBClusterFromSnapshotTelemetryInputCaptureInterceptor"
160    }
161
162    fn read_before_execution(
163        &self,
164        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
165            '_,
166            ::aws_smithy_runtime_api::client::interceptors::context::Input,
167            ::aws_smithy_runtime_api::client::interceptors::context::Output,
168            ::aws_smithy_runtime_api::client::interceptors::context::Error,
169        >,
170        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
171    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
172        // Nothing to do unless the customer opted in by naming members to record.
173        let ::std::option::Option::Some(requested) = cfg
174            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
175            .filter(|r| !r.is_empty())
176        else {
177            return ::std::result::Result::Ok(());
178        };
179
180        let ::std::option::Option::Some(input) = context.input().downcast_ref::<RestoreDbClusterFromSnapshotInput>() else {
181            // A mismatched input is not this interceptor's concern; skip quietly.
182            return ::std::result::Result::Ok(());
183        };
184
185        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
186        if requested.should_capture("DBClusterIdentifier") {
187            if let ::std::option::Option::Some(value) = input.db_cluster_identifier.as_deref() {
188                captured.insert("DBClusterIdentifier", value);
189            }
190        }
191        if requested.should_capture("SnapshotIdentifier") {
192            if let ::std::option::Option::Some(value) = input.snapshot_identifier.as_deref() {
193                captured.insert("SnapshotIdentifier", value);
194            }
195        }
196        if requested.should_capture("Engine") {
197            if let ::std::option::Option::Some(value) = input.engine.as_deref() {
198                captured.insert("Engine", value);
199            }
200        }
201        if requested.should_capture("EngineVersion") {
202            if let ::std::option::Option::Some(value) = input.engine_version.as_deref() {
203                captured.insert("EngineVersion", value);
204            }
205        }
206        if requested.should_capture("DBSubnetGroupName") {
207            if let ::std::option::Option::Some(value) = input.db_subnet_group_name.as_deref() {
208                captured.insert("DBSubnetGroupName", value);
209            }
210        }
211        if requested.should_capture("DatabaseName") {
212            if let ::std::option::Option::Some(value) = input.database_name.as_deref() {
213                captured.insert("DatabaseName", value);
214            }
215        }
216        if requested.should_capture("OptionGroupName") {
217            if let ::std::option::Option::Some(value) = input.option_group_name.as_deref() {
218                captured.insert("OptionGroupName", value);
219            }
220        }
221        if requested.should_capture("KmsKeyId") {
222            if let ::std::option::Option::Some(value) = input.kms_key_id.as_deref() {
223                captured.insert("KmsKeyId", value);
224            }
225        }
226        if requested.should_capture("EngineMode") {
227            if let ::std::option::Option::Some(value) = input.engine_mode.as_deref() {
228                captured.insert("EngineMode", value);
229            }
230        }
231        if requested.should_capture("DBClusterParameterGroupName") {
232            if let ::std::option::Option::Some(value) = input.db_cluster_parameter_group_name.as_deref() {
233                captured.insert("DBClusterParameterGroupName", value);
234            }
235        }
236        if requested.should_capture("Domain") {
237            if let ::std::option::Option::Some(value) = input.domain.as_deref() {
238                captured.insert("Domain", value);
239            }
240        }
241        if requested.should_capture("DomainIAMRoleName") {
242            if let ::std::option::Option::Some(value) = input.domain_iam_role_name.as_deref() {
243                captured.insert("DomainIAMRoleName", value);
244            }
245        }
246        if requested.should_capture("DBClusterInstanceClass") {
247            if let ::std::option::Option::Some(value) = input.db_cluster_instance_class.as_deref() {
248                captured.insert("DBClusterInstanceClass", value);
249            }
250        }
251        if requested.should_capture("StorageType") {
252            if let ::std::option::Option::Some(value) = input.storage_type.as_deref() {
253                captured.insert("StorageType", value);
254            }
255        }
256        if requested.should_capture("NetworkType") {
257            if let ::std::option::Option::Some(value) = input.network_type.as_deref() {
258                captured.insert("NetworkType", value);
259            }
260        }
261        if requested.should_capture("MonitoringRoleArn") {
262            if let ::std::option::Option::Some(value) = input.monitoring_role_arn.as_deref() {
263                captured.insert("MonitoringRoleArn", value);
264            }
265        }
266        if requested.should_capture("PerformanceInsightsKMSKeyId") {
267            if let ::std::option::Option::Some(value) = input.performance_insights_kms_key_id.as_deref() {
268                captured.insert("PerformanceInsightsKMSKeyId", value);
269            }
270        }
271        if requested.should_capture("PreferredBackupWindow") {
272            if let ::std::option::Option::Some(value) = input.preferred_backup_window.as_deref() {
273                captured.insert("PreferredBackupWindow", value);
274            }
275        }
276        if requested.should_capture("EngineLifecycleSupport") {
277            if let ::std::option::Option::Some(value) = input.engine_lifecycle_support.as_deref() {
278                captured.insert("EngineLifecycleSupport", value);
279            }
280        }
281
282        cfg.interceptor_state().store_put(captured);
283        ::std::result::Result::Ok(())
284    }
285}
286#[derive(Debug)]
287struct RestoreDBClusterFromSnapshotResponseDeserializer;
288impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for RestoreDBClusterFromSnapshotResponseDeserializer {
289    fn deserialize_nonstreaming_with_config(
290        &self,
291        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
292        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
293    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
294        let (success, status) = (response.status().is_success(), response.status().as_u16());
295        let headers = response.headers();
296        let body = response.body().bytes().expect("body loaded");
297        #[allow(unused_mut)]
298        let mut force_error = false;
299        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
300        let parse_result = if !success && status != 200 || force_error {
301            crate::protocol_serde::shape_restore_db_cluster_from_snapshot::de_restore_db_cluster_from_snapshot_http_error(status, headers, body)
302        } else {
303            crate::protocol_serde::shape_restore_db_cluster_from_snapshot::de_restore_db_cluster_from_snapshot_http_response(status, headers, body)
304        };
305        crate::protocol_serde::type_erase_result(parse_result)
306    }
307}
308#[derive(Debug)]
309struct RestoreDBClusterFromSnapshotRequestSerializer;
310impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for RestoreDBClusterFromSnapshotRequestSerializer {
311    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
312    fn serialize_input(
313        &self,
314        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
315        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
316    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
317        let input = input
318            .downcast::<crate::operation::restore_db_cluster_from_snapshot::RestoreDbClusterFromSnapshotInput>()
319            .expect("correct type");
320        let _header_serialization_settings = _cfg
321            .load::<crate::serialization_settings::HeaderSerializationSettings>()
322            .cloned()
323            .unwrap_or_default();
324        let mut request_builder = {
325            #[allow(clippy::uninlined_format_args)]
326            fn uri_base(
327                _input: &crate::operation::restore_db_cluster_from_snapshot::RestoreDbClusterFromSnapshotInput,
328                output: &mut ::std::string::String,
329            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
330                use ::std::fmt::Write as _;
331                ::std::write!(output, "/").expect("formatting should succeed");
332                ::std::result::Result::Ok(())
333            }
334            #[allow(clippy::unnecessary_wraps)]
335            fn update_http_builder(
336                input: &crate::operation::restore_db_cluster_from_snapshot::RestoreDbClusterFromSnapshotInput,
337                builder: ::http_1x::request::Builder,
338            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
339                let mut uri = ::std::string::String::new();
340                uri_base(input, &mut uri)?;
341                ::std::result::Result::Ok(builder.method("POST").uri(uri))
342            }
343            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
344            builder =
345                _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-www-form-urlencoded");
346            builder
347        };
348        let body = ::aws_smithy_types::body::SdkBody::from(
349            crate::protocol_serde::shape_restore_db_cluster_from_snapshot_input::ser_restore_db_cluster_from_snapshot_input_input_input(&input)?,
350        );
351        if let Some(content_length) = body.content_length() {
352            let content_length = content_length.to_string();
353            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
354        }
355        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
356    }
357}
358#[derive(Debug)]
359struct RestoreDBClusterFromSnapshotEndpointParamsInterceptor;
360
361#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
362impl ::aws_smithy_runtime_api::client::interceptors::Intercept for RestoreDBClusterFromSnapshotEndpointParamsInterceptor {
363    fn name(&self) -> &'static str {
364        "RestoreDBClusterFromSnapshotEndpointParamsInterceptor"
365    }
366
367    fn read_before_execution(
368        &self,
369        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
370            '_,
371            ::aws_smithy_runtime_api::client::interceptors::context::Input,
372            ::aws_smithy_runtime_api::client::interceptors::context::Output,
373            ::aws_smithy_runtime_api::client::interceptors::context::Error,
374        >,
375        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
376    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
377        let _input = context
378            .input()
379            .downcast_ref::<RestoreDbClusterFromSnapshotInput>()
380            .ok_or("failed to downcast to RestoreDbClusterFromSnapshotInput")?;
381
382        let params = crate::config::endpoint::Params::builder()
383            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
384            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
385            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
386            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
387            .build()
388            .map_err(|err| {
389                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
390            })?;
391        cfg.interceptor_state()
392            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
393        ::std::result::Result::Ok(())
394    }
395}
396
397// The get_* functions below are generated from JMESPath expressions in the
398// operationContextParams trait. They target the operation's input shape.
399
400/// Error type for the `RestoreDBClusterFromSnapshotError` operation.
401#[non_exhaustive]
402#[derive(::std::fmt::Debug)]
403pub enum RestoreDBClusterFromSnapshotError {
404    /// <p>The user already has a DB cluster with the given identifier.</p>
405    DbClusterAlreadyExistsFault(crate::types::error::DbClusterAlreadyExistsFault),
406    /// <p><code>DBClusterParameterGroupName</code> doesn't refer to an existing DB cluster parameter group.</p>
407    DbClusterParameterGroupNotFoundFault(crate::types::error::DbClusterParameterGroupNotFoundFault),
408    /// <p>The user attempted to create a new DB cluster and the user has already reached the maximum allowed DB cluster quota.</p>
409    DbClusterQuotaExceededFault(crate::types::error::DbClusterQuotaExceededFault),
410    /// <p>You have exceeded the maximum number of IAM roles that can be associated with the specified DB cluster.</p>
411    DbClusterRoleQuotaExceededFault(crate::types::error::DbClusterRoleQuotaExceededFault),
412    /// <p><code>DBClusterSnapshotIdentifier</code> doesn't refer to an existing DB cluster snapshot.</p>
413    DbClusterSnapshotNotFoundFault(crate::types::error::DbClusterSnapshotNotFoundFault),
414    /// <p><code>DBSnapshotIdentifier</code> doesn't refer to an existing DB snapshot.</p>
415    DbSnapshotNotFoundFault(crate::types::error::DbSnapshotNotFoundFault),
416    /// <p>Subnets in the DB subnet group should cover at least two Availability Zones unless there is only one Availability Zone.</p>
417    DbSubnetGroupDoesNotCoverEnoughAZs(crate::types::error::DbSubnetGroupDoesNotCoverEnoughAZs),
418    /// <p><code>DBSubnetGroupName</code> doesn't refer to an existing DB subnet group.</p>
419    DbSubnetGroupNotFoundFault(crate::types::error::DbSubnetGroupNotFoundFault),
420    /// <p><code>Domain</code> doesn't refer to an existing Active Directory domain.</p>
421    DomainNotFoundFault(crate::types::error::DomainNotFoundFault),
422    /// <p>The DB cluster doesn't have enough capacity for the current operation.</p>
423    InsufficientDbClusterCapacityFault(crate::types::error::InsufficientDbClusterCapacityFault),
424    /// <p>The specified DB instance class isn't available in the specified Availability Zone.</p>
425    InsufficientDbInstanceCapacityFault(crate::types::error::InsufficientDbInstanceCapacityFault),
426    /// <p>There is insufficient storage available for the current action. You might be able to resolve this error by updating your subnet group to use different Availability Zones that have more storage available.</p>
427    InsufficientStorageClusterCapacityFault(crate::types::error::InsufficientStorageClusterCapacityFault),
428    /// <p>The supplied value isn't a valid DB cluster snapshot state.</p>
429    InvalidDbClusterSnapshotStateFault(crate::types::error::InvalidDbClusterSnapshotStateFault),
430    /// <p>The DB instance isn't in a valid state.</p>
431    InvalidDbInstanceStateFault(crate::types::error::InvalidDbInstanceStateFault),
432    /// <p>The state of the DB snapshot doesn't allow deletion.</p>
433    InvalidDbSnapshotStateFault(crate::types::error::InvalidDbSnapshotStateFault),
434    /// <p>Cannot restore from VPC backup to non-VPC DB instance.</p>
435    InvalidRestoreFault(crate::types::error::InvalidRestoreFault),
436    /// <p>The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.</p>
437    InvalidSubnet(crate::types::error::InvalidSubnet),
438    /// <p>The DB subnet group doesn't cover all Availability Zones after it's created because of users' change.</p>
439    InvalidVpcNetworkStateFault(crate::types::error::InvalidVpcNetworkStateFault),
440    /// <p>An error occurred accessing an Amazon Web Services KMS key.</p>
441    KmsKeyNotAccessibleFault(crate::types::error::KmsKeyNotAccessibleFault),
442    /// <p>The network type is invalid for the DB instance. Valid nework type values are <code>IPV4</code> and <code>DUAL</code>.</p>
443    NetworkTypeNotSupported(crate::types::error::NetworkTypeNotSupported),
444    /// <p>The specified option group could not be found.</p>
445    OptionGroupNotFoundFault(crate::types::error::OptionGroupNotFoundFault),
446    /// <p>The request would result in the user exceeding the allowed amount of storage available across all DB instances.</p>
447    StorageQuotaExceededFault(crate::types::error::StorageQuotaExceededFault),
448    /// <p>The specified <code>StorageType</code> can't be associated with the DB instance.</p>
449    StorageTypeNotSupportedFault(crate::types::error::StorageTypeNotSupportedFault),
450    /// <p>The operation violates VPC encryption control settings. Make sure that your DB instance type supports the Nitro encryption-in-transit capability, or modify your VPC's encryption controls to not enforce encryption-in-transit.</p>
451    VpcEncryptionControlViolationException(crate::types::error::VpcEncryptionControlViolationException),
452    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
453    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
454    variable wildcard pattern and check `.code()`:
455     \
456    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
457     \
458    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-RestoreDBClusterFromSnapshotError) for what information is available for the error.")]
459    Unhandled(crate::error::sealed_unhandled::Unhandled),
460}
461impl RestoreDBClusterFromSnapshotError {
462    /// Creates the `RestoreDBClusterFromSnapshotError::Unhandled` variant from any error type.
463    pub fn unhandled(
464        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
465    ) -> Self {
466        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
467            source: err.into(),
468            meta: ::std::default::Default::default(),
469        })
470    }
471
472    /// Creates the `RestoreDBClusterFromSnapshotError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
473    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
474        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
475            source: err.clone().into(),
476            meta: err,
477        })
478    }
479    ///
480    /// Returns error metadata, which includes the error code, message,
481    /// request ID, and potentially additional information.
482    ///
483    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
484        match self {
485            Self::DbClusterAlreadyExistsFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
486            Self::DbClusterParameterGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
487            Self::DbClusterQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
488            Self::DbClusterRoleQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
489            Self::DbClusterSnapshotNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
490            Self::DbSnapshotNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
491            Self::DbSubnetGroupDoesNotCoverEnoughAZs(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
492            Self::DbSubnetGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
493            Self::DomainNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
494            Self::InsufficientDbClusterCapacityFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
495            Self::InsufficientDbInstanceCapacityFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
496            Self::InsufficientStorageClusterCapacityFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
497            Self::InvalidDbClusterSnapshotStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
498            Self::InvalidDbInstanceStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
499            Self::InvalidDbSnapshotStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
500            Self::InvalidRestoreFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
501            Self::InvalidSubnet(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
502            Self::InvalidVpcNetworkStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
503            Self::KmsKeyNotAccessibleFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
504            Self::NetworkTypeNotSupported(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
505            Self::OptionGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
506            Self::StorageQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
507            Self::StorageTypeNotSupportedFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
508            Self::VpcEncryptionControlViolationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
509            Self::Unhandled(e) => &e.meta,
510        }
511    }
512    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::DbClusterAlreadyExistsFault`.
513    pub fn is_db_cluster_already_exists_fault(&self) -> bool {
514        matches!(self, Self::DbClusterAlreadyExistsFault(_))
515    }
516    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::DbClusterParameterGroupNotFoundFault`.
517    pub fn is_db_cluster_parameter_group_not_found_fault(&self) -> bool {
518        matches!(self, Self::DbClusterParameterGroupNotFoundFault(_))
519    }
520    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::DbClusterQuotaExceededFault`.
521    pub fn is_db_cluster_quota_exceeded_fault(&self) -> bool {
522        matches!(self, Self::DbClusterQuotaExceededFault(_))
523    }
524    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::DbClusterRoleQuotaExceededFault`.
525    pub fn is_db_cluster_role_quota_exceeded_fault(&self) -> bool {
526        matches!(self, Self::DbClusterRoleQuotaExceededFault(_))
527    }
528    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::DbClusterSnapshotNotFoundFault`.
529    pub fn is_db_cluster_snapshot_not_found_fault(&self) -> bool {
530        matches!(self, Self::DbClusterSnapshotNotFoundFault(_))
531    }
532    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::DbSnapshotNotFoundFault`.
533    pub fn is_db_snapshot_not_found_fault(&self) -> bool {
534        matches!(self, Self::DbSnapshotNotFoundFault(_))
535    }
536    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::DbSubnetGroupDoesNotCoverEnoughAZs`.
537    pub fn is_db_subnet_group_does_not_cover_enough_azs(&self) -> bool {
538        matches!(self, Self::DbSubnetGroupDoesNotCoverEnoughAZs(_))
539    }
540    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::DbSubnetGroupNotFoundFault`.
541    pub fn is_db_subnet_group_not_found_fault(&self) -> bool {
542        matches!(self, Self::DbSubnetGroupNotFoundFault(_))
543    }
544    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::DomainNotFoundFault`.
545    pub fn is_domain_not_found_fault(&self) -> bool {
546        matches!(self, Self::DomainNotFoundFault(_))
547    }
548    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::InsufficientDbClusterCapacityFault`.
549    pub fn is_insufficient_db_cluster_capacity_fault(&self) -> bool {
550        matches!(self, Self::InsufficientDbClusterCapacityFault(_))
551    }
552    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::InsufficientDbInstanceCapacityFault`.
553    pub fn is_insufficient_db_instance_capacity_fault(&self) -> bool {
554        matches!(self, Self::InsufficientDbInstanceCapacityFault(_))
555    }
556    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::InsufficientStorageClusterCapacityFault`.
557    pub fn is_insufficient_storage_cluster_capacity_fault(&self) -> bool {
558        matches!(self, Self::InsufficientStorageClusterCapacityFault(_))
559    }
560    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::InvalidDbClusterSnapshotStateFault`.
561    pub fn is_invalid_db_cluster_snapshot_state_fault(&self) -> bool {
562        matches!(self, Self::InvalidDbClusterSnapshotStateFault(_))
563    }
564    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::InvalidDbInstanceStateFault`.
565    pub fn is_invalid_db_instance_state_fault(&self) -> bool {
566        matches!(self, Self::InvalidDbInstanceStateFault(_))
567    }
568    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::InvalidDbSnapshotStateFault`.
569    pub fn is_invalid_db_snapshot_state_fault(&self) -> bool {
570        matches!(self, Self::InvalidDbSnapshotStateFault(_))
571    }
572    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::InvalidRestoreFault`.
573    pub fn is_invalid_restore_fault(&self) -> bool {
574        matches!(self, Self::InvalidRestoreFault(_))
575    }
576    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::InvalidSubnet`.
577    pub fn is_invalid_subnet(&self) -> bool {
578        matches!(self, Self::InvalidSubnet(_))
579    }
580    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::InvalidVpcNetworkStateFault`.
581    pub fn is_invalid_vpc_network_state_fault(&self) -> bool {
582        matches!(self, Self::InvalidVpcNetworkStateFault(_))
583    }
584    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::KmsKeyNotAccessibleFault`.
585    pub fn is_kms_key_not_accessible_fault(&self) -> bool {
586        matches!(self, Self::KmsKeyNotAccessibleFault(_))
587    }
588    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::NetworkTypeNotSupported`.
589    pub fn is_network_type_not_supported(&self) -> bool {
590        matches!(self, Self::NetworkTypeNotSupported(_))
591    }
592    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::OptionGroupNotFoundFault`.
593    pub fn is_option_group_not_found_fault(&self) -> bool {
594        matches!(self, Self::OptionGroupNotFoundFault(_))
595    }
596    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::StorageQuotaExceededFault`.
597    pub fn is_storage_quota_exceeded_fault(&self) -> bool {
598        matches!(self, Self::StorageQuotaExceededFault(_))
599    }
600    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::StorageTypeNotSupportedFault`.
601    pub fn is_storage_type_not_supported_fault(&self) -> bool {
602        matches!(self, Self::StorageTypeNotSupportedFault(_))
603    }
604    /// Returns `true` if the error kind is `RestoreDBClusterFromSnapshotError::VpcEncryptionControlViolationException`.
605    pub fn is_vpc_encryption_control_violation_exception(&self) -> bool {
606        matches!(self, Self::VpcEncryptionControlViolationException(_))
607    }
608}
609impl ::std::error::Error for RestoreDBClusterFromSnapshotError {
610    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
611        match self {
612            Self::DbClusterAlreadyExistsFault(_inner) => ::std::option::Option::Some(_inner),
613            Self::DbClusterParameterGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
614            Self::DbClusterQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
615            Self::DbClusterRoleQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
616            Self::DbClusterSnapshotNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
617            Self::DbSnapshotNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
618            Self::DbSubnetGroupDoesNotCoverEnoughAZs(_inner) => ::std::option::Option::Some(_inner),
619            Self::DbSubnetGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
620            Self::DomainNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
621            Self::InsufficientDbClusterCapacityFault(_inner) => ::std::option::Option::Some(_inner),
622            Self::InsufficientDbInstanceCapacityFault(_inner) => ::std::option::Option::Some(_inner),
623            Self::InsufficientStorageClusterCapacityFault(_inner) => ::std::option::Option::Some(_inner),
624            Self::InvalidDbClusterSnapshotStateFault(_inner) => ::std::option::Option::Some(_inner),
625            Self::InvalidDbInstanceStateFault(_inner) => ::std::option::Option::Some(_inner),
626            Self::InvalidDbSnapshotStateFault(_inner) => ::std::option::Option::Some(_inner),
627            Self::InvalidRestoreFault(_inner) => ::std::option::Option::Some(_inner),
628            Self::InvalidSubnet(_inner) => ::std::option::Option::Some(_inner),
629            Self::InvalidVpcNetworkStateFault(_inner) => ::std::option::Option::Some(_inner),
630            Self::KmsKeyNotAccessibleFault(_inner) => ::std::option::Option::Some(_inner),
631            Self::NetworkTypeNotSupported(_inner) => ::std::option::Option::Some(_inner),
632            Self::OptionGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
633            Self::StorageQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
634            Self::StorageTypeNotSupportedFault(_inner) => ::std::option::Option::Some(_inner),
635            Self::VpcEncryptionControlViolationException(_inner) => ::std::option::Option::Some(_inner),
636            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
637        }
638    }
639}
640impl ::std::fmt::Display for RestoreDBClusterFromSnapshotError {
641    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
642        match self {
643            Self::DbClusterAlreadyExistsFault(_inner) => _inner.fmt(f),
644            Self::DbClusterParameterGroupNotFoundFault(_inner) => _inner.fmt(f),
645            Self::DbClusterQuotaExceededFault(_inner) => _inner.fmt(f),
646            Self::DbClusterRoleQuotaExceededFault(_inner) => _inner.fmt(f),
647            Self::DbClusterSnapshotNotFoundFault(_inner) => _inner.fmt(f),
648            Self::DbSnapshotNotFoundFault(_inner) => _inner.fmt(f),
649            Self::DbSubnetGroupDoesNotCoverEnoughAZs(_inner) => _inner.fmt(f),
650            Self::DbSubnetGroupNotFoundFault(_inner) => _inner.fmt(f),
651            Self::DomainNotFoundFault(_inner) => _inner.fmt(f),
652            Self::InsufficientDbClusterCapacityFault(_inner) => _inner.fmt(f),
653            Self::InsufficientDbInstanceCapacityFault(_inner) => _inner.fmt(f),
654            Self::InsufficientStorageClusterCapacityFault(_inner) => _inner.fmt(f),
655            Self::InvalidDbClusterSnapshotStateFault(_inner) => _inner.fmt(f),
656            Self::InvalidDbInstanceStateFault(_inner) => _inner.fmt(f),
657            Self::InvalidDbSnapshotStateFault(_inner) => _inner.fmt(f),
658            Self::InvalidRestoreFault(_inner) => _inner.fmt(f),
659            Self::InvalidSubnet(_inner) => _inner.fmt(f),
660            Self::InvalidVpcNetworkStateFault(_inner) => _inner.fmt(f),
661            Self::KmsKeyNotAccessibleFault(_inner) => _inner.fmt(f),
662            Self::NetworkTypeNotSupported(_inner) => _inner.fmt(f),
663            Self::OptionGroupNotFoundFault(_inner) => _inner.fmt(f),
664            Self::StorageQuotaExceededFault(_inner) => _inner.fmt(f),
665            Self::StorageTypeNotSupportedFault(_inner) => _inner.fmt(f),
666            Self::VpcEncryptionControlViolationException(_inner) => _inner.fmt(f),
667            Self::Unhandled(_inner) => {
668                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
669                    write!(f, "unhandled error ({code})")
670                } else {
671                    f.write_str("unhandled error")
672                }
673            }
674        }
675    }
676}
677impl ::aws_smithy_types::retry::ProvideErrorKind for RestoreDBClusterFromSnapshotError {
678    fn code(&self) -> ::std::option::Option<&str> {
679        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
680    }
681    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
682        ::std::option::Option::None
683    }
684}
685impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for RestoreDBClusterFromSnapshotError {
686    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
687        match self {
688            Self::DbClusterAlreadyExistsFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
689            Self::DbClusterParameterGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
690            Self::DbClusterQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
691            Self::DbClusterRoleQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
692            Self::DbClusterSnapshotNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
693            Self::DbSnapshotNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
694            Self::DbSubnetGroupDoesNotCoverEnoughAZs(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
695            Self::DbSubnetGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
696            Self::DomainNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
697            Self::InsufficientDbClusterCapacityFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
698            Self::InsufficientDbInstanceCapacityFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
699            Self::InsufficientStorageClusterCapacityFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
700            Self::InvalidDbClusterSnapshotStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
701            Self::InvalidDbInstanceStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
702            Self::InvalidDbSnapshotStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
703            Self::InvalidRestoreFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
704            Self::InvalidSubnet(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
705            Self::InvalidVpcNetworkStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
706            Self::KmsKeyNotAccessibleFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
707            Self::NetworkTypeNotSupported(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
708            Self::OptionGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
709            Self::StorageQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
710            Self::StorageTypeNotSupportedFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
711            Self::VpcEncryptionControlViolationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
712            Self::Unhandled(_inner) => &_inner.meta,
713        }
714    }
715}
716impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for RestoreDBClusterFromSnapshotError {
717    fn create_unhandled_error(
718        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
719        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
720    ) -> Self {
721        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
722            source,
723            meta: meta.unwrap_or_default(),
724        })
725    }
726}
727impl ::aws_types::request_id::RequestId for crate::operation::restore_db_cluster_from_snapshot::RestoreDBClusterFromSnapshotError {
728    fn request_id(&self) -> Option<&str> {
729        self.meta().request_id()
730    }
731}
732
733pub use crate::operation::restore_db_cluster_from_snapshot::_restore_db_cluster_from_snapshot_input::RestoreDbClusterFromSnapshotInput;
734
735pub use crate::operation::restore_db_cluster_from_snapshot::_restore_db_cluster_from_snapshot_output::RestoreDbClusterFromSnapshotOutput;
736
737mod _restore_db_cluster_from_snapshot_input;
738
739mod _restore_db_cluster_from_snapshot_output;
740
741/// Builders
742pub mod builders;