aws_sdk_elasticache/operation/copy_snapshot/
_copy_snapshot_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents the input of a <code>CopySnapshotMessage</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CopySnapshotInput {
7    /// <p>The name of an existing snapshot from which to make a copy.</p>
8    pub source_snapshot_name: ::std::option::Option<::std::string::String>,
9    /// <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>
10    pub target_snapshot_name: ::std::option::Option<::std::string::String>,
11    /// <p>The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access.</p>
12    /// <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>
13    /// <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>
14    pub target_bucket: ::std::option::Option<::std::string::String>,
15    /// <p>The ID of the KMS key used to encrypt the target snapshot.</p>
16    pub kms_key_id: ::std::option::Option<::std::string::String>,
17    /// <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>
18    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
19}
20impl CopySnapshotInput {
21    /// <p>The name of an existing snapshot from which to make a copy.</p>
22    pub fn source_snapshot_name(&self) -> ::std::option::Option<&str> {
23        self.source_snapshot_name.as_deref()
24    }
25    /// <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>
26    pub fn target_snapshot_name(&self) -> ::std::option::Option<&str> {
27        self.target_snapshot_name.as_deref()
28    }
29    /// <p>The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access.</p>
30    /// <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>
31    /// <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>
32    pub fn target_bucket(&self) -> ::std::option::Option<&str> {
33        self.target_bucket.as_deref()
34    }
35    /// <p>The ID of the KMS key used to encrypt the target snapshot.</p>
36    pub fn kms_key_id(&self) -> ::std::option::Option<&str> {
37        self.kms_key_id.as_deref()
38    }
39    /// <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>
40    ///
41    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
42    pub fn tags(&self) -> &[crate::types::Tag] {
43        self.tags.as_deref().unwrap_or_default()
44    }
45}
46impl CopySnapshotInput {
47    /// Creates a new builder-style object to manufacture [`CopySnapshotInput`](crate::operation::copy_snapshot::CopySnapshotInput).
48    pub fn builder() -> crate::operation::copy_snapshot::builders::CopySnapshotInputBuilder {
49        crate::operation::copy_snapshot::builders::CopySnapshotInputBuilder::default()
50    }
51}
52
53/// A builder for [`CopySnapshotInput`](crate::operation::copy_snapshot::CopySnapshotInput).
54#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
55#[non_exhaustive]
56pub struct CopySnapshotInputBuilder {
57    pub(crate) source_snapshot_name: ::std::option::Option<::std::string::String>,
58    pub(crate) target_snapshot_name: ::std::option::Option<::std::string::String>,
59    pub(crate) target_bucket: ::std::option::Option<::std::string::String>,
60    pub(crate) kms_key_id: ::std::option::Option<::std::string::String>,
61    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
62}
63impl CopySnapshotInputBuilder {
64    /// <p>The name of an existing snapshot from which to make a copy.</p>
65    /// This field is required.
66    pub fn source_snapshot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
67        self.source_snapshot_name = ::std::option::Option::Some(input.into());
68        self
69    }
70    /// <p>The name of an existing snapshot from which to make a copy.</p>
71    pub fn set_source_snapshot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72        self.source_snapshot_name = input;
73        self
74    }
75    /// <p>The name of an existing snapshot from which to make a copy.</p>
76    pub fn get_source_snapshot_name(&self) -> &::std::option::Option<::std::string::String> {
77        &self.source_snapshot_name
78    }
79    /// <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>
80    /// This field is required.
81    pub fn target_snapshot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82        self.target_snapshot_name = ::std::option::Option::Some(input.into());
83        self
84    }
85    /// <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>
86    pub fn set_target_snapshot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87        self.target_snapshot_name = input;
88        self
89    }
90    /// <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>
91    pub fn get_target_snapshot_name(&self) -> &::std::option::Option<::std::string::String> {
92        &self.target_snapshot_name
93    }
94    /// <p>The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access.</p>
95    /// <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>
96    /// <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>
97    pub fn target_bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98        self.target_bucket = ::std::option::Option::Some(input.into());
99        self
100    }
101    /// <p>The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access.</p>
102    /// <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>
103    /// <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>
104    pub fn set_target_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
105        self.target_bucket = input;
106        self
107    }
108    /// <p>The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access.</p>
109    /// <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>
110    /// <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>
111    pub fn get_target_bucket(&self) -> &::std::option::Option<::std::string::String> {
112        &self.target_bucket
113    }
114    /// <p>The ID of the KMS key used to encrypt the target snapshot.</p>
115    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.kms_key_id = ::std::option::Option::Some(input.into());
117        self
118    }
119    /// <p>The ID of the KMS key used to encrypt the target snapshot.</p>
120    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.kms_key_id = input;
122        self
123    }
124    /// <p>The ID of the KMS key used to encrypt the target snapshot.</p>
125    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
126        &self.kms_key_id
127    }
128    /// Appends an item to `tags`.
129    ///
130    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
131    ///
132    /// <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>
133    pub fn tags(mut self, input: crate::types::Tag) -> Self {
134        let mut v = self.tags.unwrap_or_default();
135        v.push(input);
136        self.tags = ::std::option::Option::Some(v);
137        self
138    }
139    /// <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>
140    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
141        self.tags = input;
142        self
143    }
144    /// <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>
145    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
146        &self.tags
147    }
148    /// Consumes the builder and constructs a [`CopySnapshotInput`](crate::operation::copy_snapshot::CopySnapshotInput).
149    pub fn build(
150        self,
151    ) -> ::std::result::Result<crate::operation::copy_snapshot::CopySnapshotInput, ::aws_smithy_types::error::operation::BuildError> {
152        ::std::result::Result::Ok(crate::operation::copy_snapshot::CopySnapshotInput {
153            source_snapshot_name: self.source_snapshot_name,
154            target_snapshot_name: self.target_snapshot_name,
155            target_bucket: self.target_bucket,
156            kms_key_id: self.kms_key_id,
157            tags: self.tags,
158        })
159    }
160}