aws_sdk_glue/types/
_jdbc_connector_options.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Additional connection options for the connector.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct JdbcConnectorOptions {
7    /// <p>Extra condition clause to filter data from source. For example:</p>
8    /// <p><code>BillingCity='Mountain View'</code></p>
9    /// <p>When using a query instead of a table name, you should validate that the query works with the specified <code>filterPredicate</code>.</p>
10    pub filter_predicate: ::std::option::Option<::std::string::String>,
11    /// <p>The name of an integer column that is used for partitioning. This option works only when it's included with <code>lowerBound</code>, <code>upperBound</code>, and <code>numPartitions</code>. This option works the same way as in the Spark SQL JDBC reader.</p>
12    pub partition_column: ::std::option::Option<::std::string::String>,
13    /// <p>The minimum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
14    pub lower_bound: ::std::option::Option<i64>,
15    /// <p>The maximum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
16    pub upper_bound: ::std::option::Option<i64>,
17    /// <p>The number of partitions. This value, along with <code>lowerBound</code> (inclusive) and <code>upperBound</code> (exclusive), form partition strides for generated <code>WHERE</code> clause expressions that are used to split the <code>partitionColumn</code>.</p>
18    pub num_partitions: ::std::option::Option<i64>,
19    /// <p>The name of the job bookmark keys on which to sort.</p>
20    pub job_bookmark_keys: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
21    /// <p>Specifies an ascending or descending sort order.</p>
22    pub job_bookmark_keys_sort_order: ::std::option::Option<::std::string::String>,
23    /// <p>Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, the option <code>"dataTypeMapping":{"FLOAT":"STRING"}</code> maps data fields of JDBC type <code>FLOAT</code> into the Java <code>String</code> type by calling the <code>ResultSet.getString()</code> method of the driver, and uses it to build the Glue record. The <code>ResultSet</code> object is implemented by each driver, so the behavior is specific to the driver you use. Refer to the documentation for your JDBC driver to understand how the driver performs the conversions.</p>
24    pub data_type_mapping: ::std::option::Option<::std::collections::HashMap<crate::types::JdbcDataType, crate::types::GlueRecordType>>,
25}
26impl JdbcConnectorOptions {
27    /// <p>Extra condition clause to filter data from source. For example:</p>
28    /// <p><code>BillingCity='Mountain View'</code></p>
29    /// <p>When using a query instead of a table name, you should validate that the query works with the specified <code>filterPredicate</code>.</p>
30    pub fn filter_predicate(&self) -> ::std::option::Option<&str> {
31        self.filter_predicate.as_deref()
32    }
33    /// <p>The name of an integer column that is used for partitioning. This option works only when it's included with <code>lowerBound</code>, <code>upperBound</code>, and <code>numPartitions</code>. This option works the same way as in the Spark SQL JDBC reader.</p>
34    pub fn partition_column(&self) -> ::std::option::Option<&str> {
35        self.partition_column.as_deref()
36    }
37    /// <p>The minimum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
38    pub fn lower_bound(&self) -> ::std::option::Option<i64> {
39        self.lower_bound
40    }
41    /// <p>The maximum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
42    pub fn upper_bound(&self) -> ::std::option::Option<i64> {
43        self.upper_bound
44    }
45    /// <p>The number of partitions. This value, along with <code>lowerBound</code> (inclusive) and <code>upperBound</code> (exclusive), form partition strides for generated <code>WHERE</code> clause expressions that are used to split the <code>partitionColumn</code>.</p>
46    pub fn num_partitions(&self) -> ::std::option::Option<i64> {
47        self.num_partitions
48    }
49    /// <p>The name of the job bookmark keys on which to sort.</p>
50    ///
51    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.job_bookmark_keys.is_none()`.
52    pub fn job_bookmark_keys(&self) -> &[::std::string::String] {
53        self.job_bookmark_keys.as_deref().unwrap_or_default()
54    }
55    /// <p>Specifies an ascending or descending sort order.</p>
56    pub fn job_bookmark_keys_sort_order(&self) -> ::std::option::Option<&str> {
57        self.job_bookmark_keys_sort_order.as_deref()
58    }
59    /// <p>Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, the option <code>"dataTypeMapping":{"FLOAT":"STRING"}</code> maps data fields of JDBC type <code>FLOAT</code> into the Java <code>String</code> type by calling the <code>ResultSet.getString()</code> method of the driver, and uses it to build the Glue record. The <code>ResultSet</code> object is implemented by each driver, so the behavior is specific to the driver you use. Refer to the documentation for your JDBC driver to understand how the driver performs the conversions.</p>
60    pub fn data_type_mapping(&self) -> ::std::option::Option<&::std::collections::HashMap<crate::types::JdbcDataType, crate::types::GlueRecordType>> {
61        self.data_type_mapping.as_ref()
62    }
63}
64impl JdbcConnectorOptions {
65    /// Creates a new builder-style object to manufacture [`JdbcConnectorOptions`](crate::types::JdbcConnectorOptions).
66    pub fn builder() -> crate::types::builders::JdbcConnectorOptionsBuilder {
67        crate::types::builders::JdbcConnectorOptionsBuilder::default()
68    }
69}
70
71/// A builder for [`JdbcConnectorOptions`](crate::types::JdbcConnectorOptions).
72#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
73#[non_exhaustive]
74pub struct JdbcConnectorOptionsBuilder {
75    pub(crate) filter_predicate: ::std::option::Option<::std::string::String>,
76    pub(crate) partition_column: ::std::option::Option<::std::string::String>,
77    pub(crate) lower_bound: ::std::option::Option<i64>,
78    pub(crate) upper_bound: ::std::option::Option<i64>,
79    pub(crate) num_partitions: ::std::option::Option<i64>,
80    pub(crate) job_bookmark_keys: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
81    pub(crate) job_bookmark_keys_sort_order: ::std::option::Option<::std::string::String>,
82    pub(crate) data_type_mapping: ::std::option::Option<::std::collections::HashMap<crate::types::JdbcDataType, crate::types::GlueRecordType>>,
83}
84impl JdbcConnectorOptionsBuilder {
85    /// <p>Extra condition clause to filter data from source. For example:</p>
86    /// <p><code>BillingCity='Mountain View'</code></p>
87    /// <p>When using a query instead of a table name, you should validate that the query works with the specified <code>filterPredicate</code>.</p>
88    pub fn filter_predicate(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.filter_predicate = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <p>Extra condition clause to filter data from source. For example:</p>
93    /// <p><code>BillingCity='Mountain View'</code></p>
94    /// <p>When using a query instead of a table name, you should validate that the query works with the specified <code>filterPredicate</code>.</p>
95    pub fn set_filter_predicate(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.filter_predicate = input;
97        self
98    }
99    /// <p>Extra condition clause to filter data from source. For example:</p>
100    /// <p><code>BillingCity='Mountain View'</code></p>
101    /// <p>When using a query instead of a table name, you should validate that the query works with the specified <code>filterPredicate</code>.</p>
102    pub fn get_filter_predicate(&self) -> &::std::option::Option<::std::string::String> {
103        &self.filter_predicate
104    }
105    /// <p>The name of an integer column that is used for partitioning. This option works only when it's included with <code>lowerBound</code>, <code>upperBound</code>, and <code>numPartitions</code>. This option works the same way as in the Spark SQL JDBC reader.</p>
106    pub fn partition_column(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107        self.partition_column = ::std::option::Option::Some(input.into());
108        self
109    }
110    /// <p>The name of an integer column that is used for partitioning. This option works only when it's included with <code>lowerBound</code>, <code>upperBound</code>, and <code>numPartitions</code>. This option works the same way as in the Spark SQL JDBC reader.</p>
111    pub fn set_partition_column(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112        self.partition_column = input;
113        self
114    }
115    /// <p>The name of an integer column that is used for partitioning. This option works only when it's included with <code>lowerBound</code>, <code>upperBound</code>, and <code>numPartitions</code>. This option works the same way as in the Spark SQL JDBC reader.</p>
116    pub fn get_partition_column(&self) -> &::std::option::Option<::std::string::String> {
117        &self.partition_column
118    }
119    /// <p>The minimum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
120    pub fn lower_bound(mut self, input: i64) -> Self {
121        self.lower_bound = ::std::option::Option::Some(input);
122        self
123    }
124    /// <p>The minimum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
125    pub fn set_lower_bound(mut self, input: ::std::option::Option<i64>) -> Self {
126        self.lower_bound = input;
127        self
128    }
129    /// <p>The minimum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
130    pub fn get_lower_bound(&self) -> &::std::option::Option<i64> {
131        &self.lower_bound
132    }
133    /// <p>The maximum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
134    pub fn upper_bound(mut self, input: i64) -> Self {
135        self.upper_bound = ::std::option::Option::Some(input);
136        self
137    }
138    /// <p>The maximum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
139    pub fn set_upper_bound(mut self, input: ::std::option::Option<i64>) -> Self {
140        self.upper_bound = input;
141        self
142    }
143    /// <p>The maximum value of <code>partitionColumn</code> that is used to decide partition stride.</p>
144    pub fn get_upper_bound(&self) -> &::std::option::Option<i64> {
145        &self.upper_bound
146    }
147    /// <p>The number of partitions. This value, along with <code>lowerBound</code> (inclusive) and <code>upperBound</code> (exclusive), form partition strides for generated <code>WHERE</code> clause expressions that are used to split the <code>partitionColumn</code>.</p>
148    pub fn num_partitions(mut self, input: i64) -> Self {
149        self.num_partitions = ::std::option::Option::Some(input);
150        self
151    }
152    /// <p>The number of partitions. This value, along with <code>lowerBound</code> (inclusive) and <code>upperBound</code> (exclusive), form partition strides for generated <code>WHERE</code> clause expressions that are used to split the <code>partitionColumn</code>.</p>
153    pub fn set_num_partitions(mut self, input: ::std::option::Option<i64>) -> Self {
154        self.num_partitions = input;
155        self
156    }
157    /// <p>The number of partitions. This value, along with <code>lowerBound</code> (inclusive) and <code>upperBound</code> (exclusive), form partition strides for generated <code>WHERE</code> clause expressions that are used to split the <code>partitionColumn</code>.</p>
158    pub fn get_num_partitions(&self) -> &::std::option::Option<i64> {
159        &self.num_partitions
160    }
161    /// Appends an item to `job_bookmark_keys`.
162    ///
163    /// To override the contents of this collection use [`set_job_bookmark_keys`](Self::set_job_bookmark_keys).
164    ///
165    /// <p>The name of the job bookmark keys on which to sort.</p>
166    pub fn job_bookmark_keys(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        let mut v = self.job_bookmark_keys.unwrap_or_default();
168        v.push(input.into());
169        self.job_bookmark_keys = ::std::option::Option::Some(v);
170        self
171    }
172    /// <p>The name of the job bookmark keys on which to sort.</p>
173    pub fn set_job_bookmark_keys(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
174        self.job_bookmark_keys = input;
175        self
176    }
177    /// <p>The name of the job bookmark keys on which to sort.</p>
178    pub fn get_job_bookmark_keys(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
179        &self.job_bookmark_keys
180    }
181    /// <p>Specifies an ascending or descending sort order.</p>
182    pub fn job_bookmark_keys_sort_order(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
183        self.job_bookmark_keys_sort_order = ::std::option::Option::Some(input.into());
184        self
185    }
186    /// <p>Specifies an ascending or descending sort order.</p>
187    pub fn set_job_bookmark_keys_sort_order(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
188        self.job_bookmark_keys_sort_order = input;
189        self
190    }
191    /// <p>Specifies an ascending or descending sort order.</p>
192    pub fn get_job_bookmark_keys_sort_order(&self) -> &::std::option::Option<::std::string::String> {
193        &self.job_bookmark_keys_sort_order
194    }
195    /// Adds a key-value pair to `data_type_mapping`.
196    ///
197    /// To override the contents of this collection use [`set_data_type_mapping`](Self::set_data_type_mapping).
198    ///
199    /// <p>Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, the option <code>"dataTypeMapping":{"FLOAT":"STRING"}</code> maps data fields of JDBC type <code>FLOAT</code> into the Java <code>String</code> type by calling the <code>ResultSet.getString()</code> method of the driver, and uses it to build the Glue record. The <code>ResultSet</code> object is implemented by each driver, so the behavior is specific to the driver you use. Refer to the documentation for your JDBC driver to understand how the driver performs the conversions.</p>
200    pub fn data_type_mapping(mut self, k: crate::types::JdbcDataType, v: crate::types::GlueRecordType) -> Self {
201        let mut hash_map = self.data_type_mapping.unwrap_or_default();
202        hash_map.insert(k, v);
203        self.data_type_mapping = ::std::option::Option::Some(hash_map);
204        self
205    }
206    /// <p>Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, the option <code>"dataTypeMapping":{"FLOAT":"STRING"}</code> maps data fields of JDBC type <code>FLOAT</code> into the Java <code>String</code> type by calling the <code>ResultSet.getString()</code> method of the driver, and uses it to build the Glue record. The <code>ResultSet</code> object is implemented by each driver, so the behavior is specific to the driver you use. Refer to the documentation for your JDBC driver to understand how the driver performs the conversions.</p>
207    pub fn set_data_type_mapping(
208        mut self,
209        input: ::std::option::Option<::std::collections::HashMap<crate::types::JdbcDataType, crate::types::GlueRecordType>>,
210    ) -> Self {
211        self.data_type_mapping = input;
212        self
213    }
214    /// <p>Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, the option <code>"dataTypeMapping":{"FLOAT":"STRING"}</code> maps data fields of JDBC type <code>FLOAT</code> into the Java <code>String</code> type by calling the <code>ResultSet.getString()</code> method of the driver, and uses it to build the Glue record. The <code>ResultSet</code> object is implemented by each driver, so the behavior is specific to the driver you use. Refer to the documentation for your JDBC driver to understand how the driver performs the conversions.</p>
215    pub fn get_data_type_mapping(
216        &self,
217    ) -> &::std::option::Option<::std::collections::HashMap<crate::types::JdbcDataType, crate::types::GlueRecordType>> {
218        &self.data_type_mapping
219    }
220    /// Consumes the builder and constructs a [`JdbcConnectorOptions`](crate::types::JdbcConnectorOptions).
221    pub fn build(self) -> crate::types::JdbcConnectorOptions {
222        crate::types::JdbcConnectorOptions {
223            filter_predicate: self.filter_predicate,
224            partition_column: self.partition_column,
225            lower_bound: self.lower_bound,
226            upper_bound: self.upper_bound,
227            num_partitions: self.num_partitions,
228            job_bookmark_keys: self.job_bookmark_keys,
229            job_bookmark_keys_sort_order: self.job_bookmark_keys_sort_order,
230            data_type_mapping: self.data_type_mapping,
231        }
232    }
233}