aws_sdk_timestreamwrite/operation/create_database/_create_database_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 CreateDatabaseInput {
6 /// <p>The name of the Timestream database.</p>
7 pub database_name: ::std::option::Option<::std::string::String>,
8 /// <p>The KMS key for the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed keys</a>.</p>
9 pub kms_key_id: ::std::option::Option<::std::string::String>,
10 /// <p>A list of key-value pairs to label the table.</p>
11 pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
12}
13impl CreateDatabaseInput {
14 /// <p>The name of the Timestream database.</p>
15 pub fn database_name(&self) -> ::std::option::Option<&str> {
16 self.database_name.as_deref()
17 }
18 /// <p>The KMS key for the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed keys</a>.</p>
19 pub fn kms_key_id(&self) -> ::std::option::Option<&str> {
20 self.kms_key_id.as_deref()
21 }
22 /// <p>A list of key-value pairs to label the table.</p>
23 ///
24 /// 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()`.
25 pub fn tags(&self) -> &[crate::types::Tag] {
26 self.tags.as_deref().unwrap_or_default()
27 }
28}
29impl CreateDatabaseInput {
30 /// Creates a new builder-style object to manufacture [`CreateDatabaseInput`](crate::operation::create_database::CreateDatabaseInput).
31 pub fn builder() -> crate::operation::create_database::builders::CreateDatabaseInputBuilder {
32 crate::operation::create_database::builders::CreateDatabaseInputBuilder::default()
33 }
34}
35
36/// A builder for [`CreateDatabaseInput`](crate::operation::create_database::CreateDatabaseInput).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct CreateDatabaseInputBuilder {
40 pub(crate) database_name: ::std::option::Option<::std::string::String>,
41 pub(crate) kms_key_id: ::std::option::Option<::std::string::String>,
42 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
43}
44impl CreateDatabaseInputBuilder {
45 /// <p>The name of the Timestream database.</p>
46 /// This field is required.
47 pub fn database_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
48 self.database_name = ::std::option::Option::Some(input.into());
49 self
50 }
51 /// <p>The name of the Timestream database.</p>
52 pub fn set_database_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
53 self.database_name = input;
54 self
55 }
56 /// <p>The name of the Timestream database.</p>
57 pub fn get_database_name(&self) -> &::std::option::Option<::std::string::String> {
58 &self.database_name
59 }
60 /// <p>The KMS key for the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed keys</a>.</p>
61 pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62 self.kms_key_id = ::std::option::Option::Some(input.into());
63 self
64 }
65 /// <p>The KMS key for the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed keys</a>.</p>
66 pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67 self.kms_key_id = input;
68 self
69 }
70 /// <p>The KMS key for the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed keys</a>.</p>
71 pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
72 &self.kms_key_id
73 }
74 /// Appends an item to `tags`.
75 ///
76 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
77 ///
78 /// <p>A list of key-value pairs to label the table.</p>
79 pub fn tags(mut self, input: crate::types::Tag) -> Self {
80 let mut v = self.tags.unwrap_or_default();
81 v.push(input);
82 self.tags = ::std::option::Option::Some(v);
83 self
84 }
85 /// <p>A list of key-value pairs to label the table.</p>
86 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
87 self.tags = input;
88 self
89 }
90 /// <p>A list of key-value pairs to label the table.</p>
91 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
92 &self.tags
93 }
94 /// Consumes the builder and constructs a [`CreateDatabaseInput`](crate::operation::create_database::CreateDatabaseInput).
95 pub fn build(
96 self,
97 ) -> ::std::result::Result<crate::operation::create_database::CreateDatabaseInput, ::aws_smithy_types::error::operation::BuildError> {
98 ::std::result::Result::Ok(crate::operation::create_database::CreateDatabaseInput {
99 database_name: self.database_name,
100 kms_key_id: self.kms_key_id,
101 tags: self.tags,
102 })
103 }
104}