aws_sdk_glue/operation/create_schema/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_schema::_create_schema_output::CreateSchemaOutputBuilder;
3
4pub use crate::operation::create_schema::_create_schema_input::CreateSchemaInputBuilder;
5
6impl crate::operation::create_schema::builders::CreateSchemaInputBuilder {
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_schema::CreateSchemaOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_schema::CreateSchemaError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_schema();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateSchema`.
24///
25/// <p>Creates a new schema set and registers the schema definition. Returns an error if the schema set already exists without actually registering the version.</p>
26/// <p>When the schema set is created, a version checkpoint will be set to the first version. Compatibility mode "DISABLED" restricts any additional schema versions from being added after the first schema version. For all other compatibility modes, validation of compatibility settings will be applied only from the second version onwards when the <code>RegisterSchemaVersion</code> API is used.</p>
27/// <p>When this API is called without a <code>RegistryId</code>, this will create an entry for a "default-registry" in the registry database tables, if it is not already present.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct CreateSchemaFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::create_schema::builders::CreateSchemaInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::create_schema::CreateSchemaOutput,
37        crate::operation::create_schema::CreateSchemaError,
38    > for CreateSchemaFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::create_schema::CreateSchemaOutput,
46            crate::operation::create_schema::CreateSchemaError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl CreateSchemaFluentBuilder {
53    /// Creates a new `CreateSchemaFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the CreateSchema as a reference.
62    pub fn as_input(&self) -> &crate::operation::create_schema::builders::CreateSchemaInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::create_schema::CreateSchemaOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::create_schema::CreateSchemaError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::create_schema::CreateSchema::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::create_schema::CreateSchema::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::create_schema::CreateSchemaOutput,
99        crate::operation::create_schema::CreateSchemaError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>This is a wrapper shape to contain the registry identity fields. If this is not provided, the default registry will be used. The ARN format for the same will be: <code>arn:aws:glue:us-east-2:<customer id>
114    /// :registry/default-registry:random-5-letter-id
115    /// </customer></code>.</p>
116    pub fn registry_id(mut self, input: crate::types::RegistryId) -> Self {
117        self.inner = self.inner.registry_id(input);
118        self
119    }
120    /// <p>This is a wrapper shape to contain the registry identity fields. If this is not provided, the default registry will be used. The ARN format for the same will be: <code>arn:aws:glue:us-east-2:<customer id>
121    /// :registry/default-registry:random-5-letter-id
122    /// </customer></code>.</p>
123    pub fn set_registry_id(mut self, input: ::std::option::Option<crate::types::RegistryId>) -> Self {
124        self.inner = self.inner.set_registry_id(input);
125        self
126    }
127    /// <p>This is a wrapper shape to contain the registry identity fields. If this is not provided, the default registry will be used. The ARN format for the same will be: <code>arn:aws:glue:us-east-2:<customer id>
128    /// :registry/default-registry:random-5-letter-id
129    /// </customer></code>.</p>
130    pub fn get_registry_id(&self) -> &::std::option::Option<crate::types::RegistryId> {
131        self.inner.get_registry_id()
132    }
133    /// <p>Name of the schema to be created of max length of 255, and may only contain letters, numbers, hyphen, underscore, dollar sign, or hash mark. No whitespace.</p>
134    pub fn schema_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.schema_name(input.into());
136        self
137    }
138    /// <p>Name of the schema to be created of max length of 255, and may only contain letters, numbers, hyphen, underscore, dollar sign, or hash mark. No whitespace.</p>
139    pub fn set_schema_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_schema_name(input);
141        self
142    }
143    /// <p>Name of the schema to be created of max length of 255, and may only contain letters, numbers, hyphen, underscore, dollar sign, or hash mark. No whitespace.</p>
144    pub fn get_schema_name(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_schema_name()
146    }
147    /// <p>The data format of the schema definition. Currently <code>AVRO</code>, <code>JSON</code> and <code>PROTOBUF</code> are supported.</p>
148    pub fn data_format(mut self, input: crate::types::DataFormat) -> Self {
149        self.inner = self.inner.data_format(input);
150        self
151    }
152    /// <p>The data format of the schema definition. Currently <code>AVRO</code>, <code>JSON</code> and <code>PROTOBUF</code> are supported.</p>
153    pub fn set_data_format(mut self, input: ::std::option::Option<crate::types::DataFormat>) -> Self {
154        self.inner = self.inner.set_data_format(input);
155        self
156    }
157    /// <p>The data format of the schema definition. Currently <code>AVRO</code>, <code>JSON</code> and <code>PROTOBUF</code> are supported.</p>
158    pub fn get_data_format(&self) -> &::std::option::Option<crate::types::DataFormat> {
159        self.inner.get_data_format()
160    }
161    /// <p>The compatibility mode of the schema. The possible values are:</p>
162    /// <ul>
163    /// <li>
164    /// <p><i>NONE</i>: No compatibility mode applies. You can use this choice in development scenarios or if you do not know the compatibility mode that you want to apply to schemas. Any new version added will be accepted without undergoing a compatibility check.</p></li>
165    /// <li>
166    /// <p><i>DISABLED</i>: This compatibility choice prevents versioning for a particular schema. You can use this choice to prevent future versioning of a schema.</p></li>
167    /// <li>
168    /// <p><i>BACKWARD</i>: This compatibility choice is recommended as it allows data receivers to read both the current and one previous schema version. This means that for instance, a new schema version cannot drop data fields or change the type of these fields, so they can't be read by readers using the previous version.</p></li>
169    /// <li>
170    /// <p><i>BACKWARD_ALL</i>: This compatibility choice allows data receivers to read both the current and all previous schema versions. You can use this choice when you need to delete fields or add optional fields, and check compatibility against all previous schema versions.</p></li>
171    /// <li>
172    /// <p><i>FORWARD</i>: This compatibility choice allows data receivers to read both the current and one next schema version, but not necessarily later versions. You can use this choice when you need to add fields or delete optional fields, but only check compatibility against the last schema version.</p></li>
173    /// <li>
174    /// <p><i>FORWARD_ALL</i>: This compatibility choice allows data receivers to read written by producers of any new registered schema. You can use this choice when you need to add fields or delete optional fields, and check compatibility against all previous schema versions.</p></li>
175    /// <li>
176    /// <p><i>FULL</i>: This compatibility choice allows data receivers to read data written by producers using the previous or next version of the schema, but not necessarily earlier or later versions. You can use this choice when you need to add or remove optional fields, but only check compatibility against the last schema version.</p></li>
177    /// <li>
178    /// <p><i>FULL_ALL</i>: This compatibility choice allows data receivers to read data written by producers using all previous schema versions. You can use this choice when you need to add or remove optional fields, and check compatibility against all previous schema versions.</p></li>
179    /// </ul>
180    pub fn compatibility(mut self, input: crate::types::Compatibility) -> Self {
181        self.inner = self.inner.compatibility(input);
182        self
183    }
184    /// <p>The compatibility mode of the schema. The possible values are:</p>
185    /// <ul>
186    /// <li>
187    /// <p><i>NONE</i>: No compatibility mode applies. You can use this choice in development scenarios or if you do not know the compatibility mode that you want to apply to schemas. Any new version added will be accepted without undergoing a compatibility check.</p></li>
188    /// <li>
189    /// <p><i>DISABLED</i>: This compatibility choice prevents versioning for a particular schema. You can use this choice to prevent future versioning of a schema.</p></li>
190    /// <li>
191    /// <p><i>BACKWARD</i>: This compatibility choice is recommended as it allows data receivers to read both the current and one previous schema version. This means that for instance, a new schema version cannot drop data fields or change the type of these fields, so they can't be read by readers using the previous version.</p></li>
192    /// <li>
193    /// <p><i>BACKWARD_ALL</i>: This compatibility choice allows data receivers to read both the current and all previous schema versions. You can use this choice when you need to delete fields or add optional fields, and check compatibility against all previous schema versions.</p></li>
194    /// <li>
195    /// <p><i>FORWARD</i>: This compatibility choice allows data receivers to read both the current and one next schema version, but not necessarily later versions. You can use this choice when you need to add fields or delete optional fields, but only check compatibility against the last schema version.</p></li>
196    /// <li>
197    /// <p><i>FORWARD_ALL</i>: This compatibility choice allows data receivers to read written by producers of any new registered schema. You can use this choice when you need to add fields or delete optional fields, and check compatibility against all previous schema versions.</p></li>
198    /// <li>
199    /// <p><i>FULL</i>: This compatibility choice allows data receivers to read data written by producers using the previous or next version of the schema, but not necessarily earlier or later versions. You can use this choice when you need to add or remove optional fields, but only check compatibility against the last schema version.</p></li>
200    /// <li>
201    /// <p><i>FULL_ALL</i>: This compatibility choice allows data receivers to read data written by producers using all previous schema versions. You can use this choice when you need to add or remove optional fields, and check compatibility against all previous schema versions.</p></li>
202    /// </ul>
203    pub fn set_compatibility(mut self, input: ::std::option::Option<crate::types::Compatibility>) -> Self {
204        self.inner = self.inner.set_compatibility(input);
205        self
206    }
207    /// <p>The compatibility mode of the schema. The possible values are:</p>
208    /// <ul>
209    /// <li>
210    /// <p><i>NONE</i>: No compatibility mode applies. You can use this choice in development scenarios or if you do not know the compatibility mode that you want to apply to schemas. Any new version added will be accepted without undergoing a compatibility check.</p></li>
211    /// <li>
212    /// <p><i>DISABLED</i>: This compatibility choice prevents versioning for a particular schema. You can use this choice to prevent future versioning of a schema.</p></li>
213    /// <li>
214    /// <p><i>BACKWARD</i>: This compatibility choice is recommended as it allows data receivers to read both the current and one previous schema version. This means that for instance, a new schema version cannot drop data fields or change the type of these fields, so they can't be read by readers using the previous version.</p></li>
215    /// <li>
216    /// <p><i>BACKWARD_ALL</i>: This compatibility choice allows data receivers to read both the current and all previous schema versions. You can use this choice when you need to delete fields or add optional fields, and check compatibility against all previous schema versions.</p></li>
217    /// <li>
218    /// <p><i>FORWARD</i>: This compatibility choice allows data receivers to read both the current and one next schema version, but not necessarily later versions. You can use this choice when you need to add fields or delete optional fields, but only check compatibility against the last schema version.</p></li>
219    /// <li>
220    /// <p><i>FORWARD_ALL</i>: This compatibility choice allows data receivers to read written by producers of any new registered schema. You can use this choice when you need to add fields or delete optional fields, and check compatibility against all previous schema versions.</p></li>
221    /// <li>
222    /// <p><i>FULL</i>: This compatibility choice allows data receivers to read data written by producers using the previous or next version of the schema, but not necessarily earlier or later versions. You can use this choice when you need to add or remove optional fields, but only check compatibility against the last schema version.</p></li>
223    /// <li>
224    /// <p><i>FULL_ALL</i>: This compatibility choice allows data receivers to read data written by producers using all previous schema versions. You can use this choice when you need to add or remove optional fields, and check compatibility against all previous schema versions.</p></li>
225    /// </ul>
226    pub fn get_compatibility(&self) -> &::std::option::Option<crate::types::Compatibility> {
227        self.inner.get_compatibility()
228    }
229    /// <p>An optional description of the schema. If description is not provided, there will not be any automatic default value for this.</p>
230    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
231        self.inner = self.inner.description(input.into());
232        self
233    }
234    /// <p>An optional description of the schema. If description is not provided, there will not be any automatic default value for this.</p>
235    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
236        self.inner = self.inner.set_description(input);
237        self
238    }
239    /// <p>An optional description of the schema. If description is not provided, there will not be any automatic default value for this.</p>
240    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
241        self.inner.get_description()
242    }
243    ///
244    /// Adds a key-value pair to `Tags`.
245    ///
246    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
247    ///
248    /// <p>Amazon Web Services tags that contain a key value pair and may be searched by console, command line, or API. If specified, follows the Amazon Web Services tags-on-create pattern.</p>
249    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
250        self.inner = self.inner.tags(k.into(), v.into());
251        self
252    }
253    /// <p>Amazon Web Services tags that contain a key value pair and may be searched by console, command line, or API. If specified, follows the Amazon Web Services tags-on-create pattern.</p>
254    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
255        self.inner = self.inner.set_tags(input);
256        self
257    }
258    /// <p>Amazon Web Services tags that contain a key value pair and may be searched by console, command line, or API. If specified, follows the Amazon Web Services tags-on-create pattern.</p>
259    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
260        self.inner.get_tags()
261    }
262    /// <p>The schema definition using the <code>DataFormat</code> setting for <code>SchemaName</code>.</p>
263    pub fn schema_definition(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
264        self.inner = self.inner.schema_definition(input.into());
265        self
266    }
267    /// <p>The schema definition using the <code>DataFormat</code> setting for <code>SchemaName</code>.</p>
268    pub fn set_schema_definition(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
269        self.inner = self.inner.set_schema_definition(input);
270        self
271    }
272    /// <p>The schema definition using the <code>DataFormat</code> setting for <code>SchemaName</code>.</p>
273    pub fn get_schema_definition(&self) -> &::std::option::Option<::std::string::String> {
274        self.inner.get_schema_definition()
275    }
276}