aws_sdk_docdb/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 cluster when failing over a global cluster occurs.</p>
26/// <p>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>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct FailoverGlobalClusterFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::failover_global_cluster::builders::FailoverGlobalClusterInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::failover_global_cluster::FailoverGlobalClusterOutput,
36        crate::operation::failover_global_cluster::FailoverGlobalClusterError,
37    > for FailoverGlobalClusterFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::failover_global_cluster::FailoverGlobalClusterOutput,
45            crate::operation::failover_global_cluster::FailoverGlobalClusterError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl FailoverGlobalClusterFluentBuilder {
52    /// Creates a new `FailoverGlobalClusterFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the FailoverGlobalCluster as a reference.
61    pub fn as_input(&self) -> &crate::operation::failover_global_cluster::builders::FailoverGlobalClusterInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::failover_global_cluster::FailoverGlobalClusterOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::failover_global_cluster::FailoverGlobalClusterError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::failover_global_cluster::FailoverGlobalCluster::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::failover_global_cluster::FailoverGlobalCluster::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::failover_global_cluster::FailoverGlobalClusterOutput,
98        crate::operation::failover_global_cluster::FailoverGlobalClusterError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The identifier of the Amazon DocumentDB global cluster to apply this operation. The identifier is the unique key assigned by the user when the cluster is created. In other words, it's the name of the global cluster.</p>
113    /// <p>Constraints:</p>
114    /// <ul>
115    /// <li>
116    /// <p>Must match the identifier of an existing global cluster.</p></li>
117    /// <li>
118    /// <p>Minimum length of 1. Maximum length of 255.</p></li>
119    /// </ul>
120    /// <p>Pattern: <code>\[A-Za-z\]\[0-9A-Za-z-:._\]*</code></p>
121    pub fn global_cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.inner = self.inner.global_cluster_identifier(input.into());
123        self
124    }
125    /// <p>The identifier of the Amazon DocumentDB global cluster to apply this operation. The identifier is the unique key assigned by the user when the cluster is created. In other words, it's the name of the global cluster.</p>
126    /// <p>Constraints:</p>
127    /// <ul>
128    /// <li>
129    /// <p>Must match the identifier of an existing global cluster.</p></li>
130    /// <li>
131    /// <p>Minimum length of 1. Maximum length of 255.</p></li>
132    /// </ul>
133    /// <p>Pattern: <code>\[A-Za-z\]\[0-9A-Za-z-:._\]*</code></p>
134    pub fn set_global_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_global_cluster_identifier(input);
136        self
137    }
138    /// <p>The identifier of the Amazon DocumentDB global cluster to apply this operation. The identifier is the unique key assigned by the user when the cluster is created. In other words, it's the name of the global cluster.</p>
139    /// <p>Constraints:</p>
140    /// <ul>
141    /// <li>
142    /// <p>Must match the identifier of an existing global cluster.</p></li>
143    /// <li>
144    /// <p>Minimum length of 1. Maximum length of 255.</p></li>
145    /// </ul>
146    /// <p>Pattern: <code>\[A-Za-z\]\[0-9A-Za-z-:._\]*</code></p>
147    pub fn get_global_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
148        self.inner.get_global_cluster_identifier()
149    }
150    /// <p>The identifier of the secondary Amazon DocumentDB cluster that you want to promote to the primary for the global cluster. Use the Amazon Resource Name (ARN) for the identifier so that Amazon DocumentDB can locate the cluster in its Amazon Web Services region.</p>
151    /// <p>Constraints:</p>
152    /// <ul>
153    /// <li>
154    /// <p>Must match the identifier of an existing secondary cluster.</p></li>
155    /// <li>
156    /// <p>Minimum length of 1. Maximum length of 255.</p></li>
157    /// </ul>
158    /// <p>Pattern: <code>\[A-Za-z\]\[0-9A-Za-z-:._\]*</code></p>
159    pub fn target_db_cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.target_db_cluster_identifier(input.into());
161        self
162    }
163    /// <p>The identifier of the secondary Amazon DocumentDB cluster that you want to promote to the primary for the global cluster. Use the Amazon Resource Name (ARN) for the identifier so that Amazon DocumentDB can locate the cluster in its Amazon Web Services region.</p>
164    /// <p>Constraints:</p>
165    /// <ul>
166    /// <li>
167    /// <p>Must match the identifier of an existing secondary cluster.</p></li>
168    /// <li>
169    /// <p>Minimum length of 1. Maximum length of 255.</p></li>
170    /// </ul>
171    /// <p>Pattern: <code>\[A-Za-z\]\[0-9A-Za-z-:._\]*</code></p>
172    pub fn set_target_db_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
173        self.inner = self.inner.set_target_db_cluster_identifier(input);
174        self
175    }
176    /// <p>The identifier of the secondary Amazon DocumentDB cluster that you want to promote to the primary for the global cluster. Use the Amazon Resource Name (ARN) for the identifier so that Amazon DocumentDB can locate the cluster in its Amazon Web Services region.</p>
177    /// <p>Constraints:</p>
178    /// <ul>
179    /// <li>
180    /// <p>Must match the identifier of an existing secondary cluster.</p></li>
181    /// <li>
182    /// <p>Minimum length of 1. Maximum length of 255.</p></li>
183    /// </ul>
184    /// <p>Pattern: <code>\[A-Za-z\]\[0-9A-Za-z-:._\]*</code></p>
185    pub fn get_target_db_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
186        self.inner.get_target_db_cluster_identifier()
187    }
188    /// <p>Specifies whether to allow data loss for this global cluster operation. Allowing data loss triggers a global failover operation.</p>
189    /// <p>If you don't specify <code>AllowDataLoss</code>, the global cluster operation defaults to a switchover.</p>
190    /// <p>Constraints:</p>
191    /// <ul>
192    /// <li>
193    /// <p>Can't be specified together with the <code>Switchover</code> parameter.</p></li>
194    /// </ul>
195    pub fn allow_data_loss(mut self, input: bool) -> Self {
196        self.inner = self.inner.allow_data_loss(input);
197        self
198    }
199    /// <p>Specifies whether to allow data loss for this global cluster operation. Allowing data loss triggers a global failover operation.</p>
200    /// <p>If you don't specify <code>AllowDataLoss</code>, the global cluster operation defaults to a switchover.</p>
201    /// <p>Constraints:</p>
202    /// <ul>
203    /// <li>
204    /// <p>Can't be specified together with the <code>Switchover</code> parameter.</p></li>
205    /// </ul>
206    pub fn set_allow_data_loss(mut self, input: ::std::option::Option<bool>) -> Self {
207        self.inner = self.inner.set_allow_data_loss(input);
208        self
209    }
210    /// <p>Specifies whether to allow data loss for this global cluster operation. Allowing data loss triggers a global failover operation.</p>
211    /// <p>If you don't specify <code>AllowDataLoss</code>, the global cluster operation defaults to a switchover.</p>
212    /// <p>Constraints:</p>
213    /// <ul>
214    /// <li>
215    /// <p>Can't be specified together with the <code>Switchover</code> parameter.</p></li>
216    /// </ul>
217    pub fn get_allow_data_loss(&self) -> &::std::option::Option<bool> {
218        self.inner.get_allow_data_loss()
219    }
220    /// <p>Specifies whether to switch over this global database cluster.</p>
221    /// <p>Constraints:</p>
222    /// <ul>
223    /// <li>
224    /// <p>Can't be specified together with the <code>AllowDataLoss</code> parameter.</p></li>
225    /// </ul>
226    pub fn switchover(mut self, input: bool) -> Self {
227        self.inner = self.inner.switchover(input);
228        self
229    }
230    /// <p>Specifies whether to switch over this global database cluster.</p>
231    /// <p>Constraints:</p>
232    /// <ul>
233    /// <li>
234    /// <p>Can't be specified together with the <code>AllowDataLoss</code> parameter.</p></li>
235    /// </ul>
236    pub fn set_switchover(mut self, input: ::std::option::Option<bool>) -> Self {
237        self.inner = self.inner.set_switchover(input);
238        self
239    }
240    /// <p>Specifies whether to switch over this global database cluster.</p>
241    /// <p>Constraints:</p>
242    /// <ul>
243    /// <li>
244    /// <p>Can't be specified together with the <code>AllowDataLoss</code> parameter.</p></li>
245    /// </ul>
246    pub fn get_switchover(&self) -> &::std::option::Option<bool> {
247        self.inner.get_switchover()
248    }
249}