aws_sdk_elasticache/operation/create_snapshot/
_create_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>CreateSnapshot</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateSnapshotInput {
7    /// <p>The identifier of an existing replication group. The snapshot is created from this replication group.</p>
8    pub replication_group_id: ::std::option::Option<::std::string::String>,
9    /// <p>The identifier of an existing cluster. The snapshot is created from this cluster.</p>
10    pub cache_cluster_id: ::std::option::Option<::std::string::String>,
11    /// <p>A name for the snapshot being created.</p>
12    pub snapshot_name: ::std::option::Option<::std::string::String>,
13    /// <p>The ID of the KMS key used to encrypt the snapshot.</p>
14    pub kms_key_id: ::std::option::Option<::std::string::String>,
15    /// <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>
16    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
17}
18impl CreateSnapshotInput {
19    /// <p>The identifier of an existing replication group. The snapshot is created from this replication group.</p>
20    pub fn replication_group_id(&self) -> ::std::option::Option<&str> {
21        self.replication_group_id.as_deref()
22    }
23    /// <p>The identifier of an existing cluster. The snapshot is created from this cluster.</p>
24    pub fn cache_cluster_id(&self) -> ::std::option::Option<&str> {
25        self.cache_cluster_id.as_deref()
26    }
27    /// <p>A name for the snapshot being created.</p>
28    pub fn snapshot_name(&self) -> ::std::option::Option<&str> {
29        self.snapshot_name.as_deref()
30    }
31    /// <p>The ID of the KMS key used to encrypt the snapshot.</p>
32    pub fn kms_key_id(&self) -> ::std::option::Option<&str> {
33        self.kms_key_id.as_deref()
34    }
35    /// <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>
36    ///
37    /// 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()`.
38    pub fn tags(&self) -> &[crate::types::Tag] {
39        self.tags.as_deref().unwrap_or_default()
40    }
41}
42impl CreateSnapshotInput {
43    /// Creates a new builder-style object to manufacture [`CreateSnapshotInput`](crate::operation::create_snapshot::CreateSnapshotInput).
44    pub fn builder() -> crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder {
45        crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder::default()
46    }
47}
48
49/// A builder for [`CreateSnapshotInput`](crate::operation::create_snapshot::CreateSnapshotInput).
50#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
51#[non_exhaustive]
52pub struct CreateSnapshotInputBuilder {
53    pub(crate) replication_group_id: ::std::option::Option<::std::string::String>,
54    pub(crate) cache_cluster_id: ::std::option::Option<::std::string::String>,
55    pub(crate) snapshot_name: ::std::option::Option<::std::string::String>,
56    pub(crate) kms_key_id: ::std::option::Option<::std::string::String>,
57    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
58}
59impl CreateSnapshotInputBuilder {
60    /// <p>The identifier of an existing replication group. The snapshot is created from this replication group.</p>
61    pub fn replication_group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.replication_group_id = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>The identifier of an existing replication group. The snapshot is created from this replication group.</p>
66    pub fn set_replication_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.replication_group_id = input;
68        self
69    }
70    /// <p>The identifier of an existing replication group. The snapshot is created from this replication group.</p>
71    pub fn get_replication_group_id(&self) -> &::std::option::Option<::std::string::String> {
72        &self.replication_group_id
73    }
74    /// <p>The identifier of an existing cluster. The snapshot is created from this cluster.</p>
75    pub fn cache_cluster_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.cache_cluster_id = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The identifier of an existing cluster. The snapshot is created from this cluster.</p>
80    pub fn set_cache_cluster_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.cache_cluster_id = input;
82        self
83    }
84    /// <p>The identifier of an existing cluster. The snapshot is created from this cluster.</p>
85    pub fn get_cache_cluster_id(&self) -> &::std::option::Option<::std::string::String> {
86        &self.cache_cluster_id
87    }
88    /// <p>A name for the snapshot being created.</p>
89    /// This field is required.
90    pub fn snapshot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.snapshot_name = ::std::option::Option::Some(input.into());
92        self
93    }
94    /// <p>A name for the snapshot being created.</p>
95    pub fn set_snapshot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.snapshot_name = input;
97        self
98    }
99    /// <p>A name for the snapshot being created.</p>
100    pub fn get_snapshot_name(&self) -> &::std::option::Option<::std::string::String> {
101        &self.snapshot_name
102    }
103    /// <p>The ID of the KMS key used to encrypt the snapshot.</p>
104    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.kms_key_id = ::std::option::Option::Some(input.into());
106        self
107    }
108    /// <p>The ID of the KMS key used to encrypt the snapshot.</p>
109    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110        self.kms_key_id = input;
111        self
112    }
113    /// <p>The ID of the KMS key used to encrypt the snapshot.</p>
114    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
115        &self.kms_key_id
116    }
117    /// Appends an item to `tags`.
118    ///
119    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
120    ///
121    /// <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>
122    pub fn tags(mut self, input: crate::types::Tag) -> Self {
123        let mut v = self.tags.unwrap_or_default();
124        v.push(input);
125        self.tags = ::std::option::Option::Some(v);
126        self
127    }
128    /// <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>
129    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
130        self.tags = input;
131        self
132    }
133    /// <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>
134    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
135        &self.tags
136    }
137    /// Consumes the builder and constructs a [`CreateSnapshotInput`](crate::operation::create_snapshot::CreateSnapshotInput).
138    pub fn build(
139        self,
140    ) -> ::std::result::Result<crate::operation::create_snapshot::CreateSnapshotInput, ::aws_smithy_types::error::operation::BuildError> {
141        ::std::result::Result::Ok(crate::operation::create_snapshot::CreateSnapshotInput {
142            replication_group_id: self.replication_group_id,
143            cache_cluster_id: self.cache_cluster_id,
144            snapshot_name: self.snapshot_name,
145            kms_key_id: self.kms_key_id,
146            tags: self.tags,
147        })
148    }
149}