aws_sdk_elasticache/operation/copy_snapshot/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::copy_snapshot::_copy_snapshot_output::CopySnapshotOutputBuilder;
3
4pub use crate::operation::copy_snapshot::_copy_snapshot_input::CopySnapshotInputBuilder;
5
6impl crate::operation::copy_snapshot::builders::CopySnapshotInputBuilder {
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_snapshot::CopySnapshotOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::copy_snapshot::CopySnapshotError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.copy_snapshot();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CopySnapshot`.
24///
25/// <p>Makes a copy of an existing snapshot.</p><note>
26/// <p>This operation is valid for Valkey or Redis OSS only.</p>
27/// </note> <important>
28/// <p>Users or groups that have permissions to use the <code>CopySnapshot</code> operation can create their own Amazon S3 buckets and copy snapshots to it. To control access to your snapshots, use an IAM policy to control who has the ability to use the <code>CopySnapshot</code> operation. For more information about using IAM to control the use of ElastiCache operations, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html">Exporting Snapshots</a> and <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/IAM.html">Authentication &amp; Access Control</a>.</p>
29/// </important>
30/// <p>You could receive the following error messages.</p>
31/// <p class="title"><b>Error Messages</b></p>
32/// <ul>
33/// <li>
34/// <p><b>Error Message:</b> The S3 bucket %s is outside of the region.</p>
35/// <p><b>Solution:</b> Create an Amazon S3 bucket in the same region as your snapshot. For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html#backups-exporting-create-s3-bucket">Step 1: Create an Amazon S3 Bucket</a> in the ElastiCache User Guide.</p></li>
36/// <li>
37/// <p><b>Error Message:</b> The S3 bucket %s does not exist.</p>
38/// <p><b>Solution:</b> Create an Amazon S3 bucket in the same region as your snapshot. For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html#backups-exporting-create-s3-bucket">Step 1: Create an Amazon S3 Bucket</a> in the ElastiCache User Guide.</p></li>
39/// <li>
40/// <p><b>Error Message:</b> The S3 bucket %s is not owned by the authenticated user.</p>
41/// <p><b>Solution:</b> Create an Amazon S3 bucket in the same region as your snapshot. For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html#backups-exporting-create-s3-bucket">Step 1: Create an Amazon S3 Bucket</a> in the ElastiCache User Guide.</p></li>
42/// <li>
43/// <p><b>Error Message:</b> The authenticated user does not have sufficient permissions to perform the desired activity.</p>
44/// <p><b>Solution:</b> Contact your system administrator to get the needed permissions.</p></li>
45/// <li>
46/// <p><b>Error Message:</b> The S3 bucket %s already contains an object with key %s.</p>
47/// <p><b>Solution:</b> Give the <code>TargetSnapshotName</code> a new and unique value. If exporting a snapshot, you could alternatively create a new Amazon S3 bucket and use this same value for <code>TargetSnapshotName</code>.</p></li>
48/// <li>
49/// <p><b>Error Message: </b> ElastiCache has not been granted READ permissions %s on the S3 Bucket.</p>
50/// <p><b>Solution:</b> Add List and Read permissions on the bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html#backups-exporting-grant-access">Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket</a> in the ElastiCache User Guide.</p></li>
51/// <li>
52/// <p><b>Error Message: </b> ElastiCache has not been granted WRITE permissions %s on the S3 Bucket.</p>
53/// <p><b>Solution:</b> Add Upload/Delete permissions on the bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html#backups-exporting-grant-access">Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket</a> in the ElastiCache User Guide.</p></li>
54/// <li>
55/// <p><b>Error Message: </b> ElastiCache has not been granted READ_ACP permissions %s on the S3 Bucket.</p>
56/// <p><b>Solution:</b> Add View Permissions on the bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html#backups-exporting-grant-access">Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket</a> in the ElastiCache User Guide.</p></li>
57/// </ul>
58#[derive(::std::clone::Clone, ::std::fmt::Debug)]
59pub struct CopySnapshotFluentBuilder {
60    handle: ::std::sync::Arc<crate::client::Handle>,
61    inner: crate::operation::copy_snapshot::builders::CopySnapshotInputBuilder,
62    config_override: ::std::option::Option<crate::config::Builder>,
63}
64impl
65    crate::client::customize::internal::CustomizableSend<
66        crate::operation::copy_snapshot::CopySnapshotOutput,
67        crate::operation::copy_snapshot::CopySnapshotError,
68    > for CopySnapshotFluentBuilder
69{
70    fn send(
71        self,
72        config_override: crate::config::Builder,
73    ) -> crate::client::customize::internal::BoxFuture<
74        crate::client::customize::internal::SendResult<
75            crate::operation::copy_snapshot::CopySnapshotOutput,
76            crate::operation::copy_snapshot::CopySnapshotError,
77        >,
78    > {
79        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
80    }
81}
82impl CopySnapshotFluentBuilder {
83    /// Creates a new `CopySnapshotFluentBuilder`.
84    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
85        Self {
86            handle,
87            inner: ::std::default::Default::default(),
88            config_override: ::std::option::Option::None,
89        }
90    }
91    /// Access the CopySnapshot as a reference.
92    pub fn as_input(&self) -> &crate::operation::copy_snapshot::builders::CopySnapshotInputBuilder {
93        &self.inner
94    }
95    /// Sends the request and returns the response.
96    ///
97    /// If an error occurs, an `SdkError` will be returned with additional details that
98    /// can be matched against.
99    ///
100    /// By default, any retryable failures will be retried twice. Retry behavior
101    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
102    /// set when configuring the client.
103    pub async fn send(
104        self,
105    ) -> ::std::result::Result<
106        crate::operation::copy_snapshot::CopySnapshotOutput,
107        ::aws_smithy_runtime_api::client::result::SdkError<
108            crate::operation::copy_snapshot::CopySnapshotError,
109            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
110        >,
111    > {
112        let input = self
113            .inner
114            .build()
115            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
116        let runtime_plugins = crate::operation::copy_snapshot::CopySnapshot::operation_runtime_plugins(
117            self.handle.runtime_plugins.clone(),
118            &self.handle.conf,
119            self.config_override,
120        );
121        crate::operation::copy_snapshot::CopySnapshot::orchestrate(&runtime_plugins, input).await
122    }
123
124    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
125    pub fn customize(
126        self,
127    ) -> crate::client::customize::CustomizableOperation<
128        crate::operation::copy_snapshot::CopySnapshotOutput,
129        crate::operation::copy_snapshot::CopySnapshotError,
130        Self,
131    > {
132        crate::client::customize::CustomizableOperation::new(self)
133    }
134    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
135        self.set_config_override(::std::option::Option::Some(config_override.into()));
136        self
137    }
138
139    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
140        self.config_override = config_override;
141        self
142    }
143    /// <p>The name of an existing snapshot from which to make a copy.</p>
144    pub fn source_snapshot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.source_snapshot_name(input.into());
146        self
147    }
148    /// <p>The name of an existing snapshot from which to make a copy.</p>
149    pub fn set_source_snapshot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_source_snapshot_name(input);
151        self
152    }
153    /// <p>The name of an existing snapshot from which to make a copy.</p>
154    pub fn get_source_snapshot_name(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_source_snapshot_name()
156    }
157    /// <p>A name for the snapshot copy. ElastiCache does not permit overwriting a snapshot, therefore this name must be unique within its context - ElastiCache or an Amazon S3 bucket if exporting.</p>
158    pub fn target_snapshot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
159        self.inner = self.inner.target_snapshot_name(input.into());
160        self
161    }
162    /// <p>A name for the snapshot copy. ElastiCache does not permit overwriting a snapshot, therefore this name must be unique within its context - ElastiCache or an Amazon S3 bucket if exporting.</p>
163    pub fn set_target_snapshot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
164        self.inner = self.inner.set_target_snapshot_name(input);
165        self
166    }
167    /// <p>A name for the snapshot copy. ElastiCache does not permit overwriting a snapshot, therefore this name must be unique within its context - ElastiCache or an Amazon S3 bucket if exporting.</p>
168    pub fn get_target_snapshot_name(&self) -> &::std::option::Option<::std::string::String> {
169        self.inner.get_target_snapshot_name()
170    }
171    /// <p>The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access.</p>
172    /// <p>When using this parameter to export a snapshot, be sure Amazon ElastiCache has the needed permissions to this S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html#backups-exporting-grant-access">Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket</a> in the <i>Amazon ElastiCache User Guide</i>.</p>
173    /// <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html">Exporting a Snapshot</a> in the <i>Amazon ElastiCache User Guide</i>.</p>
174    pub fn target_bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175        self.inner = self.inner.target_bucket(input.into());
176        self
177    }
178    /// <p>The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access.</p>
179    /// <p>When using this parameter to export a snapshot, be sure Amazon ElastiCache has the needed permissions to this S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html#backups-exporting-grant-access">Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket</a> in the <i>Amazon ElastiCache User Guide</i>.</p>
180    /// <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html">Exporting a Snapshot</a> in the <i>Amazon ElastiCache User Guide</i>.</p>
181    pub fn set_target_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182        self.inner = self.inner.set_target_bucket(input);
183        self
184    }
185    /// <p>The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access.</p>
186    /// <p>When using this parameter to export a snapshot, be sure Amazon ElastiCache has the needed permissions to this S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html#backups-exporting-grant-access">Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket</a> in the <i>Amazon ElastiCache User Guide</i>.</p>
187    /// <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/backups-exporting.html">Exporting a Snapshot</a> in the <i>Amazon ElastiCache User Guide</i>.</p>
188    pub fn get_target_bucket(&self) -> &::std::option::Option<::std::string::String> {
189        self.inner.get_target_bucket()
190    }
191    /// <p>The ID of the KMS key used to encrypt the target snapshot.</p>
192    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
193        self.inner = self.inner.kms_key_id(input.into());
194        self
195    }
196    /// <p>The ID of the KMS key used to encrypt the target snapshot.</p>
197    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
198        self.inner = self.inner.set_kms_key_id(input);
199        self
200    }
201    /// <p>The ID of the KMS key used to encrypt the target snapshot.</p>
202    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
203        self.inner.get_kms_key_id()
204    }
205    ///
206    /// Appends an item to `Tags`.
207    ///
208    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
209    ///
210    /// <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>
211    pub fn tags(mut self, input: crate::types::Tag) -> Self {
212        self.inner = self.inner.tags(input);
213        self
214    }
215    /// <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>
216    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
217        self.inner = self.inner.set_tags(input);
218        self
219    }
220    /// <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>
221    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
222        self.inner.get_tags()
223    }
224}