aws_sdk_rekognition/operation/create_project_version/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_project_version::_create_project_version_output::CreateProjectVersionOutputBuilder;
3
4pub use crate::operation::create_project_version::_create_project_version_input::CreateProjectVersionInputBuilder;
5
6impl crate::operation::create_project_version::builders::CreateProjectVersionInputBuilder {
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_project_version::CreateProjectVersionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_project_version::CreateProjectVersionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_project_version();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateProjectVersion`.
24///
25/// <p>Creates a new version of Amazon Rekognition project (like a Custom Labels model or a custom adapter) and begins training. Models and adapters are managed as part of a Rekognition project. The response from <code>CreateProjectVersion</code> is an Amazon Resource Name (ARN) for the project version.</p>
26/// <p>The FeatureConfig operation argument allows you to configure specific model or adapter settings. You can provide a description to the project version by using the VersionDescription argment. Training can take a while to complete. You can get the current status by calling <code>DescribeProjectVersions</code>. Training completed successfully if the value of the <code>Status</code> field is <code>TRAINING_COMPLETED</code>. Once training has successfully completed, call <code>DescribeProjectVersions</code> to get the training results and evaluate the model.</p>
27/// <p>This operation requires permissions to perform the <code>rekognition:CreateProjectVersion</code> action.</p><note>
28/// <p><i>The following applies only to projects with Amazon Rekognition Custom Labels as the chosen feature:</i></p>
29/// <p>You can train a model in a project that doesn't have associated datasets by specifying manifest files in the <code>TrainingData</code> and <code>TestingData</code> fields.</p>
30/// <p>If you open the console after training a model with manifest files, Amazon Rekognition Custom Labels creates the datasets for you using the most recent manifest files. You can no longer train a model version for the project by specifying manifest files.</p>
31/// <p>Instead of training with a project without associated datasets, we recommend that you use the manifest files to create training and test datasets for the project.</p>
32/// </note>
33/// <p></p>
34#[derive(::std::clone::Clone, ::std::fmt::Debug)]
35pub struct CreateProjectVersionFluentBuilder {
36 handle: ::std::sync::Arc<crate::client::Handle>,
37 inner: crate::operation::create_project_version::builders::CreateProjectVersionInputBuilder,
38 config_override: ::std::option::Option<crate::config::Builder>,
39}
40impl
41 crate::client::customize::internal::CustomizableSend<
42 crate::operation::create_project_version::CreateProjectVersionOutput,
43 crate::operation::create_project_version::CreateProjectVersionError,
44 > for CreateProjectVersionFluentBuilder
45{
46 fn send(
47 self,
48 config_override: crate::config::Builder,
49 ) -> crate::client::customize::internal::BoxFuture<
50 crate::client::customize::internal::SendResult<
51 crate::operation::create_project_version::CreateProjectVersionOutput,
52 crate::operation::create_project_version::CreateProjectVersionError,
53 >,
54 > {
55 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
56 }
57}
58impl CreateProjectVersionFluentBuilder {
59 /// Creates a new `CreateProjectVersionFluentBuilder`.
60 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
61 Self {
62 handle,
63 inner: ::std::default::Default::default(),
64 config_override: ::std::option::Option::None,
65 }
66 }
67 /// Access the CreateProjectVersion as a reference.
68 pub fn as_input(&self) -> &crate::operation::create_project_version::builders::CreateProjectVersionInputBuilder {
69 &self.inner
70 }
71 /// Sends the request and returns the response.
72 ///
73 /// If an error occurs, an `SdkError` will be returned with additional details that
74 /// can be matched against.
75 ///
76 /// By default, any retryable failures will be retried twice. Retry behavior
77 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
78 /// set when configuring the client.
79 pub async fn send(
80 self,
81 ) -> ::std::result::Result<
82 crate::operation::create_project_version::CreateProjectVersionOutput,
83 ::aws_smithy_runtime_api::client::result::SdkError<
84 crate::operation::create_project_version::CreateProjectVersionError,
85 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
86 >,
87 > {
88 let input = self
89 .inner
90 .build()
91 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
92 let runtime_plugins = crate::operation::create_project_version::CreateProjectVersion::operation_runtime_plugins(
93 self.handle.runtime_plugins.clone(),
94 &self.handle.conf,
95 self.config_override,
96 );
97 crate::operation::create_project_version::CreateProjectVersion::orchestrate(&runtime_plugins, input).await
98 }
99
100 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
101 pub fn customize(
102 self,
103 ) -> crate::client::customize::CustomizableOperation<
104 crate::operation::create_project_version::CreateProjectVersionOutput,
105 crate::operation::create_project_version::CreateProjectVersionError,
106 Self,
107 > {
108 crate::client::customize::CustomizableOperation::new(self)
109 }
110 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
111 self.set_config_override(::std::option::Option::Some(config_override.into()));
112 self
113 }
114
115 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
116 self.config_override = config_override;
117 self
118 }
119 /// <p>The ARN of the Amazon Rekognition project that will manage the project version you want to train.</p>
120 pub fn project_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121 self.inner = self.inner.project_arn(input.into());
122 self
123 }
124 /// <p>The ARN of the Amazon Rekognition project that will manage the project version you want to train.</p>
125 pub fn set_project_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126 self.inner = self.inner.set_project_arn(input);
127 self
128 }
129 /// <p>The ARN of the Amazon Rekognition project that will manage the project version you want to train.</p>
130 pub fn get_project_arn(&self) -> &::std::option::Option<::std::string::String> {
131 self.inner.get_project_arn()
132 }
133 /// <p>A name for the version of the project version. This value must be unique.</p>
134 pub fn version_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135 self.inner = self.inner.version_name(input.into());
136 self
137 }
138 /// <p>A name for the version of the project version. This value must be unique.</p>
139 pub fn set_version_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140 self.inner = self.inner.set_version_name(input);
141 self
142 }
143 /// <p>A name for the version of the project version. This value must be unique.</p>
144 pub fn get_version_name(&self) -> &::std::option::Option<::std::string::String> {
145 self.inner.get_version_name()
146 }
147 /// <p>The Amazon S3 bucket location to store the results of training. The bucket can be any S3 bucket in your AWS account. You need <code>s3:PutObject</code> permission on the bucket.</p>
148 pub fn output_config(mut self, input: crate::types::OutputConfig) -> Self {
149 self.inner = self.inner.output_config(input);
150 self
151 }
152 /// <p>The Amazon S3 bucket location to store the results of training. The bucket can be any S3 bucket in your AWS account. You need <code>s3:PutObject</code> permission on the bucket.</p>
153 pub fn set_output_config(mut self, input: ::std::option::Option<crate::types::OutputConfig>) -> Self {
154 self.inner = self.inner.set_output_config(input);
155 self
156 }
157 /// <p>The Amazon S3 bucket location to store the results of training. The bucket can be any S3 bucket in your AWS account. You need <code>s3:PutObject</code> permission on the bucket.</p>
158 pub fn get_output_config(&self) -> &::std::option::Option<crate::types::OutputConfig> {
159 self.inner.get_output_config()
160 }
161 /// <p>Specifies an external manifest that the services uses to train the project version. If you specify <code>TrainingData</code> you must also specify <code>TestingData</code>. The project must not have any associated datasets.</p>
162 pub fn training_data(mut self, input: crate::types::TrainingData) -> Self {
163 self.inner = self.inner.training_data(input);
164 self
165 }
166 /// <p>Specifies an external manifest that the services uses to train the project version. If you specify <code>TrainingData</code> you must also specify <code>TestingData</code>. The project must not have any associated datasets.</p>
167 pub fn set_training_data(mut self, input: ::std::option::Option<crate::types::TrainingData>) -> Self {
168 self.inner = self.inner.set_training_data(input);
169 self
170 }
171 /// <p>Specifies an external manifest that the services uses to train the project version. If you specify <code>TrainingData</code> you must also specify <code>TestingData</code>. The project must not have any associated datasets.</p>
172 pub fn get_training_data(&self) -> &::std::option::Option<crate::types::TrainingData> {
173 self.inner.get_training_data()
174 }
175 /// <p>Specifies an external manifest that the service uses to test the project version. If you specify <code>TestingData</code> you must also specify <code>TrainingData</code>. The project must not have any associated datasets.</p>
176 pub fn testing_data(mut self, input: crate::types::TestingData) -> Self {
177 self.inner = self.inner.testing_data(input);
178 self
179 }
180 /// <p>Specifies an external manifest that the service uses to test the project version. If you specify <code>TestingData</code> you must also specify <code>TrainingData</code>. The project must not have any associated datasets.</p>
181 pub fn set_testing_data(mut self, input: ::std::option::Option<crate::types::TestingData>) -> Self {
182 self.inner = self.inner.set_testing_data(input);
183 self
184 }
185 /// <p>Specifies an external manifest that the service uses to test the project version. If you specify <code>TestingData</code> you must also specify <code>TrainingData</code>. The project must not have any associated datasets.</p>
186 pub fn get_testing_data(&self) -> &::std::option::Option<crate::types::TestingData> {
187 self.inner.get_testing_data()
188 }
189 ///
190 /// Adds a key-value pair to `Tags`.
191 ///
192 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
193 ///
194 /// <p>A set of tags (key-value pairs) that you want to attach to the project version.</p>
195 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
196 self.inner = self.inner.tags(k.into(), v.into());
197 self
198 }
199 /// <p>A set of tags (key-value pairs) that you want to attach to the project version.</p>
200 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
201 self.inner = self.inner.set_tags(input);
202 self
203 }
204 /// <p>A set of tags (key-value pairs) that you want to attach to the project version.</p>
205 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
206 self.inner.get_tags()
207 }
208 /// <p>The identifier for your AWS Key Management Service key (AWS KMS key). You can supply the Amazon Resource Name (ARN) of your KMS key, the ID of your KMS key, an alias for your KMS key, or an alias ARN. The key is used to encrypt training images, test images, and manifest files copied into the service for the project version. Your source images are unaffected. The key is also used to encrypt training results and manifest files written to the output Amazon S3 bucket (<code>OutputConfig</code>).</p>
209 /// <p>If you choose to use your own KMS key, you need the following permissions on the KMS key.</p>
210 /// <ul>
211 /// <li>
212 /// <p>kms:CreateGrant</p></li>
213 /// <li>
214 /// <p>kms:DescribeKey</p></li>
215 /// <li>
216 /// <p>kms:GenerateDataKey</p></li>
217 /// <li>
218 /// <p>kms:Decrypt</p></li>
219 /// </ul>
220 /// <p>If you don't specify a value for <code>KmsKeyId</code>, images copied into the service are encrypted using a key that AWS owns and manages.</p>
221 pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
222 self.inner = self.inner.kms_key_id(input.into());
223 self
224 }
225 /// <p>The identifier for your AWS Key Management Service key (AWS KMS key). You can supply the Amazon Resource Name (ARN) of your KMS key, the ID of your KMS key, an alias for your KMS key, or an alias ARN. The key is used to encrypt training images, test images, and manifest files copied into the service for the project version. Your source images are unaffected. The key is also used to encrypt training results and manifest files written to the output Amazon S3 bucket (<code>OutputConfig</code>).</p>
226 /// <p>If you choose to use your own KMS key, you need the following permissions on the KMS key.</p>
227 /// <ul>
228 /// <li>
229 /// <p>kms:CreateGrant</p></li>
230 /// <li>
231 /// <p>kms:DescribeKey</p></li>
232 /// <li>
233 /// <p>kms:GenerateDataKey</p></li>
234 /// <li>
235 /// <p>kms:Decrypt</p></li>
236 /// </ul>
237 /// <p>If you don't specify a value for <code>KmsKeyId</code>, images copied into the service are encrypted using a key that AWS owns and manages.</p>
238 pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
239 self.inner = self.inner.set_kms_key_id(input);
240 self
241 }
242 /// <p>The identifier for your AWS Key Management Service key (AWS KMS key). You can supply the Amazon Resource Name (ARN) of your KMS key, the ID of your KMS key, an alias for your KMS key, or an alias ARN. The key is used to encrypt training images, test images, and manifest files copied into the service for the project version. Your source images are unaffected. The key is also used to encrypt training results and manifest files written to the output Amazon S3 bucket (<code>OutputConfig</code>).</p>
243 /// <p>If you choose to use your own KMS key, you need the following permissions on the KMS key.</p>
244 /// <ul>
245 /// <li>
246 /// <p>kms:CreateGrant</p></li>
247 /// <li>
248 /// <p>kms:DescribeKey</p></li>
249 /// <li>
250 /// <p>kms:GenerateDataKey</p></li>
251 /// <li>
252 /// <p>kms:Decrypt</p></li>
253 /// </ul>
254 /// <p>If you don't specify a value for <code>KmsKeyId</code>, images copied into the service are encrypted using a key that AWS owns and manages.</p>
255 pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
256 self.inner.get_kms_key_id()
257 }
258 /// <p>A description applied to the project version being created.</p>
259 pub fn version_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
260 self.inner = self.inner.version_description(input.into());
261 self
262 }
263 /// <p>A description applied to the project version being created.</p>
264 pub fn set_version_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
265 self.inner = self.inner.set_version_description(input);
266 self
267 }
268 /// <p>A description applied to the project version being created.</p>
269 pub fn get_version_description(&self) -> &::std::option::Option<::std::string::String> {
270 self.inner.get_version_description()
271 }
272 /// <p>Feature-specific configuration of the training job. If the job configuration does not match the feature type associated with the project, an InvalidParameterException is returned.</p>
273 pub fn feature_config(mut self, input: crate::types::CustomizationFeatureConfig) -> Self {
274 self.inner = self.inner.feature_config(input);
275 self
276 }
277 /// <p>Feature-specific configuration of the training job. If the job configuration does not match the feature type associated with the project, an InvalidParameterException is returned.</p>
278 pub fn set_feature_config(mut self, input: ::std::option::Option<crate::types::CustomizationFeatureConfig>) -> Self {
279 self.inner = self.inner.set_feature_config(input);
280 self
281 }
282 /// <p>Feature-specific configuration of the training job. If the job configuration does not match the feature type associated with the project, an InvalidParameterException is returned.</p>
283 pub fn get_feature_config(&self) -> &::std::option::Option<crate::types::CustomizationFeatureConfig> {
284 self.inner.get_feature_config()
285 }
286}