aws_sdk_mailmanager/operation/create_archive/
_create_archive_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The request to create a new email archive.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateArchiveInput {
7    /// <p>A unique token Amazon SES uses to recognize retries of this request.</p>
8    pub client_token: ::std::option::Option<::std::string::String>,
9    /// <p>A unique name for the new archive.</p>
10    pub archive_name: ::std::option::Option<::std::string::String>,
11    /// <p>The period for retaining emails in the archive before automatic deletion.</p>
12    pub retention: ::std::option::Option<crate::types::ArchiveRetention>,
13    /// <p>The Amazon Resource Name (ARN) of the KMS key for encrypting emails in the archive.</p>
14    pub kms_key_arn: ::std::option::Option<::std::string::String>,
15    /// <p>The tags used to organize, track, or control access for the resource. For example, { "tags": {"key1":"value1", "key2":"value2"} }.</p>
16    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
17}
18impl CreateArchiveInput {
19    /// <p>A unique token Amazon SES uses to recognize retries of this request.</p>
20    pub fn client_token(&self) -> ::std::option::Option<&str> {
21        self.client_token.as_deref()
22    }
23    /// <p>A unique name for the new archive.</p>
24    pub fn archive_name(&self) -> ::std::option::Option<&str> {
25        self.archive_name.as_deref()
26    }
27    /// <p>The period for retaining emails in the archive before automatic deletion.</p>
28    pub fn retention(&self) -> ::std::option::Option<&crate::types::ArchiveRetention> {
29        self.retention.as_ref()
30    }
31    /// <p>The Amazon Resource Name (ARN) of the KMS key for encrypting emails in the archive.</p>
32    pub fn kms_key_arn(&self) -> ::std::option::Option<&str> {
33        self.kms_key_arn.as_deref()
34    }
35    /// <p>The tags used to organize, track, or control access for the resource. For example, { "tags": {"key1":"value1", "key2":"value2"} }.</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 CreateArchiveInput {
43    /// Creates a new builder-style object to manufacture [`CreateArchiveInput`](crate::operation::create_archive::CreateArchiveInput).
44    pub fn builder() -> crate::operation::create_archive::builders::CreateArchiveInputBuilder {
45        crate::operation::create_archive::builders::CreateArchiveInputBuilder::default()
46    }
47}
48
49/// A builder for [`CreateArchiveInput`](crate::operation::create_archive::CreateArchiveInput).
50#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
51#[non_exhaustive]
52pub struct CreateArchiveInputBuilder {
53    pub(crate) client_token: ::std::option::Option<::std::string::String>,
54    pub(crate) archive_name: ::std::option::Option<::std::string::String>,
55    pub(crate) retention: ::std::option::Option<crate::types::ArchiveRetention>,
56    pub(crate) kms_key_arn: ::std::option::Option<::std::string::String>,
57    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
58}
59impl CreateArchiveInputBuilder {
60    /// <p>A unique token Amazon SES uses to recognize retries of this request.</p>
61    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.client_token = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>A unique token Amazon SES uses to recognize retries of this request.</p>
66    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.client_token = input;
68        self
69    }
70    /// <p>A unique token Amazon SES uses to recognize retries of this request.</p>
71    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
72        &self.client_token
73    }
74    /// <p>A unique name for the new archive.</p>
75    /// This field is required.
76    pub fn archive_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77        self.archive_name = ::std::option::Option::Some(input.into());
78        self
79    }
80    /// <p>A unique name for the new archive.</p>
81    pub fn set_archive_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82        self.archive_name = input;
83        self
84    }
85    /// <p>A unique name for the new archive.</p>
86    pub fn get_archive_name(&self) -> &::std::option::Option<::std::string::String> {
87        &self.archive_name
88    }
89    /// <p>The period for retaining emails in the archive before automatic deletion.</p>
90    pub fn retention(mut self, input: crate::types::ArchiveRetention) -> Self {
91        self.retention = ::std::option::Option::Some(input);
92        self
93    }
94    /// <p>The period for retaining emails in the archive before automatic deletion.</p>
95    pub fn set_retention(mut self, input: ::std::option::Option<crate::types::ArchiveRetention>) -> Self {
96        self.retention = input;
97        self
98    }
99    /// <p>The period for retaining emails in the archive before automatic deletion.</p>
100    pub fn get_retention(&self) -> &::std::option::Option<crate::types::ArchiveRetention> {
101        &self.retention
102    }
103    /// <p>The Amazon Resource Name (ARN) of the KMS key for encrypting emails in the archive.</p>
104    pub fn kms_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.kms_key_arn = ::std::option::Option::Some(input.into());
106        self
107    }
108    /// <p>The Amazon Resource Name (ARN) of the KMS key for encrypting emails in the archive.</p>
109    pub fn set_kms_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110        self.kms_key_arn = input;
111        self
112    }
113    /// <p>The Amazon Resource Name (ARN) of the KMS key for encrypting emails in the archive.</p>
114    pub fn get_kms_key_arn(&self) -> &::std::option::Option<::std::string::String> {
115        &self.kms_key_arn
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>The tags used to organize, track, or control access for the resource. For example, { "tags": {"key1":"value1", "key2":"value2"} }.</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>The tags used to organize, track, or control access for the resource. For example, { "tags": {"key1":"value1", "key2":"value2"} }.</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>The tags used to organize, track, or control access for the resource. For example, { "tags": {"key1":"value1", "key2":"value2"} }.</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 [`CreateArchiveInput`](crate::operation::create_archive::CreateArchiveInput).
138    pub fn build(
139        self,
140    ) -> ::std::result::Result<crate::operation::create_archive::CreateArchiveInput, ::aws_smithy_types::error::operation::BuildError> {
141        ::std::result::Result::Ok(crate::operation::create_archive::CreateArchiveInput {
142            client_token: self.client_token,
143            archive_name: self.archive_name,
144            retention: self.retention,
145            kms_key_arn: self.kms_key_arn,
146            tags: self.tags,
147        })
148    }
149}