aws_sdk_iotjobsdataplane/operation/update_job_execution/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_job_execution::_update_job_execution_output::UpdateJobExecutionOutputBuilder;
3
4pub use crate::operation::update_job_execution::_update_job_execution_input::UpdateJobExecutionInputBuilder;
5
6impl crate::operation::update_job_execution::builders::UpdateJobExecutionInputBuilder {
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::update_job_execution::UpdateJobExecutionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_job_execution::UpdateJobExecutionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_job_execution();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateJobExecution`.
24///
25/// <p>Updates the status of a job execution.</p>
26/// <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiotjobsdataplane.html">UpdateJobExecution</a> action.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct UpdateJobExecutionFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::update_job_execution::builders::UpdateJobExecutionInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::update_job_execution::UpdateJobExecutionOutput,
36        crate::operation::update_job_execution::UpdateJobExecutionError,
37    > for UpdateJobExecutionFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::update_job_execution::UpdateJobExecutionOutput,
45            crate::operation::update_job_execution::UpdateJobExecutionError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl UpdateJobExecutionFluentBuilder {
52    /// Creates a new `UpdateJobExecutionFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the UpdateJobExecution as a reference.
61    pub fn as_input(&self) -> &crate::operation::update_job_execution::builders::UpdateJobExecutionInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::update_job_execution::UpdateJobExecutionOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::update_job_execution::UpdateJobExecutionError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::update_job_execution::UpdateJobExecution::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::update_job_execution::UpdateJobExecution::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::update_job_execution::UpdateJobExecutionOutput,
98        crate::operation::update_job_execution::UpdateJobExecutionError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The unique identifier assigned to this job when it was created.</p>
113    pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.job_id(input.into());
115        self
116    }
117    /// <p>The unique identifier assigned to this job when it was created.</p>
118    pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_job_id(input);
120        self
121    }
122    /// <p>The unique identifier assigned to this job when it was created.</p>
123    pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_job_id()
125    }
126    /// <p>The name of the thing associated with the device.</p>
127    pub fn thing_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.thing_name(input.into());
129        self
130    }
131    /// <p>The name of the thing associated with the device.</p>
132    pub fn set_thing_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_thing_name(input);
134        self
135    }
136    /// <p>The name of the thing associated with the device.</p>
137    pub fn get_thing_name(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_thing_name()
139    }
140    /// <p>The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or REJECTED). This must be specified on every update.</p>
141    pub fn status(mut self, input: crate::types::JobExecutionStatus) -> Self {
142        self.inner = self.inner.status(input);
143        self
144    }
145    /// <p>The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or REJECTED). This must be specified on every update.</p>
146    pub fn set_status(mut self, input: ::std::option::Option<crate::types::JobExecutionStatus>) -> Self {
147        self.inner = self.inner.set_status(input);
148        self
149    }
150    /// <p>The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or REJECTED). This must be specified on every update.</p>
151    pub fn get_status(&self) -> &::std::option::Option<crate::types::JobExecutionStatus> {
152        self.inner.get_status()
153    }
154    ///
155    /// Adds a key-value pair to `statusDetails`.
156    ///
157    /// To override the contents of this collection use [`set_status_details`](Self::set_status_details).
158    ///
159    /// <p>Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.</p>
160    /// <p>The maximum length of the value in the name/value pair is 1,024 characters.</p>
161    pub fn status_details(
162        mut self,
163        k: impl ::std::convert::Into<::std::string::String>,
164        v: impl ::std::convert::Into<::std::string::String>,
165    ) -> Self {
166        self.inner = self.inner.status_details(k.into(), v.into());
167        self
168    }
169    /// <p>Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.</p>
170    /// <p>The maximum length of the value in the name/value pair is 1,024 characters.</p>
171    pub fn set_status_details(
172        mut self,
173        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
174    ) -> Self {
175        self.inner = self.inner.set_status_details(input);
176        self
177    }
178    /// <p>Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.</p>
179    /// <p>The maximum length of the value in the name/value pair is 1,024 characters.</p>
180    pub fn get_status_details(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
181        self.inner.get_status_details()
182    }
183    /// <p>Specifies the amount of time this device has to finish execution of this job. If the job execution status is not set to a terminal state before this timer expires, or before the timer is reset (by again calling <code>UpdateJobExecution</code>, setting the status to <code>IN_PROGRESS</code>, and specifying a new timeout value in this field) the job execution status will be automatically set to <code>TIMED_OUT</code>. Note that setting or resetting the step timeout has no effect on the in progress timeout that may have been specified when the job was created (<code>CreateJob</code> using field <code>timeoutConfig</code>).</p>
184    /// <p>Valid values for this parameter range from 1 to 10080 (1 minute to 7 days). A value of -1 is also valid and will cancel the current step timer (created by an earlier use of <code>UpdateJobExecutionRequest</code>).</p>
185    pub fn step_timeout_in_minutes(mut self, input: i64) -> Self {
186        self.inner = self.inner.step_timeout_in_minutes(input);
187        self
188    }
189    /// <p>Specifies the amount of time this device has to finish execution of this job. If the job execution status is not set to a terminal state before this timer expires, or before the timer is reset (by again calling <code>UpdateJobExecution</code>, setting the status to <code>IN_PROGRESS</code>, and specifying a new timeout value in this field) the job execution status will be automatically set to <code>TIMED_OUT</code>. Note that setting or resetting the step timeout has no effect on the in progress timeout that may have been specified when the job was created (<code>CreateJob</code> using field <code>timeoutConfig</code>).</p>
190    /// <p>Valid values for this parameter range from 1 to 10080 (1 minute to 7 days). A value of -1 is also valid and will cancel the current step timer (created by an earlier use of <code>UpdateJobExecutionRequest</code>).</p>
191    pub fn set_step_timeout_in_minutes(mut self, input: ::std::option::Option<i64>) -> Self {
192        self.inner = self.inner.set_step_timeout_in_minutes(input);
193        self
194    }
195    /// <p>Specifies the amount of time this device has to finish execution of this job. If the job execution status is not set to a terminal state before this timer expires, or before the timer is reset (by again calling <code>UpdateJobExecution</code>, setting the status to <code>IN_PROGRESS</code>, and specifying a new timeout value in this field) the job execution status will be automatically set to <code>TIMED_OUT</code>. Note that setting or resetting the step timeout has no effect on the in progress timeout that may have been specified when the job was created (<code>CreateJob</code> using field <code>timeoutConfig</code>).</p>
196    /// <p>Valid values for this parameter range from 1 to 10080 (1 minute to 7 days). A value of -1 is also valid and will cancel the current step timer (created by an earlier use of <code>UpdateJobExecutionRequest</code>).</p>
197    pub fn get_step_timeout_in_minutes(&self) -> &::std::option::Option<i64> {
198        self.inner.get_step_timeout_in_minutes()
199    }
200    /// <p>Optional. The expected current version of the job execution. Each time you update the job execution, its version is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job execution status data.)</p>
201    pub fn expected_version(mut self, input: i64) -> Self {
202        self.inner = self.inner.expected_version(input);
203        self
204    }
205    /// <p>Optional. The expected current version of the job execution. Each time you update the job execution, its version is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job execution status data.)</p>
206    pub fn set_expected_version(mut self, input: ::std::option::Option<i64>) -> Self {
207        self.inner = self.inner.set_expected_version(input);
208        self
209    }
210    /// <p>Optional. The expected current version of the job execution. Each time you update the job execution, its version is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job execution status data.)</p>
211    pub fn get_expected_version(&self) -> &::std::option::Option<i64> {
212        self.inner.get_expected_version()
213    }
214    /// <p>Optional. When included and set to true, the response contains the JobExecutionState data. The default is false.</p>
215    pub fn include_job_execution_state(mut self, input: bool) -> Self {
216        self.inner = self.inner.include_job_execution_state(input);
217        self
218    }
219    /// <p>Optional. When included and set to true, the response contains the JobExecutionState data. The default is false.</p>
220    pub fn set_include_job_execution_state(mut self, input: ::std::option::Option<bool>) -> Self {
221        self.inner = self.inner.set_include_job_execution_state(input);
222        self
223    }
224    /// <p>Optional. When included and set to true, the response contains the JobExecutionState data. The default is false.</p>
225    pub fn get_include_job_execution_state(&self) -> &::std::option::Option<bool> {
226        self.inner.get_include_job_execution_state()
227    }
228    /// <p>Optional. When set to true, the response contains the job document. The default is false.</p>
229    pub fn include_job_document(mut self, input: bool) -> Self {
230        self.inner = self.inner.include_job_document(input);
231        self
232    }
233    /// <p>Optional. When set to true, the response contains the job document. The default is false.</p>
234    pub fn set_include_job_document(mut self, input: ::std::option::Option<bool>) -> Self {
235        self.inner = self.inner.set_include_job_document(input);
236        self
237    }
238    /// <p>Optional. When set to true, the response contains the job document. The default is false.</p>
239    pub fn get_include_job_document(&self) -> &::std::option::Option<bool> {
240        self.inner.get_include_job_document()
241    }
242    /// <p>Optional. A number that identifies a particular job execution on a particular device.</p>
243    pub fn execution_number(mut self, input: i64) -> Self {
244        self.inner = self.inner.execution_number(input);
245        self
246    }
247    /// <p>Optional. A number that identifies a particular job execution on a particular device.</p>
248    pub fn set_execution_number(mut self, input: ::std::option::Option<i64>) -> Self {
249        self.inner = self.inner.set_execution_number(input);
250        self
251    }
252    /// <p>Optional. A number that identifies a particular job execution on a particular device.</p>
253    pub fn get_execution_number(&self) -> &::std::option::Option<i64> {
254        self.inner.get_execution_number()
255    }
256}