aws_sdk_glue/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 ID of the Data Catalog in which to create the <code>Table</code>. If none is supplied, the Amazon Web Services account ID is used by default.</p>
7    pub catalog_id: ::std::option::Option<::std::string::String>,
8    /// <p>The catalog database in which to create the new table. For Hive compatibility, this name is entirely lowercase.</p>
9    pub database_name: ::std::option::Option<::std::string::String>,
10    /// <p>The unique identifier for the table within the specified database that will be created in the Glue Data Catalog.</p>
11    pub name: ::std::option::Option<::std::string::String>,
12    /// <p>The <code>TableInput</code> object that defines the metadata table to create in the catalog.</p>
13    pub table_input: ::std::option::Option<crate::types::TableInput>,
14    /// <p>A list of partition indexes, <code>PartitionIndex</code> structures, to create in the table.</p>
15    pub partition_indexes: ::std::option::Option<::std::vec::Vec<crate::types::PartitionIndex>>,
16    /// <p>The ID of the transaction.</p>
17    pub transaction_id: ::std::option::Option<::std::string::String>,
18    /// <p>Specifies an <code>OpenTableFormatInput</code> structure when creating an open format table.</p>
19    pub open_table_format_input: ::std::option::Option<crate::types::OpenTableFormatInput>,
20}
21impl CreateTableInput {
22    /// <p>The ID of the Data Catalog in which to create the <code>Table</code>. If none is supplied, the Amazon Web Services account ID is used by default.</p>
23    pub fn catalog_id(&self) -> ::std::option::Option<&str> {
24        self.catalog_id.as_deref()
25    }
26    /// <p>The catalog database in which to create the new table. For Hive compatibility, this name is entirely lowercase.</p>
27    pub fn database_name(&self) -> ::std::option::Option<&str> {
28        self.database_name.as_deref()
29    }
30    /// <p>The unique identifier for the table within the specified database that will be created in the Glue Data Catalog.</p>
31    pub fn name(&self) -> ::std::option::Option<&str> {
32        self.name.as_deref()
33    }
34    /// <p>The <code>TableInput</code> object that defines the metadata table to create in the catalog.</p>
35    pub fn table_input(&self) -> ::std::option::Option<&crate::types::TableInput> {
36        self.table_input.as_ref()
37    }
38    /// <p>A list of partition indexes, <code>PartitionIndex</code> structures, to create in the table.</p>
39    ///
40    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.partition_indexes.is_none()`.
41    pub fn partition_indexes(&self) -> &[crate::types::PartitionIndex] {
42        self.partition_indexes.as_deref().unwrap_or_default()
43    }
44    /// <p>The ID of the transaction.</p>
45    pub fn transaction_id(&self) -> ::std::option::Option<&str> {
46        self.transaction_id.as_deref()
47    }
48    /// <p>Specifies an <code>OpenTableFormatInput</code> structure when creating an open format table.</p>
49    pub fn open_table_format_input(&self) -> ::std::option::Option<&crate::types::OpenTableFormatInput> {
50        self.open_table_format_input.as_ref()
51    }
52}
53impl CreateTableInput {
54    /// Creates a new builder-style object to manufacture [`CreateTableInput`](crate::operation::create_table::CreateTableInput).
55    pub fn builder() -> crate::operation::create_table::builders::CreateTableInputBuilder {
56        crate::operation::create_table::builders::CreateTableInputBuilder::default()
57    }
58}
59
60/// A builder for [`CreateTableInput`](crate::operation::create_table::CreateTableInput).
61#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
62#[non_exhaustive]
63pub struct CreateTableInputBuilder {
64    pub(crate) catalog_id: ::std::option::Option<::std::string::String>,
65    pub(crate) database_name: ::std::option::Option<::std::string::String>,
66    pub(crate) name: ::std::option::Option<::std::string::String>,
67    pub(crate) table_input: ::std::option::Option<crate::types::TableInput>,
68    pub(crate) partition_indexes: ::std::option::Option<::std::vec::Vec<crate::types::PartitionIndex>>,
69    pub(crate) transaction_id: ::std::option::Option<::std::string::String>,
70    pub(crate) open_table_format_input: ::std::option::Option<crate::types::OpenTableFormatInput>,
71}
72impl CreateTableInputBuilder {
73    /// <p>The ID of the Data Catalog in which to create the <code>Table</code>. If none is supplied, the Amazon Web Services account ID is used by default.</p>
74    pub fn catalog_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
75        self.catalog_id = ::std::option::Option::Some(input.into());
76        self
77    }
78    /// <p>The ID of the Data Catalog in which to create the <code>Table</code>. If none is supplied, the Amazon Web Services account ID is used by default.</p>
79    pub fn set_catalog_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
80        self.catalog_id = input;
81        self
82    }
83    /// <p>The ID of the Data Catalog in which to create the <code>Table</code>. If none is supplied, the Amazon Web Services account ID is used by default.</p>
84    pub fn get_catalog_id(&self) -> &::std::option::Option<::std::string::String> {
85        &self.catalog_id
86    }
87    /// <p>The catalog database in which to create the new table. For Hive compatibility, this name is entirely lowercase.</p>
88    /// This field is required.
89    pub fn database_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
90        self.database_name = ::std::option::Option::Some(input.into());
91        self
92    }
93    /// <p>The catalog database in which to create the new table. For Hive compatibility, this name is entirely lowercase.</p>
94    pub fn set_database_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
95        self.database_name = input;
96        self
97    }
98    /// <p>The catalog database in which to create the new table. For Hive compatibility, this name is entirely lowercase.</p>
99    pub fn get_database_name(&self) -> &::std::option::Option<::std::string::String> {
100        &self.database_name
101    }
102    /// <p>The unique identifier for the table within the specified database that will be created in the Glue Data Catalog.</p>
103    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.name = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>The unique identifier for the table within the specified database that will be created in the Glue Data Catalog.</p>
108    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.name = input;
110        self
111    }
112    /// <p>The unique identifier for the table within the specified database that will be created in the Glue Data Catalog.</p>
113    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
114        &self.name
115    }
116    /// <p>The <code>TableInput</code> object that defines the metadata table to create in the catalog.</p>
117    pub fn table_input(mut self, input: crate::types::TableInput) -> Self {
118        self.table_input = ::std::option::Option::Some(input);
119        self
120    }
121    /// <p>The <code>TableInput</code> object that defines the metadata table to create in the catalog.</p>
122    pub fn set_table_input(mut self, input: ::std::option::Option<crate::types::TableInput>) -> Self {
123        self.table_input = input;
124        self
125    }
126    /// <p>The <code>TableInput</code> object that defines the metadata table to create in the catalog.</p>
127    pub fn get_table_input(&self) -> &::std::option::Option<crate::types::TableInput> {
128        &self.table_input
129    }
130    /// Appends an item to `partition_indexes`.
131    ///
132    /// To override the contents of this collection use [`set_partition_indexes`](Self::set_partition_indexes).
133    ///
134    /// <p>A list of partition indexes, <code>PartitionIndex</code> structures, to create in the table.</p>
135    pub fn partition_indexes(mut self, input: crate::types::PartitionIndex) -> Self {
136        let mut v = self.partition_indexes.unwrap_or_default();
137        v.push(input);
138        self.partition_indexes = ::std::option::Option::Some(v);
139        self
140    }
141    /// <p>A list of partition indexes, <code>PartitionIndex</code> structures, to create in the table.</p>
142    pub fn set_partition_indexes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PartitionIndex>>) -> Self {
143        self.partition_indexes = input;
144        self
145    }
146    /// <p>A list of partition indexes, <code>PartitionIndex</code> structures, to create in the table.</p>
147    pub fn get_partition_indexes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PartitionIndex>> {
148        &self.partition_indexes
149    }
150    /// <p>The ID of the transaction.</p>
151    pub fn transaction_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152        self.transaction_id = ::std::option::Option::Some(input.into());
153        self
154    }
155    /// <p>The ID of the transaction.</p>
156    pub fn set_transaction_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157        self.transaction_id = input;
158        self
159    }
160    /// <p>The ID of the transaction.</p>
161    pub fn get_transaction_id(&self) -> &::std::option::Option<::std::string::String> {
162        &self.transaction_id
163    }
164    /// <p>Specifies an <code>OpenTableFormatInput</code> structure when creating an open format table.</p>
165    pub fn open_table_format_input(mut self, input: crate::types::OpenTableFormatInput) -> Self {
166        self.open_table_format_input = ::std::option::Option::Some(input);
167        self
168    }
169    /// <p>Specifies an <code>OpenTableFormatInput</code> structure when creating an open format table.</p>
170    pub fn set_open_table_format_input(mut self, input: ::std::option::Option<crate::types::OpenTableFormatInput>) -> Self {
171        self.open_table_format_input = input;
172        self
173    }
174    /// <p>Specifies an <code>OpenTableFormatInput</code> structure when creating an open format table.</p>
175    pub fn get_open_table_format_input(&self) -> &::std::option::Option<crate::types::OpenTableFormatInput> {
176        &self.open_table_format_input
177    }
178    /// Consumes the builder and constructs a [`CreateTableInput`](crate::operation::create_table::CreateTableInput).
179    pub fn build(self) -> ::std::result::Result<crate::operation::create_table::CreateTableInput, ::aws_smithy_types::error::operation::BuildError> {
180        ::std::result::Result::Ok(crate::operation::create_table::CreateTableInput {
181            catalog_id: self.catalog_id,
182            database_name: self.database_name,
183            name: self.name,
184            table_input: self.table_input,
185            partition_indexes: self.partition_indexes,
186            transaction_id: self.transaction_id,
187            open_table_format_input: self.open_table_format_input,
188        })
189    }
190}