aws_sdk_timestreamwrite/operation/create_table/
_create_table_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 CreateTableInput {
6    /// <p>The name of the Timestream database.</p>
7    pub database_name: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the Timestream table.</p>
9    pub table_name: ::std::option::Option<::std::string::String>,
10    /// <p>The duration for which your time-series data must be stored in the memory store and the magnetic store.</p>
11    pub retention_properties: ::std::option::Option<crate::types::RetentionProperties>,
12    /// <p>A list of key-value pairs to label the table.</p>
13    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
14    /// <p>Contains properties to set on the table when enabling magnetic store writes.</p>
15    pub magnetic_store_write_properties: ::std::option::Option<crate::types::MagneticStoreWriteProperties>,
16    /// <p>The schema of the table.</p>
17    pub schema: ::std::option::Option<crate::types::Schema>,
18}
19impl CreateTableInput {
20    /// <p>The name of the Timestream database.</p>
21    pub fn database_name(&self) -> ::std::option::Option<&str> {
22        self.database_name.as_deref()
23    }
24    /// <p>The name of the Timestream table.</p>
25    pub fn table_name(&self) -> ::std::option::Option<&str> {
26        self.table_name.as_deref()
27    }
28    /// <p>The duration for which your time-series data must be stored in the memory store and the magnetic store.</p>
29    pub fn retention_properties(&self) -> ::std::option::Option<&crate::types::RetentionProperties> {
30        self.retention_properties.as_ref()
31    }
32    /// <p>A list of key-value pairs to label the table.</p>
33    ///
34    /// 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()`.
35    pub fn tags(&self) -> &[crate::types::Tag] {
36        self.tags.as_deref().unwrap_or_default()
37    }
38    /// <p>Contains properties to set on the table when enabling magnetic store writes.</p>
39    pub fn magnetic_store_write_properties(&self) -> ::std::option::Option<&crate::types::MagneticStoreWriteProperties> {
40        self.magnetic_store_write_properties.as_ref()
41    }
42    /// <p>The schema of the table.</p>
43    pub fn schema(&self) -> ::std::option::Option<&crate::types::Schema> {
44        self.schema.as_ref()
45    }
46}
47impl CreateTableInput {
48    /// Creates a new builder-style object to manufacture [`CreateTableInput`](crate::operation::create_table::CreateTableInput).
49    pub fn builder() -> crate::operation::create_table::builders::CreateTableInputBuilder {
50        crate::operation::create_table::builders::CreateTableInputBuilder::default()
51    }
52}
53
54/// A builder for [`CreateTableInput`](crate::operation::create_table::CreateTableInput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct CreateTableInputBuilder {
58    pub(crate) database_name: ::std::option::Option<::std::string::String>,
59    pub(crate) table_name: ::std::option::Option<::std::string::String>,
60    pub(crate) retention_properties: ::std::option::Option<crate::types::RetentionProperties>,
61    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
62    pub(crate) magnetic_store_write_properties: ::std::option::Option<crate::types::MagneticStoreWriteProperties>,
63    pub(crate) schema: ::std::option::Option<crate::types::Schema>,
64}
65impl CreateTableInputBuilder {
66    /// <p>The name of the Timestream database.</p>
67    /// This field is required.
68    pub fn database_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.database_name = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>The name of the Timestream database.</p>
73    pub fn set_database_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.database_name = input;
75        self
76    }
77    /// <p>The name of the Timestream database.</p>
78    pub fn get_database_name(&self) -> &::std::option::Option<::std::string::String> {
79        &self.database_name
80    }
81    /// <p>The name of the Timestream table.</p>
82    /// This field is required.
83    pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.table_name = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>The name of the Timestream table.</p>
88    pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.table_name = input;
90        self
91    }
92    /// <p>The name of the Timestream table.</p>
93    pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
94        &self.table_name
95    }
96    /// <p>The duration for which your time-series data must be stored in the memory store and the magnetic store.</p>
97    pub fn retention_properties(mut self, input: crate::types::RetentionProperties) -> Self {
98        self.retention_properties = ::std::option::Option::Some(input);
99        self
100    }
101    /// <p>The duration for which your time-series data must be stored in the memory store and the magnetic store.</p>
102    pub fn set_retention_properties(mut self, input: ::std::option::Option<crate::types::RetentionProperties>) -> Self {
103        self.retention_properties = input;
104        self
105    }
106    /// <p>The duration for which your time-series data must be stored in the memory store and the magnetic store.</p>
107    pub fn get_retention_properties(&self) -> &::std::option::Option<crate::types::RetentionProperties> {
108        &self.retention_properties
109    }
110    /// Appends an item to `tags`.
111    ///
112    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
113    ///
114    /// <p>A list of key-value pairs to label the table.</p>
115    pub fn tags(mut self, input: crate::types::Tag) -> Self {
116        let mut v = self.tags.unwrap_or_default();
117        v.push(input);
118        self.tags = ::std::option::Option::Some(v);
119        self
120    }
121    /// <p>A list of key-value pairs to label the table.</p>
122    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
123        self.tags = input;
124        self
125    }
126    /// <p>A list of key-value pairs to label the table.</p>
127    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
128        &self.tags
129    }
130    /// <p>Contains properties to set on the table when enabling magnetic store writes.</p>
131    pub fn magnetic_store_write_properties(mut self, input: crate::types::MagneticStoreWriteProperties) -> Self {
132        self.magnetic_store_write_properties = ::std::option::Option::Some(input);
133        self
134    }
135    /// <p>Contains properties to set on the table when enabling magnetic store writes.</p>
136    pub fn set_magnetic_store_write_properties(mut self, input: ::std::option::Option<crate::types::MagneticStoreWriteProperties>) -> Self {
137        self.magnetic_store_write_properties = input;
138        self
139    }
140    /// <p>Contains properties to set on the table when enabling magnetic store writes.</p>
141    pub fn get_magnetic_store_write_properties(&self) -> &::std::option::Option<crate::types::MagneticStoreWriteProperties> {
142        &self.magnetic_store_write_properties
143    }
144    /// <p>The schema of the table.</p>
145    pub fn schema(mut self, input: crate::types::Schema) -> Self {
146        self.schema = ::std::option::Option::Some(input);
147        self
148    }
149    /// <p>The schema of the table.</p>
150    pub fn set_schema(mut self, input: ::std::option::Option<crate::types::Schema>) -> Self {
151        self.schema = input;
152        self
153    }
154    /// <p>The schema of the table.</p>
155    pub fn get_schema(&self) -> &::std::option::Option<crate::types::Schema> {
156        &self.schema
157    }
158    /// Consumes the builder and constructs a [`CreateTableInput`](crate::operation::create_table::CreateTableInput).
159    pub fn build(self) -> ::std::result::Result<crate::operation::create_table::CreateTableInput, ::aws_smithy_types::error::operation::BuildError> {
160        ::std::result::Result::Ok(crate::operation::create_table::CreateTableInput {
161            database_name: self.database_name,
162            table_name: self.table_name,
163            retention_properties: self.retention_properties,
164            tags: self.tags,
165            magnetic_store_write_properties: self.magnetic_store_write_properties,
166            schema: self.schema,
167        })
168    }
169}