aws_sdk_elasticache/operation/test_failover/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::test_failover::_test_failover_output::TestFailoverOutputBuilder;
3
4pub use crate::operation::test_failover::_test_failover_input::TestFailoverInputBuilder;
5
6impl crate::operation::test_failover::builders::TestFailoverInputBuilder {
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::test_failover::TestFailoverOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::test_failover::TestFailoverError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.test_failover();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `TestFailover`.
24///
25/// <p>Represents the input of a <code>TestFailover</code> operation which tests automatic failover on a specified node group (called shard in the console) in a replication group (called cluster in the console).</p>
26/// <p>This API is designed for testing the behavior of your application in case of ElastiCache failover. It is not designed to be an operational tool for initiating a failover to overcome a problem you may have with the cluster. Moreover, in certain conditions such as large-scale operational events, Amazon may block this API.</p>
27/// <p class="title"><b>Note the following</b></p>
28/// <ul>
29/// <li>
30/// <p>A customer can use this operation to test automatic failover on up to 15 shards (called node groups in the ElastiCache API and Amazon CLI) in any rolling 24-hour period.</p></li>
31/// <li>
32/// <p>If calling this operation on shards in different clusters (called replication groups in the API and CLI), the calls can be made concurrently.</p>
33/// <p></p></li>
34/// <li>
35/// <p>If calling this operation multiple times on different shards in the same Valkey or Redis OSS (cluster mode enabled) replication group, the first node replacement must complete before a subsequent call can be made.</p></li>
36/// <li>
37/// <p>To determine whether the node replacement is complete you can check Events using the Amazon ElastiCache console, the Amazon CLI, or the ElastiCache API. Look for the following automatic failover related events, listed here in order of occurrance:</p>
38/// <ol>
39/// <li>
40/// <p>Replication group message: <code>Test Failover API called for node group <node-group-id></node-group-id></code></p></li>
41/// <li>
42/// <p>Cache cluster message: <code>Failover from primary node <primary-node-id>
43/// to replica node
44/// <node-id>
45/// completed
46/// </node-id>
47/// </primary-node-id></code></p></li>
48/// <li>
49/// <p>Replication group message: <code>Failover from primary node <primary-node-id>
50/// to replica node
51/// <node-id>
52/// completed
53/// </node-id>
54/// </primary-node-id></code></p></li>
55/// <li>
56/// <p>Cache cluster message: <code>Recovering cache nodes <node-id></node-id></code></p></li>
57/// <li>
58/// <p>Cache cluster message: <code>Finished recovery for cache nodes <node-id></node-id></code></p></li>
59/// </ol>
60/// <p>For more information see:</p>
61/// <ul>
62/// <li>
63/// <p><a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/ECEvents.Viewing.html">Viewing ElastiCache Events</a> in the <i>ElastiCache User Guide</i></p></li>
64/// <li>
65/// <p><a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeEvents.html">DescribeEvents</a> in the ElastiCache API Reference</p></li>
66/// </ul></li>
67/// </ul>
68/// <p>Also see, <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/AutoFailover.html#auto-failover-test">Testing Multi-AZ </a> in the <i>ElastiCache User Guide</i>.</p>
69#[derive(::std::clone::Clone, ::std::fmt::Debug)]
70pub struct TestFailoverFluentBuilder {
71    handle: ::std::sync::Arc<crate::client::Handle>,
72    inner: crate::operation::test_failover::builders::TestFailoverInputBuilder,
73    config_override: ::std::option::Option<crate::config::Builder>,
74}
75impl
76    crate::client::customize::internal::CustomizableSend<
77        crate::operation::test_failover::TestFailoverOutput,
78        crate::operation::test_failover::TestFailoverError,
79    > for TestFailoverFluentBuilder
80{
81    fn send(
82        self,
83        config_override: crate::config::Builder,
84    ) -> crate::client::customize::internal::BoxFuture<
85        crate::client::customize::internal::SendResult<
86            crate::operation::test_failover::TestFailoverOutput,
87            crate::operation::test_failover::TestFailoverError,
88        >,
89    > {
90        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
91    }
92}
93impl TestFailoverFluentBuilder {
94    /// Creates a new `TestFailoverFluentBuilder`.
95    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
96        Self {
97            handle,
98            inner: ::std::default::Default::default(),
99            config_override: ::std::option::Option::None,
100        }
101    }
102    /// Access the TestFailover as a reference.
103    pub fn as_input(&self) -> &crate::operation::test_failover::builders::TestFailoverInputBuilder {
104        &self.inner
105    }
106    /// Sends the request and returns the response.
107    ///
108    /// If an error occurs, an `SdkError` will be returned with additional details that
109    /// can be matched against.
110    ///
111    /// By default, any retryable failures will be retried twice. Retry behavior
112    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
113    /// set when configuring the client.
114    pub async fn send(
115        self,
116    ) -> ::std::result::Result<
117        crate::operation::test_failover::TestFailoverOutput,
118        ::aws_smithy_runtime_api::client::result::SdkError<
119            crate::operation::test_failover::TestFailoverError,
120            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
121        >,
122    > {
123        let input = self
124            .inner
125            .build()
126            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
127        let runtime_plugins = crate::operation::test_failover::TestFailover::operation_runtime_plugins(
128            self.handle.runtime_plugins.clone(),
129            &self.handle.conf,
130            self.config_override,
131        );
132        crate::operation::test_failover::TestFailover::orchestrate(&runtime_plugins, input).await
133    }
134
135    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
136    pub fn customize(
137        self,
138    ) -> crate::client::customize::CustomizableOperation<
139        crate::operation::test_failover::TestFailoverOutput,
140        crate::operation::test_failover::TestFailoverError,
141        Self,
142    > {
143        crate::client::customize::CustomizableOperation::new(self)
144    }
145    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
146        self.set_config_override(::std::option::Option::Some(config_override.into()));
147        self
148    }
149
150    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
151        self.config_override = config_override;
152        self
153    }
154    /// <p>The name of the replication group (console: cluster) whose automatic failover is being tested by this operation.</p>
155    pub fn replication_group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.inner = self.inner.replication_group_id(input.into());
157        self
158    }
159    /// <p>The name of the replication group (console: cluster) whose automatic failover is being tested by this operation.</p>
160    pub fn set_replication_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.inner = self.inner.set_replication_group_id(input);
162        self
163    }
164    /// <p>The name of the replication group (console: cluster) whose automatic failover is being tested by this operation.</p>
165    pub fn get_replication_group_id(&self) -> &::std::option::Option<::std::string::String> {
166        self.inner.get_replication_group_id()
167    }
168    /// <p>The name of the node group (called shard in the console) in this replication group on which automatic failover is to be tested. You may test automatic failover on up to 15 node groups in any rolling 24-hour period.</p>
169    pub fn node_group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170        self.inner = self.inner.node_group_id(input.into());
171        self
172    }
173    /// <p>The name of the node group (called shard in the console) in this replication group on which automatic failover is to be tested. You may test automatic failover on up to 15 node groups in any rolling 24-hour period.</p>
174    pub fn set_node_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175        self.inner = self.inner.set_node_group_id(input);
176        self
177    }
178    /// <p>The name of the node group (called shard in the console) in this replication group on which automatic failover is to be tested. You may test automatic failover on up to 15 node groups in any rolling 24-hour period.</p>
179    pub fn get_node_group_id(&self) -> &::std::option::Option<::std::string::String> {
180        self.inner.get_node_group_id()
181    }
182}