aws_sdk_athena/operation/create_data_catalog/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_data_catalog::_create_data_catalog_output::CreateDataCatalogOutputBuilder;
3
4pub use crate::operation::create_data_catalog::_create_data_catalog_input::CreateDataCatalogInputBuilder;
5
6impl crate::operation::create_data_catalog::builders::CreateDataCatalogInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_data_catalog::CreateDataCatalogOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_data_catalog::CreateDataCatalogError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_data_catalog();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateDataCatalog`.
24///
25/// <p>Creates (registers) a data catalog with the specified name and properties. Catalogs created are visible to all users of the same Amazon Web Services account.</p>
26/// <p>For a <code>FEDERATED</code> catalog, this API operation creates the following resources.</p>
27/// <ul>
28/// <li>
29/// <p>CFN Stack Name with a maximum length of 128 characters and prefix <code>athenafederatedcatalog-CATALOG_NAME_SANITIZED</code> with length 23 characters.</p></li>
30/// <li>
31/// <p>Lambda Function Name with a maximum length of 64 characters and prefix <code>athenafederatedcatalog_CATALOG_NAME_SANITIZED</code> with length 23 characters.</p></li>
32/// <li>
33/// <p>Glue Connection Name with a maximum length of 255 characters and a prefix <code>athenafederatedcatalog_CATALOG_NAME_SANITIZED</code> with length 23 characters.</p></li>
34/// </ul>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct CreateDataCatalogFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::create_data_catalog::builders::CreateDataCatalogInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::create_data_catalog::CreateDataCatalogOutput,
44        crate::operation::create_data_catalog::CreateDataCatalogError,
45    > for CreateDataCatalogFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<
52            crate::operation::create_data_catalog::CreateDataCatalogOutput,
53            crate::operation::create_data_catalog::CreateDataCatalogError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl CreateDataCatalogFluentBuilder {
60    /// Creates a new `CreateDataCatalogFluentBuilder`.
61    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
62        Self {
63            handle,
64            inner: ::std::default::Default::default(),
65            config_override: ::std::option::Option::None,
66        }
67    }
68    /// Access the CreateDataCatalog as a reference.
69    pub fn as_input(&self) -> &crate::operation::create_data_catalog::builders::CreateDataCatalogInputBuilder {
70        &self.inner
71    }
72    /// Sends the request and returns the response.
73    ///
74    /// If an error occurs, an `SdkError` will be returned with additional details that
75    /// can be matched against.
76    ///
77    /// By default, any retryable failures will be retried twice. Retry behavior
78    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
79    /// set when configuring the client.
80    pub async fn send(
81        self,
82    ) -> ::std::result::Result<
83        crate::operation::create_data_catalog::CreateDataCatalogOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::create_data_catalog::CreateDataCatalogError,
86            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
87        >,
88    > {
89        let input = self
90            .inner
91            .build()
92            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
93        let runtime_plugins = crate::operation::create_data_catalog::CreateDataCatalog::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::create_data_catalog::CreateDataCatalog::orchestrate(&runtime_plugins, input).await
99    }
100
101    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
102    pub fn customize(
103        self,
104    ) -> crate::client::customize::CustomizableOperation<
105        crate::operation::create_data_catalog::CreateDataCatalogOutput,
106        crate::operation::create_data_catalog::CreateDataCatalogError,
107        Self,
108    > {
109        crate::client::customize::CustomizableOperation::new(self)
110    }
111    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
112        self.set_config_override(::std::option::Option::Some(config_override.into()));
113        self
114    }
115
116    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
117        self.config_override = config_override;
118        self
119    }
120    /// <p>The name of the data catalog to create. The catalog name must be unique for the Amazon Web Services account and can use a maximum of 127 alphanumeric, underscore, at sign, or hyphen characters. The remainder of the length constraint of 256 is reserved for use by Athena.</p>
121    /// <p>For <code>FEDERATED</code> type the catalog name has following considerations and limits:</p>
122    /// <ul>
123    /// <li>
124    /// <p>The catalog name allows special characters such as <code>_ , @ , \ , - </code>. These characters are replaced with a hyphen (-) when creating the CFN Stack Name and with an underscore (_) when creating the Lambda Function and Glue Connection Name.</p></li>
125    /// <li>
126    /// <p>The catalog name has a theoretical limit of 128 characters. However, since we use it to create other resources that allow less characters and we prepend a prefix to it, the actual catalog name limit for <code>FEDERATED</code> catalog is 64 - 23 = 41 characters.</p></li>
127    /// </ul>
128    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.name(input.into());
130        self
131    }
132    /// <p>The name of the data catalog to create. The catalog name must be unique for the Amazon Web Services account and can use a maximum of 127 alphanumeric, underscore, at sign, or hyphen characters. The remainder of the length constraint of 256 is reserved for use by Athena.</p>
133    /// <p>For <code>FEDERATED</code> type the catalog name has following considerations and limits:</p>
134    /// <ul>
135    /// <li>
136    /// <p>The catalog name allows special characters such as <code>_ , @ , \ , - </code>. These characters are replaced with a hyphen (-) when creating the CFN Stack Name and with an underscore (_) when creating the Lambda Function and Glue Connection Name.</p></li>
137    /// <li>
138    /// <p>The catalog name has a theoretical limit of 128 characters. However, since we use it to create other resources that allow less characters and we prepend a prefix to it, the actual catalog name limit for <code>FEDERATED</code> catalog is 64 - 23 = 41 characters.</p></li>
139    /// </ul>
140    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_name(input);
142        self
143    }
144    /// <p>The name of the data catalog to create. The catalog name must be unique for the Amazon Web Services account and can use a maximum of 127 alphanumeric, underscore, at sign, or hyphen characters. The remainder of the length constraint of 256 is reserved for use by Athena.</p>
145    /// <p>For <code>FEDERATED</code> type the catalog name has following considerations and limits:</p>
146    /// <ul>
147    /// <li>
148    /// <p>The catalog name allows special characters such as <code>_ , @ , \ , - </code>. These characters are replaced with a hyphen (-) when creating the CFN Stack Name and with an underscore (_) when creating the Lambda Function and Glue Connection Name.</p></li>
149    /// <li>
150    /// <p>The catalog name has a theoretical limit of 128 characters. However, since we use it to create other resources that allow less characters and we prepend a prefix to it, the actual catalog name limit for <code>FEDERATED</code> catalog is 64 - 23 = 41 characters.</p></li>
151    /// </ul>
152    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
153        self.inner.get_name()
154    }
155    /// <p>The type of data catalog to create: <code>LAMBDA</code> for a federated catalog, <code>GLUE</code> for an Glue Data Catalog, and <code>HIVE</code> for an external Apache Hive metastore. <code>FEDERATED</code> is a federated catalog for which Athena creates the connection and the Lambda function for you based on the parameters that you pass.</p>
156    /// <p>For <code>FEDERATED</code> type, we do not support IAM identity center.</p>
157    pub fn r#type(mut self, input: crate::types::DataCatalogType) -> Self {
158        self.inner = self.inner.r#type(input);
159        self
160    }
161    /// <p>The type of data catalog to create: <code>LAMBDA</code> for a federated catalog, <code>GLUE</code> for an Glue Data Catalog, and <code>HIVE</code> for an external Apache Hive metastore. <code>FEDERATED</code> is a federated catalog for which Athena creates the connection and the Lambda function for you based on the parameters that you pass.</p>
162    /// <p>For <code>FEDERATED</code> type, we do not support IAM identity center.</p>
163    pub fn set_type(mut self, input: ::std::option::Option<crate::types::DataCatalogType>) -> Self {
164        self.inner = self.inner.set_type(input);
165        self
166    }
167    /// <p>The type of data catalog to create: <code>LAMBDA</code> for a federated catalog, <code>GLUE</code> for an Glue Data Catalog, and <code>HIVE</code> for an external Apache Hive metastore. <code>FEDERATED</code> is a federated catalog for which Athena creates the connection and the Lambda function for you based on the parameters that you pass.</p>
168    /// <p>For <code>FEDERATED</code> type, we do not support IAM identity center.</p>
169    pub fn get_type(&self) -> &::std::option::Option<crate::types::DataCatalogType> {
170        self.inner.get_type()
171    }
172    /// <p>A description of the data catalog to be created.</p>
173    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
174        self.inner = self.inner.description(input.into());
175        self
176    }
177    /// <p>A description of the data catalog to be created.</p>
178    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
179        self.inner = self.inner.set_description(input);
180        self
181    }
182    /// <p>A description of the data catalog to be created.</p>
183    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
184        self.inner.get_description()
185    }
186    ///
187    /// Adds a key-value pair to `Parameters`.
188    ///
189    /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
190    ///
191    /// <p>Specifies the Lambda function or functions to use for creating the data catalog. This is a mapping whose values depend on the catalog type.</p>
192    /// <ul>
193    /// <li>
194    /// <p>For the <code>HIVE</code> data catalog type, use the following syntax. The <code>metadata-function</code> parameter is required. <code>The sdk-version</code> parameter is optional and defaults to the currently supported version.</p>
195    /// <p><code>metadata-function=<i>lambda_arn</i>, sdk-version=<i>version_number</i> </code></p></li>
196    /// <li>
197    /// <p>For the <code>LAMBDA</code> data catalog type, use one of the following sets of required parameters, but not both.</p>
198    /// <ul>
199    /// <li>
200    /// <p>If you have one Lambda function that processes metadata and another for reading the actual data, use the following syntax. Both parameters are required.</p>
201    /// <p><code>metadata-function=<i>lambda_arn</i>, record-function=<i>lambda_arn</i> </code></p></li>
202    /// <li>
203    /// <p>If you have a composite Lambda function that processes both metadata and data, use the following syntax to specify your Lambda function.</p>
204    /// <p><code>function=<i>lambda_arn</i> </code></p></li>
205    /// </ul></li>
206    /// <li>
207    /// <p>The <code>GLUE</code> type takes a catalog ID parameter and is required. The <code> <i>catalog_id</i> </code> is the account ID of the Amazon Web Services account to which the Glue Data Catalog belongs.</p>
208    /// <p><code>catalog-id=<i>catalog_id</i> </code></p>
209    /// <ul>
210    /// <li>
211    /// <p>The <code>GLUE</code> data catalog type also applies to the default <code>AwsDataCatalog</code> that already exists in your account, of which you can have only one and cannot modify.</p></li>
212    /// </ul></li>
213    /// <li>
214    /// <p>The <code>FEDERATED</code> data catalog type uses one of the following parameters, but not both. Use <code>connection-arn</code> for an existing Glue connection. Use <code>connection-type</code> and <code>connection-properties</code> to specify the configuration setting for a new connection.</p>
215    /// <ul>
216    /// <li>
217    /// <p><code>connection-arn:<i><glue_connection_arn_to_reuse></glue_connection_arn_to_reuse></i> </code></p></li>
218    /// <li>
219    /// <p><code>lambda-role-arn</code> (optional): The execution role to use for the Lambda function. If not provided, one is created.</p></li>
220    /// <li>
221    /// <p><code>connection-type:MYSQL|REDSHIFT|...., connection-properties:"<i><json_string></json_string></i>"</code></p>
222    /// <p>For <i> <code><json_string></json_string></code> </i>, use escaped JSON text, as in the following example.</p>
223    /// <p><code>"{\"spill_bucket\":\"my_spill\",\"spill_prefix\":\"athena-spill\",\"host\":\"abc12345.snowflakecomputing.com\",\"port\":\"1234\",\"warehouse\":\"DEV_WH\",\"database\":\"TEST\",\"schema\":\"PUBLIC\",\"SecretArn\":\"arn:aws:secretsmanager:ap-south-1:111122223333:secret:snowflake-XHb67j\"}"</code></p></li>
224    /// </ul></li>
225    /// </ul>
226    pub fn parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
227        self.inner = self.inner.parameters(k.into(), v.into());
228        self
229    }
230    /// <p>Specifies the Lambda function or functions to use for creating the data catalog. This is a mapping whose values depend on the catalog type.</p>
231    /// <ul>
232    /// <li>
233    /// <p>For the <code>HIVE</code> data catalog type, use the following syntax. The <code>metadata-function</code> parameter is required. <code>The sdk-version</code> parameter is optional and defaults to the currently supported version.</p>
234    /// <p><code>metadata-function=<i>lambda_arn</i>, sdk-version=<i>version_number</i> </code></p></li>
235    /// <li>
236    /// <p>For the <code>LAMBDA</code> data catalog type, use one of the following sets of required parameters, but not both.</p>
237    /// <ul>
238    /// <li>
239    /// <p>If you have one Lambda function that processes metadata and another for reading the actual data, use the following syntax. Both parameters are required.</p>
240    /// <p><code>metadata-function=<i>lambda_arn</i>, record-function=<i>lambda_arn</i> </code></p></li>
241    /// <li>
242    /// <p>If you have a composite Lambda function that processes both metadata and data, use the following syntax to specify your Lambda function.</p>
243    /// <p><code>function=<i>lambda_arn</i> </code></p></li>
244    /// </ul></li>
245    /// <li>
246    /// <p>The <code>GLUE</code> type takes a catalog ID parameter and is required. The <code> <i>catalog_id</i> </code> is the account ID of the Amazon Web Services account to which the Glue Data Catalog belongs.</p>
247    /// <p><code>catalog-id=<i>catalog_id</i> </code></p>
248    /// <ul>
249    /// <li>
250    /// <p>The <code>GLUE</code> data catalog type also applies to the default <code>AwsDataCatalog</code> that already exists in your account, of which you can have only one and cannot modify.</p></li>
251    /// </ul></li>
252    /// <li>
253    /// <p>The <code>FEDERATED</code> data catalog type uses one of the following parameters, but not both. Use <code>connection-arn</code> for an existing Glue connection. Use <code>connection-type</code> and <code>connection-properties</code> to specify the configuration setting for a new connection.</p>
254    /// <ul>
255    /// <li>
256    /// <p><code>connection-arn:<i><glue_connection_arn_to_reuse></glue_connection_arn_to_reuse></i> </code></p></li>
257    /// <li>
258    /// <p><code>lambda-role-arn</code> (optional): The execution role to use for the Lambda function. If not provided, one is created.</p></li>
259    /// <li>
260    /// <p><code>connection-type:MYSQL|REDSHIFT|...., connection-properties:"<i><json_string></json_string></i>"</code></p>
261    /// <p>For <i> <code><json_string></json_string></code> </i>, use escaped JSON text, as in the following example.</p>
262    /// <p><code>"{\"spill_bucket\":\"my_spill\",\"spill_prefix\":\"athena-spill\",\"host\":\"abc12345.snowflakecomputing.com\",\"port\":\"1234\",\"warehouse\":\"DEV_WH\",\"database\":\"TEST\",\"schema\":\"PUBLIC\",\"SecretArn\":\"arn:aws:secretsmanager:ap-south-1:111122223333:secret:snowflake-XHb67j\"}"</code></p></li>
263    /// </ul></li>
264    /// </ul>
265    pub fn set_parameters(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
266        self.inner = self.inner.set_parameters(input);
267        self
268    }
269    /// <p>Specifies the Lambda function or functions to use for creating the data catalog. This is a mapping whose values depend on the catalog type.</p>
270    /// <ul>
271    /// <li>
272    /// <p>For the <code>HIVE</code> data catalog type, use the following syntax. The <code>metadata-function</code> parameter is required. <code>The sdk-version</code> parameter is optional and defaults to the currently supported version.</p>
273    /// <p><code>metadata-function=<i>lambda_arn</i>, sdk-version=<i>version_number</i> </code></p></li>
274    /// <li>
275    /// <p>For the <code>LAMBDA</code> data catalog type, use one of the following sets of required parameters, but not both.</p>
276    /// <ul>
277    /// <li>
278    /// <p>If you have one Lambda function that processes metadata and another for reading the actual data, use the following syntax. Both parameters are required.</p>
279    /// <p><code>metadata-function=<i>lambda_arn</i>, record-function=<i>lambda_arn</i> </code></p></li>
280    /// <li>
281    /// <p>If you have a composite Lambda function that processes both metadata and data, use the following syntax to specify your Lambda function.</p>
282    /// <p><code>function=<i>lambda_arn</i> </code></p></li>
283    /// </ul></li>
284    /// <li>
285    /// <p>The <code>GLUE</code> type takes a catalog ID parameter and is required. The <code> <i>catalog_id</i> </code> is the account ID of the Amazon Web Services account to which the Glue Data Catalog belongs.</p>
286    /// <p><code>catalog-id=<i>catalog_id</i> </code></p>
287    /// <ul>
288    /// <li>
289    /// <p>The <code>GLUE</code> data catalog type also applies to the default <code>AwsDataCatalog</code> that already exists in your account, of which you can have only one and cannot modify.</p></li>
290    /// </ul></li>
291    /// <li>
292    /// <p>The <code>FEDERATED</code> data catalog type uses one of the following parameters, but not both. Use <code>connection-arn</code> for an existing Glue connection. Use <code>connection-type</code> and <code>connection-properties</code> to specify the configuration setting for a new connection.</p>
293    /// <ul>
294    /// <li>
295    /// <p><code>connection-arn:<i><glue_connection_arn_to_reuse></glue_connection_arn_to_reuse></i> </code></p></li>
296    /// <li>
297    /// <p><code>lambda-role-arn</code> (optional): The execution role to use for the Lambda function. If not provided, one is created.</p></li>
298    /// <li>
299    /// <p><code>connection-type:MYSQL|REDSHIFT|...., connection-properties:"<i><json_string></json_string></i>"</code></p>
300    /// <p>For <i> <code><json_string></json_string></code> </i>, use escaped JSON text, as in the following example.</p>
301    /// <p><code>"{\"spill_bucket\":\"my_spill\",\"spill_prefix\":\"athena-spill\",\"host\":\"abc12345.snowflakecomputing.com\",\"port\":\"1234\",\"warehouse\":\"DEV_WH\",\"database\":\"TEST\",\"schema\":\"PUBLIC\",\"SecretArn\":\"arn:aws:secretsmanager:ap-south-1:111122223333:secret:snowflake-XHb67j\"}"</code></p></li>
302    /// </ul></li>
303    /// </ul>
304    pub fn get_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
305        self.inner.get_parameters()
306    }
307    ///
308    /// Appends an item to `Tags`.
309    ///
310    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
311    ///
312    /// <p>A list of comma separated tags to add to the data catalog that is created. All the resources that are created by the <code>CreateDataCatalog</code> API operation with <code>FEDERATED</code> type will have the tag <code>federated_athena_datacatalog="true"</code>. This includes the CFN Stack, Glue Connection, Athena DataCatalog, and all the resources created as part of the CFN Stack (Lambda Function, IAM policies/roles).</p>
313    pub fn tags(mut self, input: crate::types::Tag) -> Self {
314        self.inner = self.inner.tags(input);
315        self
316    }
317    /// <p>A list of comma separated tags to add to the data catalog that is created. All the resources that are created by the <code>CreateDataCatalog</code> API operation with <code>FEDERATED</code> type will have the tag <code>federated_athena_datacatalog="true"</code>. This includes the CFN Stack, Glue Connection, Athena DataCatalog, and all the resources created as part of the CFN Stack (Lambda Function, IAM policies/roles).</p>
318    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
319        self.inner = self.inner.set_tags(input);
320        self
321    }
322    /// <p>A list of comma separated tags to add to the data catalog that is created. All the resources that are created by the <code>CreateDataCatalog</code> API operation with <code>FEDERATED</code> type will have the tag <code>federated_athena_datacatalog="true"</code>. This includes the CFN Stack, Glue Connection, Athena DataCatalog, and all the resources created as part of the CFN Stack (Lambda Function, IAM policies/roles).</p>
323    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
324        self.inner.get_tags()
325    }
326}