aws_sdk_rds/operation/failover_db_cluster/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::failover_db_cluster::_failover_db_cluster_output::FailoverDbClusterOutputBuilder;
3
4pub use crate::operation::failover_db_cluster::_failover_db_cluster_input::FailoverDbClusterInputBuilder;
5
6impl crate::operation::failover_db_cluster::builders::FailoverDbClusterInputBuilder {
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::failover_db_cluster::FailoverDbClusterOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::failover_db_cluster::FailoverDBClusterError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.failover_db_cluster();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `FailoverDBCluster`.
24///
25/// <p>Forces a failover for a DB cluster.</p>
26/// <p>For an Aurora DB cluster, failover for a DB cluster promotes one of the Aurora Replicas (read-only instances) in the DB cluster to be the primary DB instance (the cluster writer).</p>
27/// <p>For a Multi-AZ DB cluster, after RDS terminates the primary DB instance, the internal monitoring system detects that the primary DB instance is unhealthy and promotes a readable standby (read-only instances) in the DB cluster to be the primary DB instance (the cluster writer). Failover times are typically less than 35 seconds.</p>
28/// <p>An Amazon Aurora DB cluster automatically fails over to an Aurora Replica, if one exists, when the primary DB instance fails. A Multi-AZ DB cluster automatically fails over to a readable standby DB instance when the primary DB instance fails.</p>
29/// <p>To simulate a failure of a primary instance for testing, you can force a failover. Because each instance in a DB cluster has its own endpoint address, make sure to clean up and re-establish any existing connections that use those endpoint addresses when the failover is complete.</p>
30/// <p>For more information on Amazon Aurora DB clusters, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html"> What is Amazon Aurora?</a> in the <i>Amazon Aurora User Guide</i>.</p>
31/// <p>For more information on Multi-AZ DB clusters, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html"> Multi-AZ DB cluster deployments</a> in the <i>Amazon RDS User Guide</i>.</p>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct FailoverDBClusterFluentBuilder {
34    handle: ::std::sync::Arc<crate::client::Handle>,
35    inner: crate::operation::failover_db_cluster::builders::FailoverDbClusterInputBuilder,
36    config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39    crate::client::customize::internal::CustomizableSend<
40        crate::operation::failover_db_cluster::FailoverDbClusterOutput,
41        crate::operation::failover_db_cluster::FailoverDBClusterError,
42    > for FailoverDBClusterFluentBuilder
43{
44    fn send(
45        self,
46        config_override: crate::config::Builder,
47    ) -> crate::client::customize::internal::BoxFuture<
48        crate::client::customize::internal::SendResult<
49            crate::operation::failover_db_cluster::FailoverDbClusterOutput,
50            crate::operation::failover_db_cluster::FailoverDBClusterError,
51        >,
52    > {
53        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54    }
55}
56impl FailoverDBClusterFluentBuilder {
57    /// Creates a new `FailoverDBClusterFluentBuilder`.
58    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59        Self {
60            handle,
61            inner: ::std::default::Default::default(),
62            config_override: ::std::option::Option::None,
63        }
64    }
65    /// Access the FailoverDBCluster as a reference.
66    pub fn as_input(&self) -> &crate::operation::failover_db_cluster::builders::FailoverDbClusterInputBuilder {
67        &self.inner
68    }
69    /// Sends the request and returns the response.
70    ///
71    /// If an error occurs, an `SdkError` will be returned with additional details that
72    /// can be matched against.
73    ///
74    /// By default, any retryable failures will be retried twice. Retry behavior
75    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76    /// set when configuring the client.
77    pub async fn send(
78        self,
79    ) -> ::std::result::Result<
80        crate::operation::failover_db_cluster::FailoverDbClusterOutput,
81        ::aws_smithy_runtime_api::client::result::SdkError<
82            crate::operation::failover_db_cluster::FailoverDBClusterError,
83            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84        >,
85    > {
86        let input = self
87            .inner
88            .build()
89            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90        let runtime_plugins = crate::operation::failover_db_cluster::FailoverDBCluster::operation_runtime_plugins(
91            self.handle.runtime_plugins.clone(),
92            &self.handle.conf,
93            self.config_override,
94        );
95        crate::operation::failover_db_cluster::FailoverDBCluster::orchestrate(&runtime_plugins, input).await
96    }
97
98    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99    pub fn customize(
100        self,
101    ) -> crate::client::customize::CustomizableOperation<
102        crate::operation::failover_db_cluster::FailoverDbClusterOutput,
103        crate::operation::failover_db_cluster::FailoverDBClusterError,
104        Self,
105    > {
106        crate::client::customize::CustomizableOperation::new(self)
107    }
108    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109        self.set_config_override(::std::option::Option::Some(config_override.into()));
110        self
111    }
112
113    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114        self.config_override = config_override;
115        self
116    }
117    /// <p>The identifier of the DB cluster to force a failover for. This parameter isn't case-sensitive.</p>
118    /// <p>Constraints:</p>
119    /// <ul>
120    /// <li>
121    /// <p>Must match the identifier of an existing DB cluster.</p></li>
122    /// </ul>
123    pub fn db_cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.inner = self.inner.db_cluster_identifier(input.into());
125        self
126    }
127    /// <p>The identifier of the DB cluster to force a failover for. This parameter isn't case-sensitive.</p>
128    /// <p>Constraints:</p>
129    /// <ul>
130    /// <li>
131    /// <p>Must match the identifier of an existing DB cluster.</p></li>
132    /// </ul>
133    pub fn set_db_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.inner = self.inner.set_db_cluster_identifier(input);
135        self
136    }
137    /// <p>The identifier of the DB cluster to force a failover for. This parameter isn't case-sensitive.</p>
138    /// <p>Constraints:</p>
139    /// <ul>
140    /// <li>
141    /// <p>Must match the identifier of an existing DB cluster.</p></li>
142    /// </ul>
143    pub fn get_db_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
144        self.inner.get_db_cluster_identifier()
145    }
146    /// <p>The name of the DB instance to promote to the primary DB instance.</p>
147    /// <p>Specify the DB instance identifier for an Aurora Replica or a Multi-AZ readable standby in the DB cluster, for example <code>mydbcluster-replica1</code>.</p>
148    /// <p>This setting isn't supported for RDS for MySQL Multi-AZ DB clusters.</p>
149    pub fn target_db_instance_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150        self.inner = self.inner.target_db_instance_identifier(input.into());
151        self
152    }
153    /// <p>The name of the DB instance to promote to the primary DB instance.</p>
154    /// <p>Specify the DB instance identifier for an Aurora Replica or a Multi-AZ readable standby in the DB cluster, for example <code>mydbcluster-replica1</code>.</p>
155    /// <p>This setting isn't supported for RDS for MySQL Multi-AZ DB clusters.</p>
156    pub fn set_target_db_instance_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157        self.inner = self.inner.set_target_db_instance_identifier(input);
158        self
159    }
160    /// <p>The name of the DB instance to promote to the primary DB instance.</p>
161    /// <p>Specify the DB instance identifier for an Aurora Replica or a Multi-AZ readable standby in the DB cluster, for example <code>mydbcluster-replica1</code>.</p>
162    /// <p>This setting isn't supported for RDS for MySQL Multi-AZ DB clusters.</p>
163    pub fn get_target_db_instance_identifier(&self) -> &::std::option::Option<::std::string::String> {
164        self.inner.get_target_db_instance_identifier()
165    }
166}