aws_sdk_redshift/operation/enable_snapshot_copy/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::enable_snapshot_copy::_enable_snapshot_copy_output::EnableSnapshotCopyOutputBuilder;
3
4pub use crate::operation::enable_snapshot_copy::_enable_snapshot_copy_input::EnableSnapshotCopyInputBuilder;
5
6impl crate::operation::enable_snapshot_copy::builders::EnableSnapshotCopyInputBuilder {
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::enable_snapshot_copy::EnableSnapshotCopyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::enable_snapshot_copy::EnableSnapshotCopyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.enable_snapshot_copy();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `EnableSnapshotCopy`.
24///
25/// <p>Enables the automatic copy of snapshots from one region to another region for a specified cluster.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct EnableSnapshotCopyFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::enable_snapshot_copy::builders::EnableSnapshotCopyInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::enable_snapshot_copy::EnableSnapshotCopyOutput,
35        crate::operation::enable_snapshot_copy::EnableSnapshotCopyError,
36    > for EnableSnapshotCopyFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::enable_snapshot_copy::EnableSnapshotCopyOutput,
44            crate::operation::enable_snapshot_copy::EnableSnapshotCopyError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl EnableSnapshotCopyFluentBuilder {
51    /// Creates a new `EnableSnapshotCopyFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the EnableSnapshotCopy as a reference.
60    pub fn as_input(&self) -> &crate::operation::enable_snapshot_copy::builders::EnableSnapshotCopyInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::enable_snapshot_copy::EnableSnapshotCopyOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::enable_snapshot_copy::EnableSnapshotCopyError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::enable_snapshot_copy::EnableSnapshotCopy::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::enable_snapshot_copy::EnableSnapshotCopy::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::enable_snapshot_copy::EnableSnapshotCopyOutput,
97        crate::operation::enable_snapshot_copy::EnableSnapshotCopyError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The unique identifier of the source cluster to copy snapshots from.</p>
112    /// <p>Constraints: Must be the valid name of an existing cluster that does not already have cross-region snapshot copy enabled.</p>
113    pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.cluster_identifier(input.into());
115        self
116    }
117    /// <p>The unique identifier of the source cluster to copy snapshots from.</p>
118    /// <p>Constraints: Must be the valid name of an existing cluster that does not already have cross-region snapshot copy enabled.</p>
119    pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_cluster_identifier(input);
121        self
122    }
123    /// <p>The unique identifier of the source cluster to copy snapshots from.</p>
124    /// <p>Constraints: Must be the valid name of an existing cluster that does not already have cross-region snapshot copy enabled.</p>
125    pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
126        self.inner.get_cluster_identifier()
127    }
128    /// <p>The destination Amazon Web Services Region that you want to copy snapshots to.</p>
129    /// <p>Constraints: Must be the name of a valid Amazon Web Services Region. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#redshift_region">Regions and Endpoints</a> in the Amazon Web Services General Reference.</p>
130    pub fn destination_region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.destination_region(input.into());
132        self
133    }
134    /// <p>The destination Amazon Web Services Region that you want to copy snapshots to.</p>
135    /// <p>Constraints: Must be the name of a valid Amazon Web Services Region. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#redshift_region">Regions and Endpoints</a> in the Amazon Web Services General Reference.</p>
136    pub fn set_destination_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_destination_region(input);
138        self
139    }
140    /// <p>The destination Amazon Web Services Region that you want to copy snapshots to.</p>
141    /// <p>Constraints: Must be the name of a valid Amazon Web Services Region. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#redshift_region">Regions and Endpoints</a> in the Amazon Web Services General Reference.</p>
142    pub fn get_destination_region(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_destination_region()
144    }
145    /// <p>The number of days to retain automated snapshots in the destination region after they are copied from the source region.</p>
146    /// <p>Default: 7.</p>
147    /// <p>Constraints: Must be at least 1 and no more than 35.</p>
148    pub fn retention_period(mut self, input: i32) -> Self {
149        self.inner = self.inner.retention_period(input);
150        self
151    }
152    /// <p>The number of days to retain automated snapshots in the destination region after they are copied from the source region.</p>
153    /// <p>Default: 7.</p>
154    /// <p>Constraints: Must be at least 1 and no more than 35.</p>
155    pub fn set_retention_period(mut self, input: ::std::option::Option<i32>) -> Self {
156        self.inner = self.inner.set_retention_period(input);
157        self
158    }
159    /// <p>The number of days to retain automated snapshots in the destination region after they are copied from the source region.</p>
160    /// <p>Default: 7.</p>
161    /// <p>Constraints: Must be at least 1 and no more than 35.</p>
162    pub fn get_retention_period(&self) -> &::std::option::Option<i32> {
163        self.inner.get_retention_period()
164    }
165    /// <p>The name of the snapshot copy grant to use when snapshots of an Amazon Web Services KMS-encrypted cluster are copied to the destination region.</p>
166    pub fn snapshot_copy_grant_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.inner = self.inner.snapshot_copy_grant_name(input.into());
168        self
169    }
170    /// <p>The name of the snapshot copy grant to use when snapshots of an Amazon Web Services KMS-encrypted cluster are copied to the destination region.</p>
171    pub fn set_snapshot_copy_grant_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172        self.inner = self.inner.set_snapshot_copy_grant_name(input);
173        self
174    }
175    /// <p>The name of the snapshot copy grant to use when snapshots of an Amazon Web Services KMS-encrypted cluster are copied to the destination region.</p>
176    pub fn get_snapshot_copy_grant_name(&self) -> &::std::option::Option<::std::string::String> {
177        self.inner.get_snapshot_copy_grant_name()
178    }
179    /// <p>The number of days to retain newly copied snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region. If the value is -1, the manual snapshot is retained indefinitely.</p>
180    /// <p>The value must be either -1 or an integer between 1 and 3,653.</p>
181    pub fn manual_snapshot_retention_period(mut self, input: i32) -> Self {
182        self.inner = self.inner.manual_snapshot_retention_period(input);
183        self
184    }
185    /// <p>The number of days to retain newly copied snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region. If the value is -1, the manual snapshot is retained indefinitely.</p>
186    /// <p>The value must be either -1 or an integer between 1 and 3,653.</p>
187    pub fn set_manual_snapshot_retention_period(mut self, input: ::std::option::Option<i32>) -> Self {
188        self.inner = self.inner.set_manual_snapshot_retention_period(input);
189        self
190    }
191    /// <p>The number of days to retain newly copied snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region. If the value is -1, the manual snapshot is retained indefinitely.</p>
192    /// <p>The value must be either -1 or an integer between 1 and 3,653.</p>
193    pub fn get_manual_snapshot_retention_period(&self) -> &::std::option::Option<i32> {
194        self.inner.get_manual_snapshot_retention_period()
195    }
196}