aws_sdk_rds/operation/delete_db_instance/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::delete_db_instance::_delete_db_instance_output::DeleteDbInstanceOutputBuilder;
3
4pub use crate::operation::delete_db_instance::_delete_db_instance_input::DeleteDbInstanceInputBuilder;
5
6impl crate::operation::delete_db_instance::builders::DeleteDbInstanceInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::delete_db_instance::DeleteDbInstanceOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::delete_db_instance::DeleteDBInstanceError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.delete_db_instance();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DeleteDBInstance`.
24///
25/// <p>Deletes a previously provisioned DB instance. When you delete a DB instance, all automated backups for that instance are deleted and can't be recovered. However, manual DB snapshots of the DB instance aren't deleted.</p>
26/// <p>If you request a final DB snapshot, the status of the Amazon RDS DB instance is <code>deleting</code> until the DB snapshot is created. This operation can't be canceled or reverted after it begins. To monitor the status of this operation, use <code>DescribeDBInstance</code>.</p>
27/// <p>When a DB instance is in a failure state and has a status of <code>failed</code>, <code>incompatible-restore</code>, or <code>incompatible-network</code>, you can only delete it when you skip creation of the final snapshot with the <code>SkipFinalSnapshot</code> parameter.</p>
28/// <p>If the specified DB instance is part of an Amazon Aurora DB cluster, you can't delete the DB instance if both of the following conditions are true:</p>
29/// <ul>
30/// <li>
31/// <p>The DB cluster is a read replica of another Amazon Aurora DB cluster.</p></li>
32/// <li>
33/// <p>The DB instance is the only instance in the DB cluster.</p></li>
34/// </ul>
35/// <p>To delete a DB instance in this case, first use the <code>PromoteReadReplicaDBCluster</code> operation to promote the DB cluster so that it's no longer a read replica. After the promotion completes, use the <code>DeleteDBInstance</code> operation to delete the final instance in the DB cluster.</p><important>
36/// <p>For RDS Custom DB instances, deleting the DB instance permanently deletes the EC2 instance and the associated EBS volumes. Make sure that you don't terminate or delete these resources before you delete the DB instance. Otherwise, deleting the DB instance and creation of the final snapshot might fail.</p>
37/// </important>
38#[derive(::std::clone::Clone, ::std::fmt::Debug)]
39pub struct DeleteDBInstanceFluentBuilder {
40    handle: ::std::sync::Arc<crate::client::Handle>,
41    inner: crate::operation::delete_db_instance::builders::DeleteDbInstanceInputBuilder,
42    config_override: ::std::option::Option<crate::config::Builder>,
43}
44impl
45    crate::client::customize::internal::CustomizableSend<
46        crate::operation::delete_db_instance::DeleteDbInstanceOutput,
47        crate::operation::delete_db_instance::DeleteDBInstanceError,
48    > for DeleteDBInstanceFluentBuilder
49{
50    fn send(
51        self,
52        config_override: crate::config::Builder,
53    ) -> crate::client::customize::internal::BoxFuture<
54        crate::client::customize::internal::SendResult<
55            crate::operation::delete_db_instance::DeleteDbInstanceOutput,
56            crate::operation::delete_db_instance::DeleteDBInstanceError,
57        >,
58    > {
59        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
60    }
61}
62impl DeleteDBInstanceFluentBuilder {
63    /// Creates a new `DeleteDBInstanceFluentBuilder`.
64    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
65        Self {
66            handle,
67            inner: ::std::default::Default::default(),
68            config_override: ::std::option::Option::None,
69        }
70    }
71    /// Access the DeleteDBInstance as a reference.
72    pub fn as_input(&self) -> &crate::operation::delete_db_instance::builders::DeleteDbInstanceInputBuilder {
73        &self.inner
74    }
75    /// Sends the request and returns the response.
76    ///
77    /// If an error occurs, an `SdkError` will be returned with additional details that
78    /// can be matched against.
79    ///
80    /// By default, any retryable failures will be retried twice. Retry behavior
81    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
82    /// set when configuring the client.
83    pub async fn send(
84        self,
85    ) -> ::std::result::Result<
86        crate::operation::delete_db_instance::DeleteDbInstanceOutput,
87        ::aws_smithy_runtime_api::client::result::SdkError<
88            crate::operation::delete_db_instance::DeleteDBInstanceError,
89            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
90        >,
91    > {
92        let input = self
93            .inner
94            .build()
95            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
96        let runtime_plugins = crate::operation::delete_db_instance::DeleteDBInstance::operation_runtime_plugins(
97            self.handle.runtime_plugins.clone(),
98            &self.handle.conf,
99            self.config_override,
100        );
101        crate::operation::delete_db_instance::DeleteDBInstance::orchestrate(&runtime_plugins, input).await
102    }
103
104    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
105    pub fn customize(
106        self,
107    ) -> crate::client::customize::CustomizableOperation<
108        crate::operation::delete_db_instance::DeleteDbInstanceOutput,
109        crate::operation::delete_db_instance::DeleteDBInstanceError,
110        Self,
111    > {
112        crate::client::customize::CustomizableOperation::new(self)
113    }
114    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
115        self.set_config_override(::std::option::Option::Some(config_override.into()));
116        self
117    }
118
119    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
120        self.config_override = config_override;
121        self
122    }
123    /// <p>The DB instance identifier for the DB instance to be deleted. This parameter isn't case-sensitive.</p>
124    /// <p>Constraints:</p>
125    /// <ul>
126    /// <li>
127    /// <p>Must match the name of an existing DB instance.</p></li>
128    /// </ul>
129    pub fn db_instance_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.db_instance_identifier(input.into());
131        self
132    }
133    /// <p>The DB instance identifier for the DB instance to be deleted. This parameter isn't case-sensitive.</p>
134    /// <p>Constraints:</p>
135    /// <ul>
136    /// <li>
137    /// <p>Must match the name of an existing DB instance.</p></li>
138    /// </ul>
139    pub fn set_db_instance_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_db_instance_identifier(input);
141        self
142    }
143    /// <p>The DB instance identifier for the DB instance to be deleted. This parameter isn't case-sensitive.</p>
144    /// <p>Constraints:</p>
145    /// <ul>
146    /// <li>
147    /// <p>Must match the name of an existing DB instance.</p></li>
148    /// </ul>
149    pub fn get_db_instance_identifier(&self) -> &::std::option::Option<::std::string::String> {
150        self.inner.get_db_instance_identifier()
151    }
152    /// <p>Specifies whether to skip the creation of a final DB snapshot before deleting the instance. If you enable this parameter, RDS doesn't create a DB snapshot. If you don't enable this parameter, RDS creates a DB snapshot before the DB instance is deleted. By default, skip isn't enabled, and the DB snapshot is created.</p><note>
153    /// <p>If you don't enable this parameter, you must specify the <code>FinalDBSnapshotIdentifier</code> parameter.</p>
154    /// </note>
155    /// <p>When a DB instance is in a failure state and has a status of <code>failed</code>, <code>incompatible-restore</code>, or <code>incompatible-network</code>, RDS can delete the instance only if you enable this parameter.</p>
156    /// <p>If you delete a read replica or an RDS Custom instance, you must enable this setting.</p>
157    /// <p>This setting is required for RDS Custom.</p>
158    pub fn skip_final_snapshot(mut self, input: bool) -> Self {
159        self.inner = self.inner.skip_final_snapshot(input);
160        self
161    }
162    /// <p>Specifies whether to skip the creation of a final DB snapshot before deleting the instance. If you enable this parameter, RDS doesn't create a DB snapshot. If you don't enable this parameter, RDS creates a DB snapshot before the DB instance is deleted. By default, skip isn't enabled, and the DB snapshot is created.</p><note>
163    /// <p>If you don't enable this parameter, you must specify the <code>FinalDBSnapshotIdentifier</code> parameter.</p>
164    /// </note>
165    /// <p>When a DB instance is in a failure state and has a status of <code>failed</code>, <code>incompatible-restore</code>, or <code>incompatible-network</code>, RDS can delete the instance only if you enable this parameter.</p>
166    /// <p>If you delete a read replica or an RDS Custom instance, you must enable this setting.</p>
167    /// <p>This setting is required for RDS Custom.</p>
168    pub fn set_skip_final_snapshot(mut self, input: ::std::option::Option<bool>) -> Self {
169        self.inner = self.inner.set_skip_final_snapshot(input);
170        self
171    }
172    /// <p>Specifies whether to skip the creation of a final DB snapshot before deleting the instance. If you enable this parameter, RDS doesn't create a DB snapshot. If you don't enable this parameter, RDS creates a DB snapshot before the DB instance is deleted. By default, skip isn't enabled, and the DB snapshot is created.</p><note>
173    /// <p>If you don't enable this parameter, you must specify the <code>FinalDBSnapshotIdentifier</code> parameter.</p>
174    /// </note>
175    /// <p>When a DB instance is in a failure state and has a status of <code>failed</code>, <code>incompatible-restore</code>, or <code>incompatible-network</code>, RDS can delete the instance only if you enable this parameter.</p>
176    /// <p>If you delete a read replica or an RDS Custom instance, you must enable this setting.</p>
177    /// <p>This setting is required for RDS Custom.</p>
178    pub fn get_skip_final_snapshot(&self) -> &::std::option::Option<bool> {
179        self.inner.get_skip_final_snapshot()
180    }
181    /// <p>The <code>DBSnapshotIdentifier</code> of the new <code>DBSnapshot</code> created when the <code>SkipFinalSnapshot</code> parameter is disabled.</p><note>
182    /// <p>If you enable this parameter and also enable SkipFinalShapshot, the command results in an error.</p>
183    /// </note>
184    /// <p>This setting doesn't apply to RDS Custom.</p>
185    /// <p>Constraints:</p>
186    /// <ul>
187    /// <li>
188    /// <p>Must be 1 to 255 letters or numbers.</p></li>
189    /// <li>
190    /// <p>First character must be a letter.</p></li>
191    /// <li>
192    /// <p>Can't end with a hyphen or contain two consecutive hyphens.</p></li>
193    /// <li>
194    /// <p>Can't be specified when deleting a read replica.</p></li>
195    /// </ul>
196    pub fn final_db_snapshot_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
197        self.inner = self.inner.final_db_snapshot_identifier(input.into());
198        self
199    }
200    /// <p>The <code>DBSnapshotIdentifier</code> of the new <code>DBSnapshot</code> created when the <code>SkipFinalSnapshot</code> parameter is disabled.</p><note>
201    /// <p>If you enable this parameter and also enable SkipFinalShapshot, the command results in an error.</p>
202    /// </note>
203    /// <p>This setting doesn't apply to RDS Custom.</p>
204    /// <p>Constraints:</p>
205    /// <ul>
206    /// <li>
207    /// <p>Must be 1 to 255 letters or numbers.</p></li>
208    /// <li>
209    /// <p>First character must be a letter.</p></li>
210    /// <li>
211    /// <p>Can't end with a hyphen or contain two consecutive hyphens.</p></li>
212    /// <li>
213    /// <p>Can't be specified when deleting a read replica.</p></li>
214    /// </ul>
215    pub fn set_final_db_snapshot_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
216        self.inner = self.inner.set_final_db_snapshot_identifier(input);
217        self
218    }
219    /// <p>The <code>DBSnapshotIdentifier</code> of the new <code>DBSnapshot</code> created when the <code>SkipFinalSnapshot</code> parameter is disabled.</p><note>
220    /// <p>If you enable this parameter and also enable SkipFinalShapshot, the command results in an error.</p>
221    /// </note>
222    /// <p>This setting doesn't apply to RDS Custom.</p>
223    /// <p>Constraints:</p>
224    /// <ul>
225    /// <li>
226    /// <p>Must be 1 to 255 letters or numbers.</p></li>
227    /// <li>
228    /// <p>First character must be a letter.</p></li>
229    /// <li>
230    /// <p>Can't end with a hyphen or contain two consecutive hyphens.</p></li>
231    /// <li>
232    /// <p>Can't be specified when deleting a read replica.</p></li>
233    /// </ul>
234    pub fn get_final_db_snapshot_identifier(&self) -> &::std::option::Option<::std::string::String> {
235        self.inner.get_final_db_snapshot_identifier()
236    }
237    /// <p>Specifies whether to remove automated backups immediately after the DB instance is deleted. This parameter isn't case-sensitive. The default is to remove automated backups immediately after the DB instance is deleted.</p>
238    pub fn delete_automated_backups(mut self, input: bool) -> Self {
239        self.inner = self.inner.delete_automated_backups(input);
240        self
241    }
242    /// <p>Specifies whether to remove automated backups immediately after the DB instance is deleted. This parameter isn't case-sensitive. The default is to remove automated backups immediately after the DB instance is deleted.</p>
243    pub fn set_delete_automated_backups(mut self, input: ::std::option::Option<bool>) -> Self {
244        self.inner = self.inner.set_delete_automated_backups(input);
245        self
246    }
247    /// <p>Specifies whether to remove automated backups immediately after the DB instance is deleted. This parameter isn't case-sensitive. The default is to remove automated backups immediately after the DB instance is deleted.</p>
248    pub fn get_delete_automated_backups(&self) -> &::std::option::Option<bool> {
249        self.inner.get_delete_automated_backups()
250    }
251}