Skip to main content

aws_sdk_rds/operation/
create_db_instance.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `CreateDBInstance`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateDBInstance;
6impl CreateDBInstance {
7    /// Creates a new `CreateDBInstance`
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_db_instance::CreateDbInstanceInput,
14    ) -> ::std::result::Result<
15        crate::operation::create_db_instance::CreateDbInstanceOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::create_db_instance::CreateDBInstanceError,
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_db_instance::CreateDBInstanceError>()
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_db_instance::CreateDbInstanceOutput>()
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_db_instance::CreateDbInstanceInput,
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", "CreateDBInstance", 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.CreateDBInstance",
59                "rpc.service" = "RDS",
60                "rpc.method" = "CreateDBInstance",
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 CreateDBInstance {
88    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateDBInstance");
90
91        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92            CreateDBInstanceRequestSerializer,
93        ));
94        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95            CreateDBInstanceResponseDeserializer,
96        ));
97
98        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99            crate::config::auth::Params::builder()
100                .operation_name("CreateDBInstance")
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("CreateDBInstance", "RDS"));
107        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
108        signing_options.double_uri_encode = true;
109        signing_options.content_sha256_header = false;
110        signing_options.normalize_uri_path = true;
111        signing_options.payload_override = None;
112
113        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
114            signing_options,
115            ..::std::default::Default::default()
116        });
117
118        ::std::option::Option::Some(cfg.freeze())
119    }
120
121    fn runtime_components(
122        &self,
123        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
124    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
125        #[allow(unused_mut)]
126        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateDBInstance")
127            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
128                CreateDBInstanceTelemetryInputCaptureInterceptor,
129            ))
130            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
131                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
132            ))
133            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
134                CreateDBInstanceEndpointParamsInterceptor,
135            ))
136            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
137                crate::operation::create_db_instance::CreateDBInstanceError,
138            >::new())
139            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
140                crate::operation::create_db_instance::CreateDBInstanceError,
141            >::new())
142            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
143                crate::operation::create_db_instance::CreateDBInstanceError,
144            >::new())
145            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
146                crate::operation::create_db_instance::CreateDBInstanceError,
147            >::new());
148
149        ::std::borrow::Cow::Owned(rcb)
150    }
151}
152
153#[derive(Debug)]
154struct CreateDBInstanceTelemetryInputCaptureInterceptor;
155
156#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
157impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateDBInstanceTelemetryInputCaptureInterceptor {
158    fn name(&self) -> &'static str {
159        "CreateDBInstanceTelemetryInputCaptureInterceptor"
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::<CreateDbInstanceInput>() 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("DBName") {
187            if let ::std::option::Option::Some(value) = input.db_name.as_deref() {
188                captured.insert("DBName", value);
189            }
190        }
191        if requested.should_capture("DBInstanceIdentifier") {
192            if let ::std::option::Option::Some(value) = input.db_instance_identifier.as_deref() {
193                captured.insert("DBInstanceIdentifier", value);
194            }
195        }
196        if requested.should_capture("DBInstanceClass") {
197            if let ::std::option::Option::Some(value) = input.db_instance_class.as_deref() {
198                captured.insert("DBInstanceClass", value);
199            }
200        }
201        if requested.should_capture("Engine") {
202            if let ::std::option::Option::Some(value) = input.engine.as_deref() {
203                captured.insert("Engine", value);
204            }
205        }
206        if requested.should_capture("MasterUsername") {
207            if let ::std::option::Option::Some(value) = input.master_username.as_deref() {
208                captured.insert("MasterUsername", value);
209            }
210        }
211        if requested.should_capture("AvailabilityZone") {
212            if let ::std::option::Option::Some(value) = input.availability_zone.as_deref() {
213                captured.insert("AvailabilityZone", value);
214            }
215        }
216        if requested.should_capture("DBSubnetGroupName") {
217            if let ::std::option::Option::Some(value) = input.db_subnet_group_name.as_deref() {
218                captured.insert("DBSubnetGroupName", value);
219            }
220        }
221        if requested.should_capture("PreferredMaintenanceWindow") {
222            if let ::std::option::Option::Some(value) = input.preferred_maintenance_window.as_deref() {
223                captured.insert("PreferredMaintenanceWindow", value);
224            }
225        }
226        if requested.should_capture("DBParameterGroupName") {
227            if let ::std::option::Option::Some(value) = input.db_parameter_group_name.as_deref() {
228                captured.insert("DBParameterGroupName", value);
229            }
230        }
231        if requested.should_capture("PreferredBackupWindow") {
232            if let ::std::option::Option::Some(value) = input.preferred_backup_window.as_deref() {
233                captured.insert("PreferredBackupWindow", value);
234            }
235        }
236        if requested.should_capture("EngineVersion") {
237            if let ::std::option::Option::Some(value) = input.engine_version.as_deref() {
238                captured.insert("EngineVersion", value);
239            }
240        }
241        if requested.should_capture("LicenseModel") {
242            if let ::std::option::Option::Some(value) = input.license_model.as_deref() {
243                captured.insert("LicenseModel", value);
244            }
245        }
246        if requested.should_capture("OptionGroupName") {
247            if let ::std::option::Option::Some(value) = input.option_group_name.as_deref() {
248                captured.insert("OptionGroupName", value);
249            }
250        }
251        if requested.should_capture("CharacterSetName") {
252            if let ::std::option::Option::Some(value) = input.character_set_name.as_deref() {
253                captured.insert("CharacterSetName", value);
254            }
255        }
256        if requested.should_capture("NcharCharacterSetName") {
257            if let ::std::option::Option::Some(value) = input.nchar_character_set_name.as_deref() {
258                captured.insert("NcharCharacterSetName", value);
259            }
260        }
261        if requested.should_capture("DBClusterIdentifier") {
262            if let ::std::option::Option::Some(value) = input.db_cluster_identifier.as_deref() {
263                captured.insert("DBClusterIdentifier", value);
264            }
265        }
266        if requested.should_capture("StorageType") {
267            if let ::std::option::Option::Some(value) = input.storage_type.as_deref() {
268                captured.insert("StorageType", value);
269            }
270        }
271        if requested.should_capture("TdeCredentialArn") {
272            if let ::std::option::Option::Some(value) = input.tde_credential_arn.as_deref() {
273                captured.insert("TdeCredentialArn", value);
274            }
275        }
276        if requested.should_capture("KmsKeyId") {
277            if let ::std::option::Option::Some(value) = input.kms_key_id.as_deref() {
278                captured.insert("KmsKeyId", value);
279            }
280        }
281        if requested.should_capture("Domain") {
282            if let ::std::option::Option::Some(value) = input.domain.as_deref() {
283                captured.insert("Domain", value);
284            }
285        }
286        if requested.should_capture("DomainFqdn") {
287            if let ::std::option::Option::Some(value) = input.domain_fqdn.as_deref() {
288                captured.insert("DomainFqdn", value);
289            }
290        }
291        if requested.should_capture("DomainOu") {
292            if let ::std::option::Option::Some(value) = input.domain_ou.as_deref() {
293                captured.insert("DomainOu", value);
294            }
295        }
296        if requested.should_capture("DomainAuthSecretArn") {
297            if let ::std::option::Option::Some(value) = input.domain_auth_secret_arn.as_deref() {
298                captured.insert("DomainAuthSecretArn", value);
299            }
300        }
301        if requested.should_capture("MonitoringRoleArn") {
302            if let ::std::option::Option::Some(value) = input.monitoring_role_arn.as_deref() {
303                captured.insert("MonitoringRoleArn", value);
304            }
305        }
306        if requested.should_capture("DomainIAMRoleName") {
307            if let ::std::option::Option::Some(value) = input.domain_iam_role_name.as_deref() {
308                captured.insert("DomainIAMRoleName", value);
309            }
310        }
311        if requested.should_capture("Timezone") {
312            if let ::std::option::Option::Some(value) = input.timezone.as_deref() {
313                captured.insert("Timezone", value);
314            }
315        }
316        if requested.should_capture("PerformanceInsightsKMSKeyId") {
317            if let ::std::option::Option::Some(value) = input.performance_insights_kms_key_id.as_deref() {
318                captured.insert("PerformanceInsightsKMSKeyId", value);
319            }
320        }
321        if requested.should_capture("NetworkType") {
322            if let ::std::option::Option::Some(value) = input.network_type.as_deref() {
323                captured.insert("NetworkType", value);
324            }
325        }
326        if requested.should_capture("BackupTarget") {
327            if let ::std::option::Option::Some(value) = input.backup_target.as_deref() {
328                captured.insert("BackupTarget", value);
329            }
330        }
331        if requested.should_capture("CustomIamInstanceProfile") {
332            if let ::std::option::Option::Some(value) = input.custom_iam_instance_profile.as_deref() {
333                captured.insert("CustomIamInstanceProfile", value);
334            }
335        }
336        if requested.should_capture("DBSystemId") {
337            if let ::std::option::Option::Some(value) = input.db_system_id.as_deref() {
338                captured.insert("DBSystemId", value);
339            }
340        }
341        if requested.should_capture("CACertificateIdentifier") {
342            if let ::std::option::Option::Some(value) = input.ca_certificate_identifier.as_deref() {
343                captured.insert("CACertificateIdentifier", value);
344            }
345        }
346        if requested.should_capture("MasterUserSecretKmsKeyId") {
347            if let ::std::option::Option::Some(value) = input.master_user_secret_kms_key_id.as_deref() {
348                captured.insert("MasterUserSecretKmsKeyId", value);
349            }
350        }
351        if requested.should_capture("EngineLifecycleSupport") {
352            if let ::std::option::Option::Some(value) = input.engine_lifecycle_support.as_deref() {
353                captured.insert("EngineLifecycleSupport", value);
354            }
355        }
356
357        cfg.interceptor_state().store_put(captured);
358        ::std::result::Result::Ok(())
359    }
360}
361#[derive(Debug)]
362struct CreateDBInstanceResponseDeserializer;
363impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateDBInstanceResponseDeserializer {
364    fn deserialize_nonstreaming_with_config(
365        &self,
366        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
367        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
368    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
369        let (success, status) = (response.status().is_success(), response.status().as_u16());
370        let headers = response.headers();
371        let body = response.body().bytes().expect("body loaded");
372        #[allow(unused_mut)]
373        let mut force_error = false;
374        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
375        let parse_result = if !success && status != 200 || force_error {
376            crate::protocol_serde::shape_create_db_instance::de_create_db_instance_http_error(status, headers, body)
377        } else {
378            crate::protocol_serde::shape_create_db_instance::de_create_db_instance_http_response(status, headers, body)
379        };
380        crate::protocol_serde::type_erase_result(parse_result)
381    }
382}
383#[derive(Debug)]
384struct CreateDBInstanceRequestSerializer;
385impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateDBInstanceRequestSerializer {
386    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
387    fn serialize_input(
388        &self,
389        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
390        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
391    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
392        let input = input
393            .downcast::<crate::operation::create_db_instance::CreateDbInstanceInput>()
394            .expect("correct type");
395        let _header_serialization_settings = _cfg
396            .load::<crate::serialization_settings::HeaderSerializationSettings>()
397            .cloned()
398            .unwrap_or_default();
399        let mut request_builder = {
400            #[allow(clippy::uninlined_format_args)]
401            fn uri_base(
402                _input: &crate::operation::create_db_instance::CreateDbInstanceInput,
403                output: &mut ::std::string::String,
404            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
405                use ::std::fmt::Write as _;
406                ::std::write!(output, "/").expect("formatting should succeed");
407                ::std::result::Result::Ok(())
408            }
409            #[allow(clippy::unnecessary_wraps)]
410            fn update_http_builder(
411                input: &crate::operation::create_db_instance::CreateDbInstanceInput,
412                builder: ::http_1x::request::Builder,
413            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
414                let mut uri = ::std::string::String::new();
415                uri_base(input, &mut uri)?;
416                ::std::result::Result::Ok(builder.method("POST").uri(uri))
417            }
418            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
419            builder =
420                _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-www-form-urlencoded");
421            builder
422        };
423        let body = ::aws_smithy_types::body::SdkBody::from(
424            crate::protocol_serde::shape_create_db_instance_input::ser_create_db_instance_input_input_input(&input)?,
425        );
426        if let Some(content_length) = body.content_length() {
427            let content_length = content_length.to_string();
428            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
429        }
430        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
431    }
432}
433#[derive(Debug)]
434struct CreateDBInstanceEndpointParamsInterceptor;
435
436#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
437impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateDBInstanceEndpointParamsInterceptor {
438    fn name(&self) -> &'static str {
439        "CreateDBInstanceEndpointParamsInterceptor"
440    }
441
442    fn read_before_execution(
443        &self,
444        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
445            '_,
446            ::aws_smithy_runtime_api::client::interceptors::context::Input,
447            ::aws_smithy_runtime_api::client::interceptors::context::Output,
448            ::aws_smithy_runtime_api::client::interceptors::context::Error,
449        >,
450        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
451    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
452        let _input = context
453            .input()
454            .downcast_ref::<CreateDbInstanceInput>()
455            .ok_or("failed to downcast to CreateDbInstanceInput")?;
456
457        let params = crate::config::endpoint::Params::builder()
458            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
459            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
460            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
461            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
462            .build()
463            .map_err(|err| {
464                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
465            })?;
466        cfg.interceptor_state()
467            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
468        ::std::result::Result::Ok(())
469    }
470}
471
472// The get_* functions below are generated from JMESPath expressions in the
473// operationContextParams trait. They target the operation's input shape.
474
475/// Error type for the `CreateDBInstanceError` operation.
476#[non_exhaustive]
477#[derive(::std::fmt::Debug)]
478pub enum CreateDBInstanceError {
479    /// <p>The specified CIDR IP range or Amazon EC2 security group might not be authorized for the specified DB security group.</p>
480    /// <p>Or, RDS might not be authorized to perform necessary actions using IAM on your behalf.</p>
481    AuthorizationNotFoundFault(crate::types::error::AuthorizationNotFoundFault),
482    /// <p></p>
483    #[deprecated(note = "Please avoid using this fault")]
484    BackupPolicyNotFoundFault(crate::types::error::BackupPolicyNotFoundFault),
485    /// <p><code>CertificateIdentifier</code> doesn't refer to an existing certificate.</p>
486    CertificateNotFoundFault(crate::types::error::CertificateNotFoundFault),
487    /// <p><code>DBClusterIdentifier</code> doesn't refer to an existing DB cluster.</p>
488    DbClusterNotFoundFault(crate::types::error::DbClusterNotFoundFault),
489    /// <p>The user already has a DB instance with the given identifier.</p>
490    DbInstanceAlreadyExistsFault(crate::types::error::DbInstanceAlreadyExistsFault),
491    /// <p><code>DBParameterGroupName</code> doesn't refer to an existing DB parameter group.</p>
492    DbParameterGroupNotFoundFault(crate::types::error::DbParameterGroupNotFoundFault),
493    /// <p><code>DBSecurityGroupName</code> doesn't refer to an existing DB security group.</p>
494    DbSecurityGroupNotFoundFault(crate::types::error::DbSecurityGroupNotFoundFault),
495    /// <p>Subnets in the DB subnet group should cover at least two Availability Zones unless there is only one Availability Zone.</p>
496    DbSubnetGroupDoesNotCoverEnoughAZs(crate::types::error::DbSubnetGroupDoesNotCoverEnoughAZs),
497    /// <p><code>DBSubnetGroupName</code> doesn't refer to an existing DB subnet group.</p>
498    DbSubnetGroupNotFoundFault(crate::types::error::DbSubnetGroupNotFoundFault),
499    /// <p><code>Domain</code> doesn't refer to an existing Active Directory domain.</p>
500    DomainNotFoundFault(crate::types::error::DomainNotFoundFault),
501    /// <p>The request would result in the user exceeding the allowed number of DB instances.</p>
502    InstanceQuotaExceededFault(crate::types::error::InstanceQuotaExceededFault),
503    /// <p>The specified DB instance class isn't available in the specified Availability Zone.</p>
504    InsufficientDbInstanceCapacityFault(crate::types::error::InsufficientDbInstanceCapacityFault),
505    /// <p>The requested operation can't be performed while the cluster is in this state.</p>
506    InvalidDbClusterStateFault(crate::types::error::InvalidDbClusterStateFault),
507    /// <p>The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.</p>
508    InvalidSubnet(crate::types::error::InvalidSubnet),
509    /// <p>The DB subnet group doesn't cover all Availability Zones after it's created because of users' change.</p>
510    InvalidVpcNetworkStateFault(crate::types::error::InvalidVpcNetworkStateFault),
511    /// <p>An error occurred accessing an Amazon Web Services KMS key.</p>
512    KmsKeyNotAccessibleFault(crate::types::error::KmsKeyNotAccessibleFault),
513    /// <p>The network type is invalid for the DB instance. Valid nework type values are <code>IPV4</code> and <code>DUAL</code>.</p>
514    NetworkTypeNotSupported(crate::types::error::NetworkTypeNotSupported),
515    /// <p>The specified option group could not be found.</p>
516    OptionGroupNotFoundFault(crate::types::error::OptionGroupNotFoundFault),
517    /// <p>Provisioned IOPS not available in the specified Availability Zone.</p>
518    ProvisionedIopsNotAvailableInAzFault(crate::types::error::ProvisionedIopsNotAvailableInAzFault),
519    /// <p>The request would result in the user exceeding the allowed amount of storage available across all DB instances.</p>
520    StorageQuotaExceededFault(crate::types::error::StorageQuotaExceededFault),
521    /// <p>The specified <code>StorageType</code> can't be associated with the DB instance.</p>
522    StorageTypeNotSupportedFault(crate::types::error::StorageTypeNotSupportedFault),
523    /// <p>You attempted to create more tenant databases than are permitted in your Amazon Web Services account.</p>
524    TenantDatabaseQuotaExceededFault(crate::types::error::TenantDatabaseQuotaExceededFault),
525    /// <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>
526    VpcEncryptionControlViolationException(crate::types::error::VpcEncryptionControlViolationException),
527    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
528    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
529    variable wildcard pattern and check `.code()`:
530     \
531    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
532     \
533    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateDBInstanceError) for what information is available for the error.")]
534    Unhandled(crate::error::sealed_unhandled::Unhandled),
535}
536impl CreateDBInstanceError {
537    /// Creates the `CreateDBInstanceError::Unhandled` variant from any error type.
538    pub fn unhandled(
539        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
540    ) -> Self {
541        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
542            source: err.into(),
543            meta: ::std::default::Default::default(),
544        })
545    }
546
547    /// Creates the `CreateDBInstanceError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
548    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
549        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
550            source: err.clone().into(),
551            meta: err,
552        })
553    }
554    ///
555    /// Returns error metadata, which includes the error code, message,
556    /// request ID, and potentially additional information.
557    ///
558    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
559        match self {
560            Self::AuthorizationNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
561            Self::BackupPolicyNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
562            Self::CertificateNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
563            Self::DbClusterNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
564            Self::DbInstanceAlreadyExistsFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
565            Self::DbParameterGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
566            Self::DbSecurityGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
567            Self::DbSubnetGroupDoesNotCoverEnoughAZs(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
568            Self::DbSubnetGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
569            Self::DomainNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
570            Self::InstanceQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
571            Self::InsufficientDbInstanceCapacityFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
572            Self::InvalidDbClusterStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
573            Self::InvalidSubnet(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
574            Self::InvalidVpcNetworkStateFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
575            Self::KmsKeyNotAccessibleFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
576            Self::NetworkTypeNotSupported(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
577            Self::OptionGroupNotFoundFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
578            Self::ProvisionedIopsNotAvailableInAzFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
579            Self::StorageQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
580            Self::StorageTypeNotSupportedFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
581            Self::TenantDatabaseQuotaExceededFault(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
582            Self::VpcEncryptionControlViolationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
583            Self::Unhandled(e) => &e.meta,
584        }
585    }
586    /// Returns `true` if the error kind is `CreateDBInstanceError::AuthorizationNotFoundFault`.
587    pub fn is_authorization_not_found_fault(&self) -> bool {
588        matches!(self, Self::AuthorizationNotFoundFault(_))
589    }
590    /// Returns `true` if the error kind is `CreateDBInstanceError::BackupPolicyNotFoundFault`.
591    pub fn is_backup_policy_not_found_fault(&self) -> bool {
592        matches!(self, Self::BackupPolicyNotFoundFault(_))
593    }
594    /// Returns `true` if the error kind is `CreateDBInstanceError::CertificateNotFoundFault`.
595    pub fn is_certificate_not_found_fault(&self) -> bool {
596        matches!(self, Self::CertificateNotFoundFault(_))
597    }
598    /// Returns `true` if the error kind is `CreateDBInstanceError::DbClusterNotFoundFault`.
599    pub fn is_db_cluster_not_found_fault(&self) -> bool {
600        matches!(self, Self::DbClusterNotFoundFault(_))
601    }
602    /// Returns `true` if the error kind is `CreateDBInstanceError::DbInstanceAlreadyExistsFault`.
603    pub fn is_db_instance_already_exists_fault(&self) -> bool {
604        matches!(self, Self::DbInstanceAlreadyExistsFault(_))
605    }
606    /// Returns `true` if the error kind is `CreateDBInstanceError::DbParameterGroupNotFoundFault`.
607    pub fn is_db_parameter_group_not_found_fault(&self) -> bool {
608        matches!(self, Self::DbParameterGroupNotFoundFault(_))
609    }
610    /// Returns `true` if the error kind is `CreateDBInstanceError::DbSecurityGroupNotFoundFault`.
611    pub fn is_db_security_group_not_found_fault(&self) -> bool {
612        matches!(self, Self::DbSecurityGroupNotFoundFault(_))
613    }
614    /// Returns `true` if the error kind is `CreateDBInstanceError::DbSubnetGroupDoesNotCoverEnoughAZs`.
615    pub fn is_db_subnet_group_does_not_cover_enough_azs(&self) -> bool {
616        matches!(self, Self::DbSubnetGroupDoesNotCoverEnoughAZs(_))
617    }
618    /// Returns `true` if the error kind is `CreateDBInstanceError::DbSubnetGroupNotFoundFault`.
619    pub fn is_db_subnet_group_not_found_fault(&self) -> bool {
620        matches!(self, Self::DbSubnetGroupNotFoundFault(_))
621    }
622    /// Returns `true` if the error kind is `CreateDBInstanceError::DomainNotFoundFault`.
623    pub fn is_domain_not_found_fault(&self) -> bool {
624        matches!(self, Self::DomainNotFoundFault(_))
625    }
626    /// Returns `true` if the error kind is `CreateDBInstanceError::InstanceQuotaExceededFault`.
627    pub fn is_instance_quota_exceeded_fault(&self) -> bool {
628        matches!(self, Self::InstanceQuotaExceededFault(_))
629    }
630    /// Returns `true` if the error kind is `CreateDBInstanceError::InsufficientDbInstanceCapacityFault`.
631    pub fn is_insufficient_db_instance_capacity_fault(&self) -> bool {
632        matches!(self, Self::InsufficientDbInstanceCapacityFault(_))
633    }
634    /// Returns `true` if the error kind is `CreateDBInstanceError::InvalidDbClusterStateFault`.
635    pub fn is_invalid_db_cluster_state_fault(&self) -> bool {
636        matches!(self, Self::InvalidDbClusterStateFault(_))
637    }
638    /// Returns `true` if the error kind is `CreateDBInstanceError::InvalidSubnet`.
639    pub fn is_invalid_subnet(&self) -> bool {
640        matches!(self, Self::InvalidSubnet(_))
641    }
642    /// Returns `true` if the error kind is `CreateDBInstanceError::InvalidVpcNetworkStateFault`.
643    pub fn is_invalid_vpc_network_state_fault(&self) -> bool {
644        matches!(self, Self::InvalidVpcNetworkStateFault(_))
645    }
646    /// Returns `true` if the error kind is `CreateDBInstanceError::KmsKeyNotAccessibleFault`.
647    pub fn is_kms_key_not_accessible_fault(&self) -> bool {
648        matches!(self, Self::KmsKeyNotAccessibleFault(_))
649    }
650    /// Returns `true` if the error kind is `CreateDBInstanceError::NetworkTypeNotSupported`.
651    pub fn is_network_type_not_supported(&self) -> bool {
652        matches!(self, Self::NetworkTypeNotSupported(_))
653    }
654    /// Returns `true` if the error kind is `CreateDBInstanceError::OptionGroupNotFoundFault`.
655    pub fn is_option_group_not_found_fault(&self) -> bool {
656        matches!(self, Self::OptionGroupNotFoundFault(_))
657    }
658    /// Returns `true` if the error kind is `CreateDBInstanceError::ProvisionedIopsNotAvailableInAzFault`.
659    pub fn is_provisioned_iops_not_available_in_az_fault(&self) -> bool {
660        matches!(self, Self::ProvisionedIopsNotAvailableInAzFault(_))
661    }
662    /// Returns `true` if the error kind is `CreateDBInstanceError::StorageQuotaExceededFault`.
663    pub fn is_storage_quota_exceeded_fault(&self) -> bool {
664        matches!(self, Self::StorageQuotaExceededFault(_))
665    }
666    /// Returns `true` if the error kind is `CreateDBInstanceError::StorageTypeNotSupportedFault`.
667    pub fn is_storage_type_not_supported_fault(&self) -> bool {
668        matches!(self, Self::StorageTypeNotSupportedFault(_))
669    }
670    /// Returns `true` if the error kind is `CreateDBInstanceError::TenantDatabaseQuotaExceededFault`.
671    pub fn is_tenant_database_quota_exceeded_fault(&self) -> bool {
672        matches!(self, Self::TenantDatabaseQuotaExceededFault(_))
673    }
674    /// Returns `true` if the error kind is `CreateDBInstanceError::VpcEncryptionControlViolationException`.
675    pub fn is_vpc_encryption_control_violation_exception(&self) -> bool {
676        matches!(self, Self::VpcEncryptionControlViolationException(_))
677    }
678}
679impl ::std::error::Error for CreateDBInstanceError {
680    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
681        match self {
682            Self::AuthorizationNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
683            Self::BackupPolicyNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
684            Self::CertificateNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
685            Self::DbClusterNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
686            Self::DbInstanceAlreadyExistsFault(_inner) => ::std::option::Option::Some(_inner),
687            Self::DbParameterGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
688            Self::DbSecurityGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
689            Self::DbSubnetGroupDoesNotCoverEnoughAZs(_inner) => ::std::option::Option::Some(_inner),
690            Self::DbSubnetGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
691            Self::DomainNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
692            Self::InstanceQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
693            Self::InsufficientDbInstanceCapacityFault(_inner) => ::std::option::Option::Some(_inner),
694            Self::InvalidDbClusterStateFault(_inner) => ::std::option::Option::Some(_inner),
695            Self::InvalidSubnet(_inner) => ::std::option::Option::Some(_inner),
696            Self::InvalidVpcNetworkStateFault(_inner) => ::std::option::Option::Some(_inner),
697            Self::KmsKeyNotAccessibleFault(_inner) => ::std::option::Option::Some(_inner),
698            Self::NetworkTypeNotSupported(_inner) => ::std::option::Option::Some(_inner),
699            Self::OptionGroupNotFoundFault(_inner) => ::std::option::Option::Some(_inner),
700            Self::ProvisionedIopsNotAvailableInAzFault(_inner) => ::std::option::Option::Some(_inner),
701            Self::StorageQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
702            Self::StorageTypeNotSupportedFault(_inner) => ::std::option::Option::Some(_inner),
703            Self::TenantDatabaseQuotaExceededFault(_inner) => ::std::option::Option::Some(_inner),
704            Self::VpcEncryptionControlViolationException(_inner) => ::std::option::Option::Some(_inner),
705            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
706        }
707    }
708}
709impl ::std::fmt::Display for CreateDBInstanceError {
710    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
711        match self {
712            Self::AuthorizationNotFoundFault(_inner) => _inner.fmt(f),
713            Self::BackupPolicyNotFoundFault(_inner) => _inner.fmt(f),
714            Self::CertificateNotFoundFault(_inner) => _inner.fmt(f),
715            Self::DbClusterNotFoundFault(_inner) => _inner.fmt(f),
716            Self::DbInstanceAlreadyExistsFault(_inner) => _inner.fmt(f),
717            Self::DbParameterGroupNotFoundFault(_inner) => _inner.fmt(f),
718            Self::DbSecurityGroupNotFoundFault(_inner) => _inner.fmt(f),
719            Self::DbSubnetGroupDoesNotCoverEnoughAZs(_inner) => _inner.fmt(f),
720            Self::DbSubnetGroupNotFoundFault(_inner) => _inner.fmt(f),
721            Self::DomainNotFoundFault(_inner) => _inner.fmt(f),
722            Self::InstanceQuotaExceededFault(_inner) => _inner.fmt(f),
723            Self::InsufficientDbInstanceCapacityFault(_inner) => _inner.fmt(f),
724            Self::InvalidDbClusterStateFault(_inner) => _inner.fmt(f),
725            Self::InvalidSubnet(_inner) => _inner.fmt(f),
726            Self::InvalidVpcNetworkStateFault(_inner) => _inner.fmt(f),
727            Self::KmsKeyNotAccessibleFault(_inner) => _inner.fmt(f),
728            Self::NetworkTypeNotSupported(_inner) => _inner.fmt(f),
729            Self::OptionGroupNotFoundFault(_inner) => _inner.fmt(f),
730            Self::ProvisionedIopsNotAvailableInAzFault(_inner) => _inner.fmt(f),
731            Self::StorageQuotaExceededFault(_inner) => _inner.fmt(f),
732            Self::StorageTypeNotSupportedFault(_inner) => _inner.fmt(f),
733            Self::TenantDatabaseQuotaExceededFault(_inner) => _inner.fmt(f),
734            Self::VpcEncryptionControlViolationException(_inner) => _inner.fmt(f),
735            Self::Unhandled(_inner) => {
736                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
737                    write!(f, "unhandled error ({code})")
738                } else {
739                    f.write_str("unhandled error")
740                }
741            }
742        }
743    }
744}
745impl ::aws_smithy_types::retry::ProvideErrorKind for CreateDBInstanceError {
746    fn code(&self) -> ::std::option::Option<&str> {
747        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
748    }
749    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
750        ::std::option::Option::None
751    }
752}
753impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateDBInstanceError {
754    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
755        match self {
756            Self::AuthorizationNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
757            Self::BackupPolicyNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
758            Self::CertificateNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
759            Self::DbClusterNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
760            Self::DbInstanceAlreadyExistsFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
761            Self::DbParameterGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
762            Self::DbSecurityGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
763            Self::DbSubnetGroupDoesNotCoverEnoughAZs(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
764            Self::DbSubnetGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
765            Self::DomainNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
766            Self::InstanceQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
767            Self::InsufficientDbInstanceCapacityFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
768            Self::InvalidDbClusterStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
769            Self::InvalidSubnet(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
770            Self::InvalidVpcNetworkStateFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
771            Self::KmsKeyNotAccessibleFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
772            Self::NetworkTypeNotSupported(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
773            Self::OptionGroupNotFoundFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
774            Self::ProvisionedIopsNotAvailableInAzFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
775            Self::StorageQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
776            Self::StorageTypeNotSupportedFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
777            Self::TenantDatabaseQuotaExceededFault(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
778            Self::VpcEncryptionControlViolationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
779            Self::Unhandled(_inner) => &_inner.meta,
780        }
781    }
782}
783impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateDBInstanceError {
784    fn create_unhandled_error(
785        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
786        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
787    ) -> Self {
788        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
789            source,
790            meta: meta.unwrap_or_default(),
791        })
792    }
793}
794impl ::aws_types::request_id::RequestId for crate::operation::create_db_instance::CreateDBInstanceError {
795    fn request_id(&self) -> Option<&str> {
796        self.meta().request_id()
797    }
798}
799
800pub use crate::operation::create_db_instance::_create_db_instance_input::CreateDbInstanceInput;
801
802pub use crate::operation::create_db_instance::_create_db_instance_output::CreateDbInstanceOutput;
803
804mod _create_db_instance_input;
805
806mod _create_db_instance_output;
807
808/// Builders
809pub mod builders;