aws_sdk_lookoutvision/operation/start_model_packaging_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_model_packaging_job::_start_model_packaging_job_output::StartModelPackagingJobOutputBuilder;
3
4pub use crate::operation::start_model_packaging_job::_start_model_packaging_job_input::StartModelPackagingJobInputBuilder;
5
6impl crate::operation::start_model_packaging_job::builders::StartModelPackagingJobInputBuilder {
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::start_model_packaging_job::StartModelPackagingJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_model_packaging_job::StartModelPackagingJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_model_packaging_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartModelPackagingJob`.
24///
25/// <p>Starts an Amazon Lookout for Vision model packaging job. A model packaging job creates an AWS IoT Greengrass component for a Lookout for Vision model. You can use the component to deploy your model to an edge device managed by Greengrass.</p>
26/// <p>Use the <code>DescribeModelPackagingJob</code> API to determine the current status of the job. The model packaging job is complete if the value of <code>Status</code> is <code>SUCCEEDED</code>.</p>
27/// <p>To deploy the component to the target device, use the component name and component version with the AWS IoT Greengrass <a href="https://docs.aws.amazon.com/greengrass/v2/APIReference/API_CreateDeployment.html">CreateDeployment</a> API.</p>
28/// <p>This operation requires the following permissions:</p>
29/// <ul>
30/// <li>
31/// <p><code>lookoutvision:StartModelPackagingJob</code></p></li>
32/// <li>
33/// <p><code>s3:PutObject</code></p></li>
34/// <li>
35/// <p><code>s3:GetBucketLocation</code></p></li>
36/// <li>
37/// <p><code>kms:GenerateDataKey</code></p></li>
38/// <li>
39/// <p><code>greengrass:CreateComponentVersion</code></p></li>
40/// <li>
41/// <p><code>greengrass:DescribeComponent</code></p></li>
42/// <li>
43/// <p>(Optional) <code>greengrass:TagResource</code>. Only required if you want to tag the component.</p></li>
44/// </ul>
45/// <p>For more information, see <i>Using your Amazon Lookout for Vision model on an edge device</i> in the Amazon Lookout for Vision Developer Guide.</p>
46#[derive(::std::clone::Clone, ::std::fmt::Debug)]
47pub struct StartModelPackagingJobFluentBuilder {
48    handle: ::std::sync::Arc<crate::client::Handle>,
49    inner: crate::operation::start_model_packaging_job::builders::StartModelPackagingJobInputBuilder,
50    config_override: ::std::option::Option<crate::config::Builder>,
51}
52impl
53    crate::client::customize::internal::CustomizableSend<
54        crate::operation::start_model_packaging_job::StartModelPackagingJobOutput,
55        crate::operation::start_model_packaging_job::StartModelPackagingJobError,
56    > for StartModelPackagingJobFluentBuilder
57{
58    fn send(
59        self,
60        config_override: crate::config::Builder,
61    ) -> crate::client::customize::internal::BoxFuture<
62        crate::client::customize::internal::SendResult<
63            crate::operation::start_model_packaging_job::StartModelPackagingJobOutput,
64            crate::operation::start_model_packaging_job::StartModelPackagingJobError,
65        >,
66    > {
67        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
68    }
69}
70impl StartModelPackagingJobFluentBuilder {
71    /// Creates a new `StartModelPackagingJobFluentBuilder`.
72    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
73        Self {
74            handle,
75            inner: ::std::default::Default::default(),
76            config_override: ::std::option::Option::None,
77        }
78    }
79    /// Access the StartModelPackagingJob as a reference.
80    pub fn as_input(&self) -> &crate::operation::start_model_packaging_job::builders::StartModelPackagingJobInputBuilder {
81        &self.inner
82    }
83    /// Sends the request and returns the response.
84    ///
85    /// If an error occurs, an `SdkError` will be returned with additional details that
86    /// can be matched against.
87    ///
88    /// By default, any retryable failures will be retried twice. Retry behavior
89    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
90    /// set when configuring the client.
91    pub async fn send(
92        self,
93    ) -> ::std::result::Result<
94        crate::operation::start_model_packaging_job::StartModelPackagingJobOutput,
95        ::aws_smithy_runtime_api::client::result::SdkError<
96            crate::operation::start_model_packaging_job::StartModelPackagingJobError,
97            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
98        >,
99    > {
100        let input = self
101            .inner
102            .build()
103            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
104        let runtime_plugins = crate::operation::start_model_packaging_job::StartModelPackagingJob::operation_runtime_plugins(
105            self.handle.runtime_plugins.clone(),
106            &self.handle.conf,
107            self.config_override,
108        );
109        crate::operation::start_model_packaging_job::StartModelPackagingJob::orchestrate(&runtime_plugins, input).await
110    }
111
112    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
113    pub fn customize(
114        self,
115    ) -> crate::client::customize::CustomizableOperation<
116        crate::operation::start_model_packaging_job::StartModelPackagingJobOutput,
117        crate::operation::start_model_packaging_job::StartModelPackagingJobError,
118        Self,
119    > {
120        crate::client::customize::CustomizableOperation::new(self)
121    }
122    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
123        self.set_config_override(::std::option::Option::Some(config_override.into()));
124        self
125    }
126
127    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
128        self.config_override = config_override;
129        self
130    }
131    /// <p>The name of the project which contains the version of the model that you want to package.</p>
132    pub fn project_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.inner = self.inner.project_name(input.into());
134        self
135    }
136    /// <p>The name of the project which contains the version of the model that you want to package.</p>
137    pub fn set_project_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.inner = self.inner.set_project_name(input);
139        self
140    }
141    /// <p>The name of the project which contains the version of the model that you want to package.</p>
142    pub fn get_project_name(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_project_name()
144    }
145    /// <p>The version of the model within the project that you want to package.</p>
146    pub fn model_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.model_version(input.into());
148        self
149    }
150    /// <p>The version of the model within the project that you want to package.</p>
151    pub fn set_model_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_model_version(input);
153        self
154    }
155    /// <p>The version of the model within the project that you want to package.</p>
156    pub fn get_model_version(&self) -> &::std::option::Option<::std::string::String> {
157        self.inner.get_model_version()
158    }
159    /// <p>A name for the model packaging job. If you don't supply a value, the service creates a job name for you.</p>
160    pub fn job_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.job_name(input.into());
162        self
163    }
164    /// <p>A name for the model packaging job. If you don't supply a value, the service creates a job name for you.</p>
165    pub fn set_job_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.inner = self.inner.set_job_name(input);
167        self
168    }
169    /// <p>A name for the model packaging job. If you don't supply a value, the service creates a job name for you.</p>
170    pub fn get_job_name(&self) -> &::std::option::Option<::std::string::String> {
171        self.inner.get_job_name()
172    }
173    /// <p>The configuration for the model packaging job.</p>
174    pub fn configuration(mut self, input: crate::types::ModelPackagingConfiguration) -> Self {
175        self.inner = self.inner.configuration(input);
176        self
177    }
178    /// <p>The configuration for the model packaging job.</p>
179    pub fn set_configuration(mut self, input: ::std::option::Option<crate::types::ModelPackagingConfiguration>) -> Self {
180        self.inner = self.inner.set_configuration(input);
181        self
182    }
183    /// <p>The configuration for the model packaging job.</p>
184    pub fn get_configuration(&self) -> &::std::option::Option<crate::types::ModelPackagingConfiguration> {
185        self.inner.get_configuration()
186    }
187    /// <p>A description for the model packaging job.</p>
188    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189        self.inner = self.inner.description(input.into());
190        self
191    }
192    /// <p>A description for the model packaging job.</p>
193    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194        self.inner = self.inner.set_description(input);
195        self
196    }
197    /// <p>A description for the model packaging job.</p>
198    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
199        self.inner.get_description()
200    }
201    /// <p>ClientToken is an idempotency token that ensures a call to <code>StartModelPackagingJob</code> completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from <code>StartModelPackagingJob</code>. In this case, safely retry your call to <code>StartModelPackagingJob</code> by using the same <code>ClientToken</code> parameter value.</p>
202    /// <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 making multiple dataset creation requests. You'll need to provide your own value for other use cases.</p>
203    /// <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>StartModelPackagingJob</code>. An idempotency token is active for 8 hours.</p>
204    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205        self.inner = self.inner.client_token(input.into());
206        self
207    }
208    /// <p>ClientToken is an idempotency token that ensures a call to <code>StartModelPackagingJob</code> completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from <code>StartModelPackagingJob</code>. In this case, safely retry your call to <code>StartModelPackagingJob</code> by using the same <code>ClientToken</code> parameter value.</p>
209    /// <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 making multiple dataset creation requests. You'll need to provide your own value for other use cases.</p>
210    /// <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>StartModelPackagingJob</code>. An idempotency token is active for 8 hours.</p>
211    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
212        self.inner = self.inner.set_client_token(input);
213        self
214    }
215    /// <p>ClientToken is an idempotency token that ensures a call to <code>StartModelPackagingJob</code> completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from <code>StartModelPackagingJob</code>. In this case, safely retry your call to <code>StartModelPackagingJob</code> by using the same <code>ClientToken</code> parameter value.</p>
216    /// <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 making multiple dataset creation requests. You'll need to provide your own value for other use cases.</p>
217    /// <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>StartModelPackagingJob</code>. An idempotency token is active for 8 hours.</p>
218    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
219        self.inner.get_client_token()
220    }
221}