aws_sdk_fsx/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>(Optional) An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
7    pub client_request_token: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the snapshot.</p>
9    pub name: ::std::option::Option<::std::string::String>,
10    /// <p>The ID of the volume that you are taking a snapshot of.</p>
11    pub volume_id: ::std::option::Option<::std::string::String>,
12    /// <p>A list of <code>Tag</code> values, with a maximum of 50 elements.</p>
13    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
14}
15impl CreateSnapshotInput {
16    /// <p>(Optional) An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
17    pub fn client_request_token(&self) -> ::std::option::Option<&str> {
18        self.client_request_token.as_deref()
19    }
20    /// <p>The name of the snapshot.</p>
21    pub fn name(&self) -> ::std::option::Option<&str> {
22        self.name.as_deref()
23    }
24    /// <p>The ID of the volume that you are taking a snapshot of.</p>
25    pub fn volume_id(&self) -> ::std::option::Option<&str> {
26        self.volume_id.as_deref()
27    }
28    /// <p>A list of <code>Tag</code> values, with a maximum of 50 elements.</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) client_request_token: ::std::option::Option<::std::string::String>,
47    pub(crate) name: ::std::option::Option<::std::string::String>,
48    pub(crate) volume_id: ::std::option::Option<::std::string::String>,
49    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
50}
51impl CreateSnapshotInputBuilder {
52    /// <p>(Optional) An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
53    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
54        self.client_request_token = ::std::option::Option::Some(input.into());
55        self
56    }
57    /// <p>(Optional) An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
58    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
59        self.client_request_token = input;
60        self
61    }
62    /// <p>(Optional) An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
63    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
64        &self.client_request_token
65    }
66    /// <p>The name of the snapshot.</p>
67    /// This field is required.
68    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.name = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>The name of the snapshot.</p>
73    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.name = input;
75        self
76    }
77    /// <p>The name of the snapshot.</p>
78    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
79        &self.name
80    }
81    /// <p>The ID of the volume that you are taking a snapshot of.</p>
82    /// This field is required.
83    pub fn volume_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.volume_id = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>The ID of the volume that you are taking a snapshot of.</p>
88    pub fn set_volume_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.volume_id = input;
90        self
91    }
92    /// <p>The ID of the volume that you are taking a snapshot of.</p>
93    pub fn get_volume_id(&self) -> &::std::option::Option<::std::string::String> {
94        &self.volume_id
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>A list of <code>Tag</code> values, with a maximum of 50 elements.</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>A list of <code>Tag</code> values, with a maximum of 50 elements.</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>A list of <code>Tag</code> values, with a maximum of 50 elements.</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            client_request_token: self.client_request_token,
122            name: self.name,
123            volume_id: self.volume_id,
124            tags: self.tags,
125        })
126    }
127}