aws_sdk_textract/operation/create_adapter/
_create_adapter_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 CreateAdapterInput {
6    /// <p>The name to be assigned to the adapter being created.</p>
7    pub adapter_name: ::std::option::Option<::std::string::String>,
8    /// <p>Idempotent token is used to recognize the request. If the same token is used with multiple CreateAdapter requests, the same session is returned. This token is employed to avoid unintentionally creating the same session multiple times.</p>
9    pub client_request_token: ::std::option::Option<::std::string::String>,
10    /// <p>The description to be assigned to the adapter being created.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>The type of feature that the adapter is being trained on. Currrenly, supported feature types are: <code>QUERIES</code></p>
13    pub feature_types: ::std::option::Option<::std::vec::Vec<crate::types::FeatureType>>,
14    /// <p>Controls whether or not the adapter should automatically update.</p>
15    pub auto_update: ::std::option::Option<crate::types::AutoUpdate>,
16    /// <p>A list of tags to be added to the adapter.</p>
17    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
18}
19impl CreateAdapterInput {
20    /// <p>The name to be assigned to the adapter being created.</p>
21    pub fn adapter_name(&self) -> ::std::option::Option<&str> {
22        self.adapter_name.as_deref()
23    }
24    /// <p>Idempotent token is used to recognize the request. If the same token is used with multiple CreateAdapter requests, the same session is returned. This token is employed to avoid unintentionally creating the same session multiple times.</p>
25    pub fn client_request_token(&self) -> ::std::option::Option<&str> {
26        self.client_request_token.as_deref()
27    }
28    /// <p>The description to be assigned to the adapter being created.</p>
29    pub fn description(&self) -> ::std::option::Option<&str> {
30        self.description.as_deref()
31    }
32    /// <p>The type of feature that the adapter is being trained on. Currrenly, supported feature types are: <code>QUERIES</code></p>
33    ///
34    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.feature_types.is_none()`.
35    pub fn feature_types(&self) -> &[crate::types::FeatureType] {
36        self.feature_types.as_deref().unwrap_or_default()
37    }
38    /// <p>Controls whether or not the adapter should automatically update.</p>
39    pub fn auto_update(&self) -> ::std::option::Option<&crate::types::AutoUpdate> {
40        self.auto_update.as_ref()
41    }
42    /// <p>A list of tags to be added to the adapter.</p>
43    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
44        self.tags.as_ref()
45    }
46}
47impl CreateAdapterInput {
48    /// Creates a new builder-style object to manufacture [`CreateAdapterInput`](crate::operation::create_adapter::CreateAdapterInput).
49    pub fn builder() -> crate::operation::create_adapter::builders::CreateAdapterInputBuilder {
50        crate::operation::create_adapter::builders::CreateAdapterInputBuilder::default()
51    }
52}
53
54/// A builder for [`CreateAdapterInput`](crate::operation::create_adapter::CreateAdapterInput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct CreateAdapterInputBuilder {
58    pub(crate) adapter_name: ::std::option::Option<::std::string::String>,
59    pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
60    pub(crate) description: ::std::option::Option<::std::string::String>,
61    pub(crate) feature_types: ::std::option::Option<::std::vec::Vec<crate::types::FeatureType>>,
62    pub(crate) auto_update: ::std::option::Option<crate::types::AutoUpdate>,
63    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
64}
65impl CreateAdapterInputBuilder {
66    /// <p>The name to be assigned to the adapter being created.</p>
67    /// This field is required.
68    pub fn adapter_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.adapter_name = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>The name to be assigned to the adapter being created.</p>
73    pub fn set_adapter_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.adapter_name = input;
75        self
76    }
77    /// <p>The name to be assigned to the adapter being created.</p>
78    pub fn get_adapter_name(&self) -> &::std::option::Option<::std::string::String> {
79        &self.adapter_name
80    }
81    /// <p>Idempotent token is used to recognize the request. If the same token is used with multiple CreateAdapter requests, the same session is returned. This token is employed to avoid unintentionally creating the same session multiple times.</p>
82    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83        self.client_request_token = ::std::option::Option::Some(input.into());
84        self
85    }
86    /// <p>Idempotent token is used to recognize the request. If the same token is used with multiple CreateAdapter requests, the same session is returned. This token is employed to avoid unintentionally creating the same session multiple times.</p>
87    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88        self.client_request_token = input;
89        self
90    }
91    /// <p>Idempotent token is used to recognize the request. If the same token is used with multiple CreateAdapter requests, the same session is returned. This token is employed to avoid unintentionally creating the same session multiple times.</p>
92    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
93        &self.client_request_token
94    }
95    /// <p>The description to be assigned to the adapter being created.</p>
96    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.description = ::std::option::Option::Some(input.into());
98        self
99    }
100    /// <p>The description to be assigned to the adapter being created.</p>
101    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.description = input;
103        self
104    }
105    /// <p>The description to be assigned to the adapter being created.</p>
106    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
107        &self.description
108    }
109    /// Appends an item to `feature_types`.
110    ///
111    /// To override the contents of this collection use [`set_feature_types`](Self::set_feature_types).
112    ///
113    /// <p>The type of feature that the adapter is being trained on. Currrenly, supported feature types are: <code>QUERIES</code></p>
114    pub fn feature_types(mut self, input: crate::types::FeatureType) -> Self {
115        let mut v = self.feature_types.unwrap_or_default();
116        v.push(input);
117        self.feature_types = ::std::option::Option::Some(v);
118        self
119    }
120    /// <p>The type of feature that the adapter is being trained on. Currrenly, supported feature types are: <code>QUERIES</code></p>
121    pub fn set_feature_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FeatureType>>) -> Self {
122        self.feature_types = input;
123        self
124    }
125    /// <p>The type of feature that the adapter is being trained on. Currrenly, supported feature types are: <code>QUERIES</code></p>
126    pub fn get_feature_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FeatureType>> {
127        &self.feature_types
128    }
129    /// <p>Controls whether or not the adapter should automatically update.</p>
130    pub fn auto_update(mut self, input: crate::types::AutoUpdate) -> Self {
131        self.auto_update = ::std::option::Option::Some(input);
132        self
133    }
134    /// <p>Controls whether or not the adapter should automatically update.</p>
135    pub fn set_auto_update(mut self, input: ::std::option::Option<crate::types::AutoUpdate>) -> Self {
136        self.auto_update = input;
137        self
138    }
139    /// <p>Controls whether or not the adapter should automatically update.</p>
140    pub fn get_auto_update(&self) -> &::std::option::Option<crate::types::AutoUpdate> {
141        &self.auto_update
142    }
143    /// Adds a key-value pair to `tags`.
144    ///
145    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
146    ///
147    /// <p>A list of tags to be added to the adapter.</p>
148    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
149        let mut hash_map = self.tags.unwrap_or_default();
150        hash_map.insert(k.into(), v.into());
151        self.tags = ::std::option::Option::Some(hash_map);
152        self
153    }
154    /// <p>A list of tags to be added to the adapter.</p>
155    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
156        self.tags = input;
157        self
158    }
159    /// <p>A list of tags to be added to the adapter.</p>
160    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
161        &self.tags
162    }
163    /// Consumes the builder and constructs a [`CreateAdapterInput`](crate::operation::create_adapter::CreateAdapterInput).
164    pub fn build(
165        self,
166    ) -> ::std::result::Result<crate::operation::create_adapter::CreateAdapterInput, ::aws_smithy_types::error::operation::BuildError> {
167        ::std::result::Result::Ok(crate::operation::create_adapter::CreateAdapterInput {
168            adapter_name: self.adapter_name,
169            client_request_token: self.client_request_token,
170            description: self.description,
171            feature_types: self.feature_types,
172            auto_update: self.auto_update,
173            tags: self.tags,
174        })
175    }
176}