aws_sdk_redshift/operation/copy_cluster_snapshot/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::copy_cluster_snapshot::_copy_cluster_snapshot_output::CopyClusterSnapshotOutputBuilder;
3
4pub use crate::operation::copy_cluster_snapshot::_copy_cluster_snapshot_input::CopyClusterSnapshotInputBuilder;
5
6impl crate::operation::copy_cluster_snapshot::builders::CopyClusterSnapshotInputBuilder {
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::copy_cluster_snapshot::CopyClusterSnapshotOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::copy_cluster_snapshot::CopyClusterSnapshotError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.copy_cluster_snapshot();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CopyClusterSnapshot`.
24///
25/// <p>Copies the specified automated cluster snapshot to a new manual cluster snapshot. The source must be an automated snapshot and it must be in the available state.</p>
26/// <p>When you delete a cluster, Amazon Redshift deletes any automated snapshots of the cluster. Also, when the retention period of the snapshot expires, Amazon Redshift automatically deletes it. If you want to keep an automated snapshot for a longer period, you can make a manual copy of the snapshot. Manual snapshots are retained until you delete them.</p>
27/// <p>For more information about working with snapshots, go to <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-snapshots.html">Amazon Redshift Snapshots</a> in the <i>Amazon Redshift Cluster Management Guide</i>.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct CopyClusterSnapshotFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::copy_cluster_snapshot::builders::CopyClusterSnapshotInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::copy_cluster_snapshot::CopyClusterSnapshotOutput,
37        crate::operation::copy_cluster_snapshot::CopyClusterSnapshotError,
38    > for CopyClusterSnapshotFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::copy_cluster_snapshot::CopyClusterSnapshotOutput,
46            crate::operation::copy_cluster_snapshot::CopyClusterSnapshotError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl CopyClusterSnapshotFluentBuilder {
53    /// Creates a new `CopyClusterSnapshotFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the CopyClusterSnapshot as a reference.
62    pub fn as_input(&self) -> &crate::operation::copy_cluster_snapshot::builders::CopyClusterSnapshotInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::copy_cluster_snapshot::CopyClusterSnapshotOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::copy_cluster_snapshot::CopyClusterSnapshotError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::copy_cluster_snapshot::CopyClusterSnapshot::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::copy_cluster_snapshot::CopyClusterSnapshot::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::copy_cluster_snapshot::CopyClusterSnapshotOutput,
99        crate::operation::copy_cluster_snapshot::CopyClusterSnapshotError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>The identifier for the source snapshot.</p>
114    /// <p>Constraints:</p>
115    /// <ul>
116    /// <li>
117    /// <p>Must be the identifier for a valid automated snapshot whose state is <code>available</code>.</p></li>
118    /// </ul>
119    pub fn source_snapshot_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.inner = self.inner.source_snapshot_identifier(input.into());
121        self
122    }
123    /// <p>The identifier for the source snapshot.</p>
124    /// <p>Constraints:</p>
125    /// <ul>
126    /// <li>
127    /// <p>Must be the identifier for a valid automated snapshot whose state is <code>available</code>.</p></li>
128    /// </ul>
129    pub fn set_source_snapshot_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.inner = self.inner.set_source_snapshot_identifier(input);
131        self
132    }
133    /// <p>The identifier for the source snapshot.</p>
134    /// <p>Constraints:</p>
135    /// <ul>
136    /// <li>
137    /// <p>Must be the identifier for a valid automated snapshot whose state is <code>available</code>.</p></li>
138    /// </ul>
139    pub fn get_source_snapshot_identifier(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_source_snapshot_identifier()
141    }
142    /// <p>The identifier of the cluster the source snapshot was created from. This parameter is required if your IAM user has a policy containing a snapshot resource element that specifies anything other than * for the cluster name.</p>
143    /// <p>Constraints:</p>
144    /// <ul>
145    /// <li>
146    /// <p>Must be the identifier for a valid cluster.</p></li>
147    /// </ul>
148    pub fn source_snapshot_cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149        self.inner = self.inner.source_snapshot_cluster_identifier(input.into());
150        self
151    }
152    /// <p>The identifier of the cluster the source snapshot was created from. This parameter is required if your IAM user has a policy containing a snapshot resource element that specifies anything other than * for the cluster name.</p>
153    /// <p>Constraints:</p>
154    /// <ul>
155    /// <li>
156    /// <p>Must be the identifier for a valid cluster.</p></li>
157    /// </ul>
158    pub fn set_source_snapshot_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
159        self.inner = self.inner.set_source_snapshot_cluster_identifier(input);
160        self
161    }
162    /// <p>The identifier of the cluster the source snapshot was created from. This parameter is required if your IAM user has a policy containing a snapshot resource element that specifies anything other than * for the cluster name.</p>
163    /// <p>Constraints:</p>
164    /// <ul>
165    /// <li>
166    /// <p>Must be the identifier for a valid cluster.</p></li>
167    /// </ul>
168    pub fn get_source_snapshot_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
169        self.inner.get_source_snapshot_cluster_identifier()
170    }
171    /// <p>The identifier given to the new manual snapshot.</p>
172    /// <p>Constraints:</p>
173    /// <ul>
174    /// <li>
175    /// <p>Cannot be null, empty, or blank.</p></li>
176    /// <li>
177    /// <p>Must contain from 1 to 255 alphanumeric characters or hyphens.</p></li>
178    /// <li>
179    /// <p>First character must be a letter.</p></li>
180    /// <li>
181    /// <p>Cannot end with a hyphen or contain two consecutive hyphens.</p></li>
182    /// <li>
183    /// <p>Must be unique for the Amazon Web Services account that is making the request.</p></li>
184    /// </ul>
185    pub fn target_snapshot_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186        self.inner = self.inner.target_snapshot_identifier(input.into());
187        self
188    }
189    /// <p>The identifier given to the new manual snapshot.</p>
190    /// <p>Constraints:</p>
191    /// <ul>
192    /// <li>
193    /// <p>Cannot be null, empty, or blank.</p></li>
194    /// <li>
195    /// <p>Must contain from 1 to 255 alphanumeric characters or hyphens.</p></li>
196    /// <li>
197    /// <p>First character must be a letter.</p></li>
198    /// <li>
199    /// <p>Cannot end with a hyphen or contain two consecutive hyphens.</p></li>
200    /// <li>
201    /// <p>Must be unique for the Amazon Web Services account that is making the request.</p></li>
202    /// </ul>
203    pub fn set_target_snapshot_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
204        self.inner = self.inner.set_target_snapshot_identifier(input);
205        self
206    }
207    /// <p>The identifier given to the new manual snapshot.</p>
208    /// <p>Constraints:</p>
209    /// <ul>
210    /// <li>
211    /// <p>Cannot be null, empty, or blank.</p></li>
212    /// <li>
213    /// <p>Must contain from 1 to 255 alphanumeric characters or hyphens.</p></li>
214    /// <li>
215    /// <p>First character must be a letter.</p></li>
216    /// <li>
217    /// <p>Cannot end with a hyphen or contain two consecutive hyphens.</p></li>
218    /// <li>
219    /// <p>Must be unique for the Amazon Web Services account that is making the request.</p></li>
220    /// </ul>
221    pub fn get_target_snapshot_identifier(&self) -> &::std::option::Option<::std::string::String> {
222        self.inner.get_target_snapshot_identifier()
223    }
224    /// <p>The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.</p>
225    /// <p>The value must be either -1 or an integer between 1 and 3,653.</p>
226    /// <p>The default value is -1.</p>
227    pub fn manual_snapshot_retention_period(mut self, input: i32) -> Self {
228        self.inner = self.inner.manual_snapshot_retention_period(input);
229        self
230    }
231    /// <p>The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.</p>
232    /// <p>The value must be either -1 or an integer between 1 and 3,653.</p>
233    /// <p>The default value is -1.</p>
234    pub fn set_manual_snapshot_retention_period(mut self, input: ::std::option::Option<i32>) -> Self {
235        self.inner = self.inner.set_manual_snapshot_retention_period(input);
236        self
237    }
238    /// <p>The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.</p>
239    /// <p>The value must be either -1 or an integer between 1 and 3,653.</p>
240    /// <p>The default value is -1.</p>
241    pub fn get_manual_snapshot_retention_period(&self) -> &::std::option::Option<i32> {
242        self.inner.get_manual_snapshot_retention_period()
243    }
244}