aws_sdk_rds/operation/failover_global_cluster/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::failover_global_cluster::_failover_global_cluster_output::FailoverGlobalClusterOutputBuilder;
3
4pub use crate::operation::failover_global_cluster::_failover_global_cluster_input::FailoverGlobalClusterInputBuilder;
5
6impl crate::operation::failover_global_cluster::builders::FailoverGlobalClusterInputBuilder {
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_global_cluster::FailoverGlobalClusterOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::failover_global_cluster::FailoverGlobalClusterError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.failover_global_cluster();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `FailoverGlobalCluster`.
24///
25/// <p>Promotes the specified secondary DB cluster to be the primary DB cluster in the global database cluster to fail over or switch over a global database. Switchover operations were previously called "managed planned failovers."</p><note>
26/// <p>Although this operation can be used either to fail over or to switch over a global database cluster, its intended use is for global database failover. To switch over a global database cluster, we recommend that you use the <code>SwitchoverGlobalCluster</code> operation instead.</p>
27/// </note>
28/// <p>How you use this operation depends on whether you are failing over or switching over your global database cluster:</p>
29/// <ul>
30/// <li>
31/// <p>Failing over - Specify the <code>AllowDataLoss</code> parameter and don't specify the <code>Switchover</code> parameter.</p></li>
32/// <li>
33/// <p>Switching over - Specify the <code>Switchover</code> parameter or omit it, but don't specify the <code>AllowDataLoss</code> parameter.</p></li>
34/// </ul>
35/// <p><b>About failing over and switching over</b></p>
36/// <p>While failing over and switching over a global database cluster both change the primary DB cluster, you use these operations for different reasons:</p>
37/// <ul>
38/// <li>
39/// <p><i>Failing over</i> - Use this operation to respond to an unplanned event, such as a Regional disaster in the primary Region. Failing over can result in a loss of write transaction data that wasn't replicated to the chosen secondary before the failover event occurred. However, the recovery process that promotes a DB instance on the chosen seconday DB cluster to be the primary writer DB instance guarantees that the data is in a transactionally consistent state.</p>
40/// <p>For more information about failing over an Amazon Aurora global database, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-disaster-recovery.html#aurora-global-database-failover.managed-unplanned">Performing managed failovers for Aurora global databases</a> in the <i>Amazon Aurora User Guide</i>.</p></li>
41/// <li>
42/// <p><i>Switching over</i> - Use this operation on a healthy global database cluster for planned events, such as Regional rotation or to fail back to the original primary DB cluster after a failover operation. With this operation, there is no data loss.</p>
43/// <p>For more information about switching over an Amazon Aurora global database, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-disaster-recovery.html#aurora-global-database-disaster-recovery.managed-failover">Performing switchovers for Aurora global databases</a> in the <i>Amazon Aurora User Guide</i>.</p></li>
44/// </ul>
45#[derive(::std::clone::Clone, ::std::fmt::Debug)]
46pub struct FailoverGlobalClusterFluentBuilder {
47    handle: ::std::sync::Arc<crate::client::Handle>,
48    inner: crate::operation::failover_global_cluster::builders::FailoverGlobalClusterInputBuilder,
49    config_override: ::std::option::Option<crate::config::Builder>,
50}
51impl
52    crate::client::customize::internal::CustomizableSend<
53        crate::operation::failover_global_cluster::FailoverGlobalClusterOutput,
54        crate::operation::failover_global_cluster::FailoverGlobalClusterError,
55    > for FailoverGlobalClusterFluentBuilder
56{
57    fn send(
58        self,
59        config_override: crate::config::Builder,
60    ) -> crate::client::customize::internal::BoxFuture<
61        crate::client::customize::internal::SendResult<
62            crate::operation::failover_global_cluster::FailoverGlobalClusterOutput,
63            crate::operation::failover_global_cluster::FailoverGlobalClusterError,
64        >,
65    > {
66        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
67    }
68}
69impl FailoverGlobalClusterFluentBuilder {
70    /// Creates a new `FailoverGlobalClusterFluentBuilder`.
71    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
72        Self {
73            handle,
74            inner: ::std::default::Default::default(),
75            config_override: ::std::option::Option::None,
76        }
77    }
78    /// Access the FailoverGlobalCluster as a reference.
79    pub fn as_input(&self) -> &crate::operation::failover_global_cluster::builders::FailoverGlobalClusterInputBuilder {
80        &self.inner
81    }
82    /// Sends the request and returns the response.
83    ///
84    /// If an error occurs, an `SdkError` will be returned with additional details that
85    /// can be matched against.
86    ///
87    /// By default, any retryable failures will be retried twice. Retry behavior
88    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
89    /// set when configuring the client.
90    pub async fn send(
91        self,
92    ) -> ::std::result::Result<
93        crate::operation::failover_global_cluster::FailoverGlobalClusterOutput,
94        ::aws_smithy_runtime_api::client::result::SdkError<
95            crate::operation::failover_global_cluster::FailoverGlobalClusterError,
96            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
97        >,
98    > {
99        let input = self
100            .inner
101            .build()
102            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
103        let runtime_plugins = crate::operation::failover_global_cluster::FailoverGlobalCluster::operation_runtime_plugins(
104            self.handle.runtime_plugins.clone(),
105            &self.handle.conf,
106            self.config_override,
107        );
108        crate::operation::failover_global_cluster::FailoverGlobalCluster::orchestrate(&runtime_plugins, input).await
109    }
110
111    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
112    pub fn customize(
113        self,
114    ) -> crate::client::customize::CustomizableOperation<
115        crate::operation::failover_global_cluster::FailoverGlobalClusterOutput,
116        crate::operation::failover_global_cluster::FailoverGlobalClusterError,
117        Self,
118    > {
119        crate::client::customize::CustomizableOperation::new(self)
120    }
121    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
122        self.set_config_override(::std::option::Option::Some(config_override.into()));
123        self
124    }
125
126    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
127        self.config_override = config_override;
128        self
129    }
130    /// <p>The identifier of the global database cluster (Aurora global database) this operation should apply to. The identifier is the unique key assigned by the user when the Aurora global database is created. In other words, it's the name of the Aurora global database.</p>
131    /// <p>Constraints:</p>
132    /// <ul>
133    /// <li>
134    /// <p>Must match the identifier of an existing global database cluster.</p></li>
135    /// </ul>
136    pub fn global_cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.inner = self.inner.global_cluster_identifier(input.into());
138        self
139    }
140    /// <p>The identifier of the global database cluster (Aurora global database) this operation should apply to. The identifier is the unique key assigned by the user when the Aurora global database is created. In other words, it's the name of the Aurora global database.</p>
141    /// <p>Constraints:</p>
142    /// <ul>
143    /// <li>
144    /// <p>Must match the identifier of an existing global database cluster.</p></li>
145    /// </ul>
146    pub fn set_global_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.inner = self.inner.set_global_cluster_identifier(input);
148        self
149    }
150    /// <p>The identifier of the global database cluster (Aurora global database) this operation should apply to. The identifier is the unique key assigned by the user when the Aurora global database is created. In other words, it's the name of the Aurora global database.</p>
151    /// <p>Constraints:</p>
152    /// <ul>
153    /// <li>
154    /// <p>Must match the identifier of an existing global database cluster.</p></li>
155    /// </ul>
156    pub fn get_global_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
157        self.inner.get_global_cluster_identifier()
158    }
159    /// <p>The identifier of the secondary Aurora DB cluster that you want to promote to the primary for the global database cluster. Use the Amazon Resource Name (ARN) for the identifier so that Aurora can locate the cluster in its Amazon Web Services Region.</p>
160    pub fn target_db_cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.target_db_cluster_identifier(input.into());
162        self
163    }
164    /// <p>The identifier of the secondary Aurora DB cluster that you want to promote to the primary for the global database cluster. Use the Amazon Resource Name (ARN) for the identifier so that Aurora can locate the cluster in its Amazon Web Services Region.</p>
165    pub fn set_target_db_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.inner = self.inner.set_target_db_cluster_identifier(input);
167        self
168    }
169    /// <p>The identifier of the secondary Aurora DB cluster that you want to promote to the primary for the global database cluster. Use the Amazon Resource Name (ARN) for the identifier so that Aurora can locate the cluster in its Amazon Web Services Region.</p>
170    pub fn get_target_db_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
171        self.inner.get_target_db_cluster_identifier()
172    }
173    /// <p>Specifies whether to allow data loss for this global database cluster operation. Allowing data loss triggers a global failover operation.</p>
174    /// <p>If you don't specify <code>AllowDataLoss</code>, the global database cluster operation defaults to a switchover.</p>
175    /// <p>Constraints:</p>
176    /// <ul>
177    /// <li>
178    /// <p>Can't be specified together with the <code>Switchover</code> parameter.</p></li>
179    /// </ul>
180    pub fn allow_data_loss(mut self, input: bool) -> Self {
181        self.inner = self.inner.allow_data_loss(input);
182        self
183    }
184    /// <p>Specifies whether to allow data loss for this global database cluster operation. Allowing data loss triggers a global failover operation.</p>
185    /// <p>If you don't specify <code>AllowDataLoss</code>, the global database cluster operation defaults to a switchover.</p>
186    /// <p>Constraints:</p>
187    /// <ul>
188    /// <li>
189    /// <p>Can't be specified together with the <code>Switchover</code> parameter.</p></li>
190    /// </ul>
191    pub fn set_allow_data_loss(mut self, input: ::std::option::Option<bool>) -> Self {
192        self.inner = self.inner.set_allow_data_loss(input);
193        self
194    }
195    /// <p>Specifies whether to allow data loss for this global database cluster operation. Allowing data loss triggers a global failover operation.</p>
196    /// <p>If you don't specify <code>AllowDataLoss</code>, the global database cluster operation defaults to a switchover.</p>
197    /// <p>Constraints:</p>
198    /// <ul>
199    /// <li>
200    /// <p>Can't be specified together with the <code>Switchover</code> parameter.</p></li>
201    /// </ul>
202    pub fn get_allow_data_loss(&self) -> &::std::option::Option<bool> {
203        self.inner.get_allow_data_loss()
204    }
205    /// <p>Specifies whether to switch over this global database cluster.</p>
206    /// <p>Constraints:</p>
207    /// <ul>
208    /// <li>
209    /// <p>Can't be specified together with the <code>AllowDataLoss</code> parameter.</p></li>
210    /// </ul>
211    pub fn switchover(mut self, input: bool) -> Self {
212        self.inner = self.inner.switchover(input);
213        self
214    }
215    /// <p>Specifies whether to switch over this global database cluster.</p>
216    /// <p>Constraints:</p>
217    /// <ul>
218    /// <li>
219    /// <p>Can't be specified together with the <code>AllowDataLoss</code> parameter.</p></li>
220    /// </ul>
221    pub fn set_switchover(mut self, input: ::std::option::Option<bool>) -> Self {
222        self.inner = self.inner.set_switchover(input);
223        self
224    }
225    /// <p>Specifies whether to switch over this global database cluster.</p>
226    /// <p>Constraints:</p>
227    /// <ul>
228    /// <li>
229    /// <p>Can't be specified together with the <code>AllowDataLoss</code> parameter.</p></li>
230    /// </ul>
231    pub fn get_switchover(&self) -> &::std::option::Option<bool> {
232        self.inner.get_switchover()
233    }
234}