aws_sdk_comprehend/operation/import_model/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::import_model::_import_model_output::ImportModelOutputBuilder;
3
4pub use crate::operation::import_model::_import_model_input::ImportModelInputBuilder;
5
6impl crate::operation::import_model::builders::ImportModelInputBuilder {
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::import_model::ImportModelOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::import_model::ImportModelError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.import_model();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ImportModel`.
24///
25/// <p>Creates a new custom model that replicates a source custom model that you import. The source model can be in your Amazon Web Services account or another one.</p>
26/// <p>If the source model is in another Amazon Web Services account, then it must have a resource-based policy that authorizes you to import it.</p>
27/// <p>The source model must be in the same Amazon Web Services Region that you're using when you import. You can't import a model that's in a different Region.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct ImportModelFluentBuilder {
30 handle: ::std::sync::Arc<crate::client::Handle>,
31 inner: crate::operation::import_model::builders::ImportModelInputBuilder,
32 config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35 crate::client::customize::internal::CustomizableSend<
36 crate::operation::import_model::ImportModelOutput,
37 crate::operation::import_model::ImportModelError,
38 > for ImportModelFluentBuilder
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::import_model::ImportModelOutput,
46 crate::operation::import_model::ImportModelError,
47 >,
48 > {
49 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50 }
51}
52impl ImportModelFluentBuilder {
53 /// Creates a new `ImportModelFluentBuilder`.
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 ImportModel as a reference.
62 pub fn as_input(&self) -> &crate::operation::import_model::builders::ImportModelInputBuilder {
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::import_model::ImportModelOutput,
77 ::aws_smithy_runtime_api::client::result::SdkError<
78 crate::operation::import_model::ImportModelError,
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::import_model::ImportModel::operation_runtime_plugins(
87 self.handle.runtime_plugins.clone(),
88 &self.handle.conf,
89 self.config_override,
90 );
91 crate::operation::import_model::ImportModel::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::import_model::ImportModelOutput,
99 crate::operation::import_model::ImportModelError,
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>The Amazon Resource Name (ARN) of the custom model to import.</p>
114 pub fn source_model_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115 self.inner = self.inner.source_model_arn(input.into());
116 self
117 }
118 /// <p>The Amazon Resource Name (ARN) of the custom model to import.</p>
119 pub fn set_source_model_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120 self.inner = self.inner.set_source_model_arn(input);
121 self
122 }
123 /// <p>The Amazon Resource Name (ARN) of the custom model to import.</p>
124 pub fn get_source_model_arn(&self) -> &::std::option::Option<::std::string::String> {
125 self.inner.get_source_model_arn()
126 }
127 /// <p>The name to assign to the custom model that is created in Amazon Comprehend by this import.</p>
128 pub fn model_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129 self.inner = self.inner.model_name(input.into());
130 self
131 }
132 /// <p>The name to assign to the custom model that is created in Amazon Comprehend by this import.</p>
133 pub fn set_model_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134 self.inner = self.inner.set_model_name(input);
135 self
136 }
137 /// <p>The name to assign to the custom model that is created in Amazon Comprehend by this import.</p>
138 pub fn get_model_name(&self) -> &::std::option::Option<::std::string::String> {
139 self.inner.get_model_name()
140 }
141 /// <p>The version name given to the custom model that is created by this import. Version names can have a maximum of 256 characters. Alphanumeric characters, hyphens (-) and underscores (_) are allowed. The version name must be unique among all models with the same classifier name in the account/Region.</p>
142 pub fn version_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143 self.inner = self.inner.version_name(input.into());
144 self
145 }
146 /// <p>The version name given to the custom model that is created by this import. Version names can have a maximum of 256 characters. Alphanumeric characters, hyphens (-) and underscores (_) are allowed. The version name must be unique among all models with the same classifier name in the account/Region.</p>
147 pub fn set_version_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148 self.inner = self.inner.set_version_name(input);
149 self
150 }
151 /// <p>The version name given to the custom model that is created by this import. Version names can have a maximum of 256 characters. Alphanumeric characters, hyphens (-) and underscores (_) are allowed. The version name must be unique among all models with the same classifier name in the account/Region.</p>
152 pub fn get_version_name(&self) -> &::std::option::Option<::std::string::String> {
153 self.inner.get_version_name()
154 }
155 /// <p>ID for the KMS key that Amazon Comprehend uses to encrypt trained custom models. The ModelKmsKeyId can be either of the following formats:</p>
156 /// <ul>
157 /// <li>
158 /// <p>KMS Key ID: <code>"1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
159 /// <li>
160 /// <p>Amazon Resource Name (ARN) of a KMS Key: <code>"arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
161 /// </ul>
162 pub fn model_kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163 self.inner = self.inner.model_kms_key_id(input.into());
164 self
165 }
166 /// <p>ID for the KMS key that Amazon Comprehend uses to encrypt trained custom models. The ModelKmsKeyId can be either of the following formats:</p>
167 /// <ul>
168 /// <li>
169 /// <p>KMS Key ID: <code>"1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
170 /// <li>
171 /// <p>Amazon Resource Name (ARN) of a KMS Key: <code>"arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
172 /// </ul>
173 pub fn set_model_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
174 self.inner = self.inner.set_model_kms_key_id(input);
175 self
176 }
177 /// <p>ID for the KMS key that Amazon Comprehend uses to encrypt trained custom models. The ModelKmsKeyId can be either of the following formats:</p>
178 /// <ul>
179 /// <li>
180 /// <p>KMS Key ID: <code>"1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
181 /// <li>
182 /// <p>Amazon Resource Name (ARN) of a KMS Key: <code>"arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
183 /// </ul>
184 pub fn get_model_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
185 self.inner.get_model_kms_key_id()
186 }
187 /// <p>The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend permission to use Amazon Key Management Service (KMS) to encrypt or decrypt the custom model.</p>
188 pub fn data_access_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189 self.inner = self.inner.data_access_role_arn(input.into());
190 self
191 }
192 /// <p>The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend permission to use Amazon Key Management Service (KMS) to encrypt or decrypt the custom model.</p>
193 pub fn set_data_access_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194 self.inner = self.inner.set_data_access_role_arn(input);
195 self
196 }
197 /// <p>The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend permission to use Amazon Key Management Service (KMS) to encrypt or decrypt the custom model.</p>
198 pub fn get_data_access_role_arn(&self) -> &::std::option::Option<::std::string::String> {
199 self.inner.get_data_access_role_arn()
200 }
201 ///
202 /// Appends an item to `Tags`.
203 ///
204 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
205 ///
206 /// <p>Tags to associate with the custom model that is created by this import. A tag is a key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.</p>
207 pub fn tags(mut self, input: crate::types::Tag) -> Self {
208 self.inner = self.inner.tags(input);
209 self
210 }
211 /// <p>Tags to associate with the custom model that is created by this import. A tag is a key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.</p>
212 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
213 self.inner = self.inner.set_tags(input);
214 self
215 }
216 /// <p>Tags to associate with the custom model that is created by this import. A tag is a key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.</p>
217 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
218 self.inner.get_tags()
219 }
220}