Skip to main content

aws_sdk_redshiftserverless/operation/create_snapshot/
_create_snapshot_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateSnapshotInput {
6    /// <p>The namespace to create a snapshot for.</p>
7    pub namespace_name: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the snapshot.</p>
9    pub snapshot_name: ::std::option::Option<::std::string::String>,
10    /// <p>How long to retain the created snapshot.</p>
11    pub retention_period: ::std::option::Option<i32>,
12    /// <p>An array of <a href="https://docs.aws.amazon.com/redshift-serverless/latest/APIReference/API_Tag.html">Tag objects</a> to associate with the snapshot.</p>
13    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
14}
15impl CreateSnapshotInput {
16    /// <p>The namespace to create a snapshot for.</p>
17    pub fn namespace_name(&self) -> ::std::option::Option<&str> {
18        self.namespace_name.as_deref()
19    }
20    /// <p>The name of the snapshot.</p>
21    pub fn snapshot_name(&self) -> ::std::option::Option<&str> {
22        self.snapshot_name.as_deref()
23    }
24    /// <p>How long to retain the created snapshot.</p>
25    pub fn retention_period(&self) -> ::std::option::Option<i32> {
26        self.retention_period
27    }
28    /// <p>An array of <a href="https://docs.aws.amazon.com/redshift-serverless/latest/APIReference/API_Tag.html">Tag objects</a> to associate with the snapshot.</p>
29    ///
30    /// 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()`.
31    pub fn tags(&self) -> &[crate::types::Tag] {
32        self.tags.as_deref().unwrap_or_default()
33    }
34}
35impl CreateSnapshotInput {
36    /// Creates a new builder-style object to manufacture [`CreateSnapshotInput`](crate::operation::create_snapshot::CreateSnapshotInput).
37    pub fn builder() -> crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder {
38        crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder::default()
39    }
40}
41
42/// A builder for [`CreateSnapshotInput`](crate::operation::create_snapshot::CreateSnapshotInput).
43#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
44#[non_exhaustive]
45pub struct CreateSnapshotInputBuilder {
46    pub(crate) namespace_name: ::std::option::Option<::std::string::String>,
47    pub(crate) snapshot_name: ::std::option::Option<::std::string::String>,
48    pub(crate) retention_period: ::std::option::Option<i32>,
49    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
50}
51impl CreateSnapshotInputBuilder {
52    /// <p>The namespace to create a snapshot for.</p>
53    /// This field is required.
54    pub fn namespace_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55        self.namespace_name = ::std::option::Option::Some(input.into());
56        self
57    }
58    /// <p>The namespace to create a snapshot for.</p>
59    pub fn set_namespace_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60        self.namespace_name = input;
61        self
62    }
63    /// <p>The namespace to create a snapshot for.</p>
64    pub fn get_namespace_name(&self) -> &::std::option::Option<::std::string::String> {
65        &self.namespace_name
66    }
67    /// <p>The name of the snapshot.</p>
68    /// This field is required.
69    pub fn snapshot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
70        self.snapshot_name = ::std::option::Option::Some(input.into());
71        self
72    }
73    /// <p>The name of the snapshot.</p>
74    pub fn set_snapshot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
75        self.snapshot_name = input;
76        self
77    }
78    /// <p>The name of the snapshot.</p>
79    pub fn get_snapshot_name(&self) -> &::std::option::Option<::std::string::String> {
80        &self.snapshot_name
81    }
82    /// <p>How long to retain the created snapshot.</p>
83    pub fn retention_period(mut self, input: i32) -> Self {
84        self.retention_period = ::std::option::Option::Some(input);
85        self
86    }
87    /// <p>How long to retain the created snapshot.</p>
88    pub fn set_retention_period(mut self, input: ::std::option::Option<i32>) -> Self {
89        self.retention_period = input;
90        self
91    }
92    /// <p>How long to retain the created snapshot.</p>
93    pub fn get_retention_period(&self) -> &::std::option::Option<i32> {
94        &self.retention_period
95    }
96    /// Appends an item to `tags`.
97    ///
98    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
99    ///
100    /// <p>An array of <a href="https://docs.aws.amazon.com/redshift-serverless/latest/APIReference/API_Tag.html">Tag objects</a> to associate with the snapshot.</p>
101    pub fn tags(mut self, input: crate::types::Tag) -> Self {
102        let mut v = self.tags.unwrap_or_default();
103        v.push(input);
104        self.tags = ::std::option::Option::Some(v);
105        self
106    }
107    /// <p>An array of <a href="https://docs.aws.amazon.com/redshift-serverless/latest/APIReference/API_Tag.html">Tag objects</a> to associate with the snapshot.</p>
108    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
109        self.tags = input;
110        self
111    }
112    /// <p>An array of <a href="https://docs.aws.amazon.com/redshift-serverless/latest/APIReference/API_Tag.html">Tag objects</a> to associate with the snapshot.</p>
113    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
114        &self.tags
115    }
116    /// Consumes the builder and constructs a [`CreateSnapshotInput`](crate::operation::create_snapshot::CreateSnapshotInput).
117    pub fn build(
118        self,
119    ) -> ::std::result::Result<crate::operation::create_snapshot::CreateSnapshotInput, ::aws_smithy_types::error::operation::BuildError> {
120        ::std::result::Result::Ok(crate::operation::create_snapshot::CreateSnapshotInput {
121            namespace_name: self.namespace_name,
122            snapshot_name: self.snapshot_name,
123            retention_period: self.retention_period,
124            tags: self.tags,
125        })
126    }
127}