aws_sdk_rds/operation/
restore_db_instance_from_db_snapshot.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `RestoreDBInstanceFromDBSnapshot`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct RestoreDBInstanceFromDBSnapshot;
6impl RestoreDBInstanceFromDBSnapshot {
7    /// Creates a new `RestoreDBInstanceFromDBSnapshot`
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_instance_from_db_snapshot::RestoreDbInstanceFromDbSnapshotInput,
14    ) -> ::std::result::Result<
15        crate::operation::restore_db_instance_from_db_snapshot::RestoreDbInstanceFromDbSnapshotOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::restore_db_instance_from_db_snapshot::RestoreDBInstanceFromDBSnapshotError,
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_instance_from_db_snapshot::RestoreDBInstanceFromDBSnapshotError>()
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_instance_from_db_snapshot::RestoreDbInstanceFromDbSnapshotOutput>()
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_instance_from_db_snapshot::RestoreDbInstanceFromDbSnapshotInput,
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(
55            "RDS",
56            "RestoreDBInstanceFromDBSnapshot",
57            input,
58            runtime_plugins,
59            stop_point,
60        )
61        // Create a parent span for the entire operation. Includes a random, internal-only,
62        // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
63        .instrument(::tracing::debug_span!(
64            "RDS.RestoreDBInstanceFromDBSnapshot",
65            "rpc.service" = "RDS",
66            "rpc.method" = "RestoreDBInstanceFromDBSnapshot",
67            "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
68            "rpc.system" = "aws-api",
69        ))
70        .await
71    }
72
73    pub(crate) fn operation_runtime_plugins(
74        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
75        client_config: &crate::config::Config,
76        config_override: ::std::option::Option<crate::config::Builder>,
77    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
78        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
79
80        if let ::std::option::Option::Some(config_override) = config_override {
81            for plugin in config_override.runtime_plugins.iter().cloned() {
82                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
83            }
84            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
85                config_override,
86                client_config.config.clone(),
87                &client_config.runtime_components,
88            ));
89        }
90        runtime_plugins
91    }
92}
93impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for RestoreDBInstanceFromDBSnapshot {
94    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
95        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("RestoreDBInstanceFromDBSnapshot");
96
97        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
98            RestoreDBInstanceFromDBSnapshotRequestSerializer,
99        ));
100        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
101            RestoreDBInstanceFromDBSnapshotResponseDeserializer,
102        ));
103
104        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
105            crate::config::auth::Params::builder()
106                .operation_name("RestoreDBInstanceFromDBSnapshot")
107                .build()
108                .expect("required fields set"),
109        ));
110
111        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
112        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
113            "RestoreDBInstanceFromDBSnapshot",
114            "RDS",
115        ));
116        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
117        signing_options.double_uri_encode = true;
118        signing_options.content_sha256_header = false;
119        signing_options.normalize_uri_path = true;
120        signing_options.payload_override = None;
121
122        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
123            signing_options,
124            ..::std::default::Default::default()
125        });
126
127        ::std::option::Option::Some(cfg.freeze())
128    }
129
130    fn runtime_components(
131        &self,
132        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
133    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
134        #[allow(unused_mut)]
135        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("RestoreDBInstanceFromDBSnapshot")
136            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
137            .with_interceptor(RestoreDBInstanceFromDBSnapshotEndpointParamsInterceptor)
138            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
139                crate::operation::restore_db_instance_from_db_snapshot::RestoreDBInstanceFromDBSnapshotError,
140            >::new())
141            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
142                crate::operation::restore_db_instance_from_db_snapshot::RestoreDBInstanceFromDBSnapshotError,
143            >::new())
144            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
145                crate::operation::restore_db_instance_from_db_snapshot::RestoreDBInstanceFromDBSnapshotError,
146            >::new());
147
148        ::std::borrow::Cow::Owned(rcb)
149    }
150}
151
152#[derive(Debug)]
153struct RestoreDBInstanceFromDBSnapshotResponseDeserializer;
154impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for RestoreDBInstanceFromDBSnapshotResponseDeserializer {
155    fn deserialize_nonstreaming(
156        &self,
157        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
158    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
159        let (success, status) = (response.status().is_success(), response.status().as_u16());
160        let headers = response.headers();
161        let body = response.body().bytes().expect("body loaded");
162        #[allow(unused_mut)]
163        let mut force_error = false;
164        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
165        let parse_result = if !success && status != 200 || force_error {
166            crate::protocol_serde::shape_restore_db_instance_from_db_snapshot::de_restore_db_instance_from_db_snapshot_http_error(
167                status, headers, body,
168            )
169        } else {
170            crate::protocol_serde::shape_restore_db_instance_from_db_snapshot::de_restore_db_instance_from_db_snapshot_http_response(
171                status, headers, body,
172            )
173        };
174        crate::protocol_serde::type_erase_result(parse_result)
175    }
176}
177#[derive(Debug)]
178struct RestoreDBInstanceFromDBSnapshotRequestSerializer;
179impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for RestoreDBInstanceFromDBSnapshotRequestSerializer {
180    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
181    fn serialize_input(
182        &self,
183        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
184        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
185    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
186        let input = input
187            .downcast::<crate::operation::restore_db_instance_from_db_snapshot::RestoreDbInstanceFromDbSnapshotInput>()
188            .expect("correct type");
189        let _header_serialization_settings = _cfg
190            .load::<crate::serialization_settings::HeaderSerializationSettings>()
191            .cloned()
192            .unwrap_or_default();
193        let mut request_builder = {
194            #[allow(clippy::uninlined_format_args)]
195            fn uri_base(
196                _input: &crate::operation::restore_db_instance_from_db_snapshot::RestoreDbInstanceFromDbSnapshotInput,
197                output: &mut ::std::string::String,
198            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
199                use ::std::fmt::Write as _;
200                ::std::write!(output, "/").expect("formatting should succeed");
201                ::std::result::Result::Ok(())
202            }
203            #[allow(clippy::unnecessary_wraps)]
204            fn update_http_builder(
205                input: &crate::operation::restore_db_instance_from_db_snapshot::RestoreDbInstanceFromDbSnapshotInput,
206                builder: ::http::request::Builder,
207            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
208                let mut uri = ::std::string::String::new();
209                uri_base(input, &mut uri)?;
210                ::std::result::Result::Ok(builder.method("POST").uri(uri))
211            }
212            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
213            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-www-form-urlencoded");
214            builder
215        };
216        let body = ::aws_smithy_types::body::SdkBody::from(
217            crate::protocol_serde::shape_restore_db_instance_from_db_snapshot_input::ser_restore_db_instance_from_db_snapshot_input_input_input(
218                &input,
219            )?,
220        );
221        if let Some(content_length) = body.content_length() {
222            let content_length = content_length.to_string();
223            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
224        }
225        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
226    }
227}
228#[derive(Debug)]
229struct RestoreDBInstanceFromDBSnapshotEndpointParamsInterceptor;
230
231impl ::aws_smithy_runtime_api::client::interceptors::Intercept for RestoreDBInstanceFromDBSnapshotEndpointParamsInterceptor {
232    fn name(&self) -> &'static str {
233        "RestoreDBInstanceFromDBSnapshotEndpointParamsInterceptor"
234    }
235
236    fn read_before_execution(
237        &self,
238        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
239            '_,
240            ::aws_smithy_runtime_api::client::interceptors::context::Input,
241            ::aws_smithy_runtime_api::client::interceptors::context::Output,
242            ::aws_smithy_runtime_api::client::interceptors::context::Error,
243        >,
244        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
245    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
246        let _input = context
247            .input()
248            .downcast_ref::<RestoreDbInstanceFromDbSnapshotInput>()
249            .ok_or("failed to downcast to RestoreDbInstanceFromDbSnapshotInput")?;
250
251        let params = crate::config::endpoint::Params::builder()
252            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
253            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
254            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
255            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
256            .build()
257            .map_err(|err| {
258                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
259            })?;
260        cfg.interceptor_state()
261            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
262        ::std::result::Result::Ok(())
263    }
264}
265
266// The get_* functions below are generated from JMESPath expressions in the
267// operationContextParams trait. They target the operation's input shape.
268
269/// Error type for the `RestoreDBInstanceFromDBSnapshotError` operation.
270#[non_exhaustive]
271#[derive(::std::fmt::Debug)]
272pub enum RestoreDBInstanceFromDBSnapshotError {
273    /// <p>The specified CIDR IP range or Amazon EC2 security group might not be authorized for the specified DB security group.</p>
274    /// <p>Or, RDS might not be authorized to perform necessary actions using IAM on your behalf.</p>
275    AuthorizationNotFoundFault(crate::types::error::AuthorizationNotFoundFault),
276    #[allow(missing_docs)] // documentation missing in model
277    #[deprecated(note = "Please avoid using this fault")]
278    BackupPolicyNotFoundFault(crate::types::error::BackupPolicyNotFoundFault),
279    /// <p><code>CertificateIdentifier</code> doesn't refer to an existing certificate.</p>
280    CertificateNotFoundFault(crate::types::error::CertificateNotFoundFault),
281    /// <p><code>DBClusterSnapshotIdentifier</code> doesn't refer to an existing DB cluster snapshot.</p>
282    DbClusterSnapshotNotFoundFault(crate::types::error::DbClusterSnapshotNotFoundFault),
283    /// <p>The user already has a DB instance with the given identifier.</p>
284    DbInstanceAlreadyExistsFault(crate::types::error::DbInstanceAlreadyExistsFault),
285    /// <p><code>DBParameterGroupName</code> doesn't refer to an existing DB parameter group.</p>
286    DbParameterGroupNotFoundFault(crate::types::error::DbParameterGroupNotFoundFault),
287    /// <p><code>DBSecurityGroupName</code> doesn't refer to an existing DB security group.</p>
288    DbSecurityGroupNotFoundFault(crate::types::error::DbSecurityGroupNotFoundFault),
289    /// <p><code>DBSnapshotIdentifier</code> doesn't refer to an existing DB snapshot.</p>
290    DbSnapshotNotFoundFault(crate::types::error::DbSnapshotNotFoundFault),
291    /// <p>Subnets in the DB subnet group should cover at least two Availability Zones unless there is only one Availability Zone.</p>
292    DbSubnetGroupDoesNotCoverEnoughAZs(crate::types::error::DbSubnetGroupDoesNotCoverEnoughAZs),
293    /// <p><code>DBSubnetGroupName</code> doesn't refer to an existing DB subnet group.</p>
294    DbSubnetGroupNotFoundFault(crate::types::error::DbSubnetGroupNotFoundFault),
295    /// <p><code>Domain</code> doesn't refer to an existing Active Directory domain.</p>
296    DomainNotFoundFault(crate::types::error::DomainNotFoundFault),
297    /// <p>The request would result in the user exceeding the allowed number of DB instances.</p>
298    InstanceQuotaExceededFault(crate::types::error::InstanceQuotaExceededFault),
299    /// <p>The specified DB instance class isn't available in the specified Availability Zone.</p>
300    InsufficientDbInstanceCapacityFault(crate::types::error::InsufficientDbInstanceCapacityFault),
301    /// <p>The state of the DB snapshot doesn't allow deletion.</p>
302    InvalidDbSnapshotStateFault(crate::types::error::InvalidDbSnapshotStateFault),
303    /// <p>Cannot restore from VPC backup to non-VPC DB instance.</p>
304    InvalidRestoreFault(crate::types::error::InvalidRestoreFault),
305    /// <p>The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.</p>
306    InvalidSubnet(crate::types::error::InvalidSubnet),
307    /// <p>The DB subnet group doesn't cover all Availability Zones after it's created because of users' change.</p>
308    InvalidVpcNetworkStateFault(crate::types::error::InvalidVpcNetworkStateFault),
309    /// <p>An error occurred accessing an Amazon Web Services KMS key.</p>
310    KmsKeyNotAccessibleFault(crate::types::error::KmsKeyNotAccessibleFault),
311    /// <p>The network type is invalid for the DB instance. Valid nework type values are <code>IPV4</code> and <code>DUAL</code>.</p>
312    NetworkTypeNotSupported(crate::types::error::NetworkTypeNotSupported),
313    /// <p>The specified option group could not be found.</p>
314    OptionGroupNotFoundFault(crate::types::error::OptionGroupNotFoundFault),
315    /// <p>Provisioned IOPS not available in the specified Availability Zone.</p>
316    ProvisionedIopsNotAvailableInAzFault(crate::types::error::ProvisionedIopsNotAvailableInAzFault),
317    /// <p>The request would result in the user exceeding the allowed amount of storage available across all DB instances.</p>
318    StorageQuotaExceededFault(crate::types::error::StorageQuotaExceededFault),
319    /// <p>The specified <code>StorageType</code> can't be associated with the DB instance.</p>
320    StorageTypeNotSupportedFault(crate::types::error::StorageTypeNotSupportedFault),
321    /// <p>You attempted to create more tenant databases than are permitted in your Amazon Web Services account.</p>
322    TenantDatabaseQuotaExceededFault(crate::types::error::TenantDatabaseQuotaExceededFault),
323    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
324    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
325    variable wildcard pattern and check `.code()`:
326     \
327    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
328     \
329    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-RestoreDBInstanceFromDBSnapshotError) for what information is available for the error.")]
330    Unhandled(crate::error::sealed_unhandled::Unhandled),
331}
332impl RestoreDBInstanceFromDBSnapshotError {
333    /// Creates the `RestoreDBInstanceFromDBSnapshotError::Unhandled` variant from any error type.
334    pub fn unhandled(
335        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
336    ) -> Self {
337        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
338            source: err.into(),
339            meta: ::std::default::Default::default(),
340        })
341    }
342
343    /// Creates the `RestoreDBInstanceFromDBSnapshotError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
344    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
345        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
346            source: err.clone().into(),
347            meta: err,
348        })
349    }
350    ///
351    /// Returns error metadata, which includes the error code, message,
352    /// request ID, and potentially additional information.
353    ///
354    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
355        match self {
356            Self::AuthorizationNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
357            Self::BackupPolicyNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
358            Self::CertificateNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
359            Self::DbClusterSnapshotNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
360            Self::DbInstanceAlreadyExistsFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
361            Self::DbParameterGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
362            Self::DbSecurityGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
363            Self::DbSnapshotNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
364            Self::DbSubnetGroupDoesNotCoverEnoughAZs(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
365            Self::DbSubnetGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
366            Self::DomainNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
367            Self::InstanceQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
368            Self::InsufficientDbInstanceCapacityFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
369            Self::InvalidDbSnapshotStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
370            Self::InvalidRestoreFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
371            Self::InvalidSubnet(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
372            Self::InvalidVpcNetworkStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
373            Self::KmsKeyNotAccessibleFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
374            Self::NetworkTypeNotSupported(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
375            Self::OptionGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
376            Self::ProvisionedIopsNotAvailableInAzFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
377            Self::StorageQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
378            Self::StorageTypeNotSupportedFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
379            Self::TenantDatabaseQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
380            Self::Unhandled(e) => &e.meta,
381        }
382    }
383    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::AuthorizationNotFoundFault`.
384    pub fn is_authorization_not_found_fault(&self) -> bool {
385        matches!(self, Self::AuthorizationNotFoundFault(_))
386    }
387    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::BackupPolicyNotFoundFault`.
388    pub fn is_backup_policy_not_found_fault(&self) -> bool {
389        matches!(self, Self::BackupPolicyNotFoundFault(_))
390    }
391    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::CertificateNotFoundFault`.
392    pub fn is_certificate_not_found_fault(&self) -> bool {
393        matches!(self, Self::CertificateNotFoundFault(_))
394    }
395    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::DbClusterSnapshotNotFoundFault`.
396    pub fn is_db_cluster_snapshot_not_found_fault(&self) -> bool {
397        matches!(self, Self::DbClusterSnapshotNotFoundFault(_))
398    }
399    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::DbInstanceAlreadyExistsFault`.
400    pub fn is_db_instance_already_exists_fault(&self) -> bool {
401        matches!(self, Self::DbInstanceAlreadyExistsFault(_))
402    }
403    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::DbParameterGroupNotFoundFault`.
404    pub fn is_db_parameter_group_not_found_fault(&self) -> bool {
405        matches!(self, Self::DbParameterGroupNotFoundFault(_))
406    }
407    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::DbSecurityGroupNotFoundFault`.
408    pub fn is_db_security_group_not_found_fault(&self) -> bool {
409        matches!(self, Self::DbSecurityGroupNotFoundFault(_))
410    }
411    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::DbSnapshotNotFoundFault`.
412    pub fn is_db_snapshot_not_found_fault(&self) -> bool {
413        matches!(self, Self::DbSnapshotNotFoundFault(_))
414    }
415    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::DbSubnetGroupDoesNotCoverEnoughAZs`.
416    pub fn is_db_subnet_group_does_not_cover_enough_azs(&self) -> bool {
417        matches!(self, Self::DbSubnetGroupDoesNotCoverEnoughAZs(_))
418    }
419    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::DbSubnetGroupNotFoundFault`.
420    pub fn is_db_subnet_group_not_found_fault(&self) -> bool {
421        matches!(self, Self::DbSubnetGroupNotFoundFault(_))
422    }
423    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::DomainNotFoundFault`.
424    pub fn is_domain_not_found_fault(&self) -> bool {
425        matches!(self, Self::DomainNotFoundFault(_))
426    }
427    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::InstanceQuotaExceededFault`.
428    pub fn is_instance_quota_exceeded_fault(&self) -> bool {
429        matches!(self, Self::InstanceQuotaExceededFault(_))
430    }
431    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::InsufficientDbInstanceCapacityFault`.
432    pub fn is_insufficient_db_instance_capacity_fault(&self) -> bool {
433        matches!(self, Self::InsufficientDbInstanceCapacityFault(_))
434    }
435    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::InvalidDbSnapshotStateFault`.
436    pub fn is_invalid_db_snapshot_state_fault(&self) -> bool {
437        matches!(self, Self::InvalidDbSnapshotStateFault(_))
438    }
439    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::InvalidRestoreFault`.
440    pub fn is_invalid_restore_fault(&self) -> bool {
441        matches!(self, Self::InvalidRestoreFault(_))
442    }
443    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::InvalidSubnet`.
444    pub fn is_invalid_subnet(&self) -> bool {
445        matches!(self, Self::InvalidSubnet(_))
446    }
447    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::InvalidVpcNetworkStateFault`.
448    pub fn is_invalid_vpc_network_state_fault(&self) -> bool {
449        matches!(self, Self::InvalidVpcNetworkStateFault(_))
450    }
451    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::KmsKeyNotAccessibleFault`.
452    pub fn is_kms_key_not_accessible_fault(&self) -> bool {
453        matches!(self, Self::KmsKeyNotAccessibleFault(_))
454    }
455    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::NetworkTypeNotSupported`.
456    pub fn is_network_type_not_supported(&self) -> bool {
457        matches!(self, Self::NetworkTypeNotSupported(_))
458    }
459    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::OptionGroupNotFoundFault`.
460    pub fn is_option_group_not_found_fault(&self) -> bool {
461        matches!(self, Self::OptionGroupNotFoundFault(_))
462    }
463    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::ProvisionedIopsNotAvailableInAzFault`.
464    pub fn is_provisioned_iops_not_available_in_az_fault(&self) -> bool {
465        matches!(self, Self::ProvisionedIopsNotAvailableInAzFault(_))
466    }
467    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::StorageQuotaExceededFault`.
468    pub fn is_storage_quota_exceeded_fault(&self) -> bool {
469        matches!(self, Self::StorageQuotaExceededFault(_))
470    }
471    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::StorageTypeNotSupportedFault`.
472    pub fn is_storage_type_not_supported_fault(&self) -> bool {
473        matches!(self, Self::StorageTypeNotSupportedFault(_))
474    }
475    /// Returns `true` if the error kind is `RestoreDBInstanceFromDBSnapshotError::TenantDatabaseQuotaExceededFault`.
476    pub fn is_tenant_database_quota_exceeded_fault(&self) -> bool {
477        matches!(self, Self::TenantDatabaseQuotaExceededFault(_))
478    }
479}
480impl ::std::error::Error for RestoreDBInstanceFromDBSnapshotError {
481    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
482        match self {
483            Self::AuthorizationNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
484            Self::BackupPolicyNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
485            Self::CertificateNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
486            Self::DbClusterSnapshotNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
487            Self::DbInstanceAlreadyExistsFault(_inner) => ::std::option::Option::Some(_inner),
488            Self::DbParameterGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
489            Self::DbSecurityGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
490            Self::DbSnapshotNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
491            Self::DbSubnetGroupDoesNotCoverEnoughAZs(_inner) => ::std::option::Option::Some(_inner),
492            Self::DbSubnetGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
493            Self::DomainNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
494            Self::InstanceQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
495            Self::InsufficientDbInstanceCapacityFault(_inner) => ::std::option::Option::Some(_inner),
496            Self::InvalidDbSnapshotStateFault(_inner) => ::std::option::Option::Some(_inner),
497            Self::InvalidRestoreFault(_inner) => ::std::option::Option::Some(_inner),
498            Self::InvalidSubnet(_inner) => ::std::option::Option::Some(_inner),
499            Self::InvalidVpcNetworkStateFault(_inner) => ::std::option::Option::Some(_inner),
500            Self::KmsKeyNotAccessibleFault(_inner) => ::std::option::Option::Some(_inner),
501            Self::NetworkTypeNotSupported(_inner) => ::std::option::Option::Some(_inner),
502            Self::OptionGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
503            Self::ProvisionedIopsNotAvailableInAzFault(_inner) => ::std::option::Option::Some(_inner),
504            Self::StorageQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
505            Self::StorageTypeNotSupportedFault(_inner) => ::std::option::Option::Some(_inner),
506            Self::TenantDatabaseQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
507            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
508        }
509    }
510}
511impl ::std::fmt::Display for RestoreDBInstanceFromDBSnapshotError {
512    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
513        match self {
514            Self::AuthorizationNotFoundFault(_inner) => _inner.fmt(f),
515            Self::BackupPolicyNotFoundFault(_inner) => _inner.fmt(f),
516            Self::CertificateNotFoundFault(_inner) => _inner.fmt(f),
517            Self::DbClusterSnapshotNotFoundFault(_inner) => _inner.fmt(f),
518            Self::DbInstanceAlreadyExistsFault(_inner) => _inner.fmt(f),
519            Self::DbParameterGroupNotFoundFault(_inner) => _inner.fmt(f),
520            Self::DbSecurityGroupNotFoundFault(_inner) => _inner.fmt(f),
521            Self::DbSnapshotNotFoundFault(_inner) => _inner.fmt(f),
522            Self::DbSubnetGroupDoesNotCoverEnoughAZs(_inner) => _inner.fmt(f),
523            Self::DbSubnetGroupNotFoundFault(_inner) => _inner.fmt(f),
524            Self::DomainNotFoundFault(_inner) => _inner.fmt(f),
525            Self::InstanceQuotaExceededFault(_inner) => _inner.fmt(f),
526            Self::InsufficientDbInstanceCapacityFault(_inner) => _inner.fmt(f),
527            Self::InvalidDbSnapshotStateFault(_inner) => _inner.fmt(f),
528            Self::InvalidRestoreFault(_inner) => _inner.fmt(f),
529            Self::InvalidSubnet(_inner) => _inner.fmt(f),
530            Self::InvalidVpcNetworkStateFault(_inner) => _inner.fmt(f),
531            Self::KmsKeyNotAccessibleFault(_inner) => _inner.fmt(f),
532            Self::NetworkTypeNotSupported(_inner) => _inner.fmt(f),
533            Self::OptionGroupNotFoundFault(_inner) => _inner.fmt(f),
534            Self::ProvisionedIopsNotAvailableInAzFault(_inner) => _inner.fmt(f),
535            Self::StorageQuotaExceededFault(_inner) => _inner.fmt(f),
536            Self::StorageTypeNotSupportedFault(_inner) => _inner.fmt(f),
537            Self::TenantDatabaseQuotaExceededFault(_inner) => _inner.fmt(f),
538            Self::Unhandled(_inner) => {
539                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
540                    write!(f, "unhandled error ({code})")
541                } else {
542                    f.write_str("unhandled error")
543                }
544            }
545        }
546    }
547}
548impl ::aws_smithy_types::retry::ProvideErrorKind for RestoreDBInstanceFromDBSnapshotError {
549    fn code(&self) -> ::std::option::Option<&str> {
550        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
551    }
552    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
553        ::std::option::Option::None
554    }
555}
556impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for RestoreDBInstanceFromDBSnapshotError {
557    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
558        match self {
559            Self::AuthorizationNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
560            Self::BackupPolicyNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
561            Self::CertificateNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
562            Self::DbClusterSnapshotNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
563            Self::DbInstanceAlreadyExistsFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
564            Self::DbParameterGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
565            Self::DbSecurityGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
566            Self::DbSnapshotNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
567            Self::DbSubnetGroupDoesNotCoverEnoughAZs(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
568            Self::DbSubnetGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
569            Self::DomainNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
570            Self::InstanceQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
571            Self::InsufficientDbInstanceCapacityFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
572            Self::InvalidDbSnapshotStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
573            Self::InvalidRestoreFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
574            Self::InvalidSubnet(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
575            Self::InvalidVpcNetworkStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
576            Self::KmsKeyNotAccessibleFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
577            Self::NetworkTypeNotSupported(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
578            Self::OptionGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
579            Self::ProvisionedIopsNotAvailableInAzFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
580            Self::StorageQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
581            Self::StorageTypeNotSupportedFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
582            Self::TenantDatabaseQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
583            Self::Unhandled(_inner) => &_inner.meta,
584        }
585    }
586}
587impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for RestoreDBInstanceFromDBSnapshotError {
588    fn create_unhandled_error(
589        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
590        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
591    ) -> Self {
592        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
593            source,
594            meta: meta.unwrap_or_default(),
595        })
596    }
597}
598impl ::aws_types::request_id::RequestId for crate::operation::restore_db_instance_from_db_snapshot::RestoreDBInstanceFromDBSnapshotError {
599    fn request_id(&self) -> Option<&str> {
600        self.meta().request_id()
601    }
602}
603
604pub use crate::operation::restore_db_instance_from_db_snapshot::_restore_db_instance_from_db_snapshot_output::RestoreDbInstanceFromDbSnapshotOutput;
605
606pub use crate::operation::restore_db_instance_from_db_snapshot::_restore_db_instance_from_db_snapshot_input::RestoreDbInstanceFromDbSnapshotInput;
607
608mod _restore_db_instance_from_db_snapshot_input;
609
610mod _restore_db_instance_from_db_snapshot_output;
611
612/// Builders
613pub mod builders;