aws_sdk_lookoutvision/operation/create_model/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_model::_create_model_output::CreateModelOutputBuilder;
3
4pub use crate::operation::create_model::_create_model_input::CreateModelInputBuilder;
5
6impl crate::operation::create_model::builders::CreateModelInputBuilder {
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_model::CreateModelOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_model::CreateModelError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_model();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateModel`.
24///
25/// <p>Creates a new version of a model within an an Amazon Lookout for Vision project. <code>CreateModel</code> is an asynchronous operation in which Amazon Lookout for Vision trains, tests, and evaluates a new version of a model.</p>
26/// <p>To get the current status, check the <code>Status</code> field returned in the response from <code>DescribeModel</code>.</p>
27/// <p>If the project has a single dataset, Amazon Lookout for Vision internally splits the dataset to create a training and a test dataset. If the project has a training and a test dataset, Lookout for Vision uses the respective datasets to train and test the model.</p>
28/// <p>After training completes, the evaluation metrics are stored at the location specified in <code>OutputConfig</code>.</p>
29/// <p>This operation requires permissions to perform the <code>lookoutvision:CreateModel</code> operation. If you want to tag your model, you also require permission to the <code>lookoutvision:TagResource</code> operation.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct CreateModelFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::create_model::builders::CreateModelInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::create_model::CreateModelOutput,
39        crate::operation::create_model::CreateModelError,
40    > for CreateModelFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::create_model::CreateModelOutput,
48            crate::operation::create_model::CreateModelError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl CreateModelFluentBuilder {
55    /// Creates a new `CreateModelFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the CreateModel as a reference.
64    pub fn as_input(&self) -> &crate::operation::create_model::builders::CreateModelInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::create_model::CreateModelOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::create_model::CreateModelError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::create_model::CreateModel::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::create_model::CreateModel::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::create_model::CreateModelOutput,
101        crate::operation::create_model::CreateModelError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>The name of the project in which you want to create a model version.</p>
116    pub fn project_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.inner = self.inner.project_name(input.into());
118        self
119    }
120    /// <p>The name of the project in which you want to create a model version.</p>
121    pub fn set_project_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_project_name(input);
123        self
124    }
125    /// <p>The name of the project in which you want to create a model version.</p>
126    pub fn get_project_name(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_project_name()
128    }
129    /// <p>A description for the version of the model.</p>
130    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.description(input.into());
132        self
133    }
134    /// <p>A description for the version of the model.</p>
135    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_description(input);
137        self
138    }
139    /// <p>A description for the version of the model.</p>
140    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_description()
142    }
143    /// <p>ClientToken is an idempotency token that ensures a call to <code>CreateModel</code> completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from <code>CreateModel</code>. In this case, safely retry your call to <code>CreateModel</code> by using the same <code>ClientToken</code> parameter value.</p>
144    /// <p>If you don't supply a value for <code>ClientToken</code>, the AWS SDK you are using inserts a value for you. This prevents retries after a network error from starting multiple training jobs. You'll need to provide your own value for other use cases.</p>
145    /// <p>An error occurs if the other input parameters are not the same as in the first request. Using a different value for <code>ClientToken</code> is considered a new call to <code>CreateModel</code>. An idempotency token is active for 8 hours.</p>
146    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.client_token(input.into());
148        self
149    }
150    /// <p>ClientToken is an idempotency token that ensures a call to <code>CreateModel</code> completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from <code>CreateModel</code>. In this case, safely retry your call to <code>CreateModel</code> by using the same <code>ClientToken</code> parameter value.</p>
151    /// <p>If you don't supply a value for <code>ClientToken</code>, the AWS SDK you are using inserts a value for you. This prevents retries after a network error from starting multiple training jobs. You'll need to provide your own value for other use cases.</p>
152    /// <p>An error occurs if the other input parameters are not the same as in the first request. Using a different value for <code>ClientToken</code> is considered a new call to <code>CreateModel</code>. An idempotency token is active for 8 hours.</p>
153    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.inner = self.inner.set_client_token(input);
155        self
156    }
157    /// <p>ClientToken is an idempotency token that ensures a call to <code>CreateModel</code> completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from <code>CreateModel</code>. In this case, safely retry your call to <code>CreateModel</code> by using the same <code>ClientToken</code> parameter value.</p>
158    /// <p>If you don't supply a value for <code>ClientToken</code>, the AWS SDK you are using inserts a value for you. This prevents retries after a network error from starting multiple training jobs. You'll need to provide your own value for other use cases.</p>
159    /// <p>An error occurs if the other input parameters are not the same as in the first request. Using a different value for <code>ClientToken</code> is considered a new call to <code>CreateModel</code>. An idempotency token is active for 8 hours.</p>
160    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
161        self.inner.get_client_token()
162    }
163    /// <p>The location where Amazon Lookout for Vision saves the training results.</p>
164    pub fn output_config(mut self, input: crate::types::OutputConfig) -> Self {
165        self.inner = self.inner.output_config(input);
166        self
167    }
168    /// <p>The location where Amazon Lookout for Vision saves the training results.</p>
169    pub fn set_output_config(mut self, input: ::std::option::Option<crate::types::OutputConfig>) -> Self {
170        self.inner = self.inner.set_output_config(input);
171        self
172    }
173    /// <p>The location where Amazon Lookout for Vision saves the training results.</p>
174    pub fn get_output_config(&self) -> &::std::option::Option<crate::types::OutputConfig> {
175        self.inner.get_output_config()
176    }
177    /// <p>The identifier for your AWS KMS key. The key is used to encrypt training and test images copied into the service for model training. Your source images are unaffected. If this parameter is not specified, the copied images are encrypted by a key that AWS owns and manages.</p>
178    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
179        self.inner = self.inner.kms_key_id(input.into());
180        self
181    }
182    /// <p>The identifier for your AWS KMS key. The key is used to encrypt training and test images copied into the service for model training. Your source images are unaffected. If this parameter is not specified, the copied images are encrypted by a key that AWS owns and manages.</p>
183    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
184        self.inner = self.inner.set_kms_key_id(input);
185        self
186    }
187    /// <p>The identifier for your AWS KMS key. The key is used to encrypt training and test images copied into the service for model training. Your source images are unaffected. If this parameter is not specified, the copied images are encrypted by a key that AWS owns and manages.</p>
188    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
189        self.inner.get_kms_key_id()
190    }
191    ///
192    /// Appends an item to `Tags`.
193    ///
194    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
195    ///
196    /// <p>A set of tags (key-value pairs) that you want to attach to the model.</p>
197    pub fn tags(mut self, input: crate::types::Tag) -> Self {
198        self.inner = self.inner.tags(input);
199        self
200    }
201    /// <p>A set of tags (key-value pairs) that you want to attach to the model.</p>
202    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
203        self.inner = self.inner.set_tags(input);
204        self
205    }
206    /// <p>A set of tags (key-value pairs) that you want to attach to the model.</p>
207    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
208        self.inner.get_tags()
209    }
210}