aws_sdk_iot/operation/create_job_template/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_job_template::_create_job_template_output::CreateJobTemplateOutputBuilder;
3
4pub use crate::operation::create_job_template::_create_job_template_input::CreateJobTemplateInputBuilder;
5
6impl crate::operation::create_job_template::builders::CreateJobTemplateInputBuilder {
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_job_template::CreateJobTemplateOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_job_template::CreateJobTemplateError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_job_template();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateJobTemplate`.
24///
25/// <p>Creates a job template.</p>
26/// <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateJobTemplate</a> action.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateJobTemplateFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_job_template::builders::CreateJobTemplateInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::create_job_template::CreateJobTemplateOutput,
36        crate::operation::create_job_template::CreateJobTemplateError,
37    > for CreateJobTemplateFluentBuilder
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::create_job_template::CreateJobTemplateOutput,
45            crate::operation::create_job_template::CreateJobTemplateError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl CreateJobTemplateFluentBuilder {
52    /// Creates a new `CreateJobTemplateFluentBuilder`.
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 CreateJobTemplate as a reference.
61    pub fn as_input(&self) -> &crate::operation::create_job_template::builders::CreateJobTemplateInputBuilder {
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::create_job_template::CreateJobTemplateOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::create_job_template::CreateJobTemplateError,
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::create_job_template::CreateJobTemplate::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::create_job_template::CreateJobTemplate::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::create_job_template::CreateJobTemplateOutput,
98        crate::operation::create_job_template::CreateJobTemplateError,
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>A unique identifier for the job template. We recommend using a UUID. Alpha-numeric characters, "-", and "_" are valid for use here.</p>
113    pub fn job_template_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.job_template_id(input.into());
115        self
116    }
117    /// <p>A unique identifier for the job template. We recommend using a UUID. Alpha-numeric characters, "-", and "_" are valid for use here.</p>
118    pub fn set_job_template_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_job_template_id(input);
120        self
121    }
122    /// <p>A unique identifier for the job template. We recommend using a UUID. Alpha-numeric characters, "-", and "_" are valid for use here.</p>
123    pub fn get_job_template_id(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_job_template_id()
125    }
126    /// <p>The ARN of the job to use as the basis for the job template.</p>
127    pub fn job_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.job_arn(input.into());
129        self
130    }
131    /// <p>The ARN of the job to use as the basis for the job template.</p>
132    pub fn set_job_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_job_arn(input);
134        self
135    }
136    /// <p>The ARN of the job to use as the basis for the job template.</p>
137    pub fn get_job_arn(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_job_arn()
139    }
140    /// <p>An S3 link, or S3 object URL, to the job document. The link is an Amazon S3 object URL and is required if you don't specify a value for <code>document</code>.</p>
141    /// <p>For example, <code>--document-source https://s3.<i>region-code</i>.amazonaws.com/example-firmware/device-firmware.1.0</code></p>
142    /// <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html">Methods for accessing a bucket</a>.</p>
143    pub fn document_source(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        self.inner = self.inner.document_source(input.into());
145        self
146    }
147    /// <p>An S3 link, or S3 object URL, to the job document. The link is an Amazon S3 object URL and is required if you don't specify a value for <code>document</code>.</p>
148    /// <p>For example, <code>--document-source https://s3.<i>region-code</i>.amazonaws.com/example-firmware/device-firmware.1.0</code></p>
149    /// <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html">Methods for accessing a bucket</a>.</p>
150    pub fn set_document_source(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_document_source(input);
152        self
153    }
154    /// <p>An S3 link, or S3 object URL, to the job document. The link is an Amazon S3 object URL and is required if you don't specify a value for <code>document</code>.</p>
155    /// <p>For example, <code>--document-source https://s3.<i>region-code</i>.amazonaws.com/example-firmware/device-firmware.1.0</code></p>
156    /// <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html">Methods for accessing a bucket</a>.</p>
157    pub fn get_document_source(&self) -> &::std::option::Option<::std::string::String> {
158        self.inner.get_document_source()
159    }
160    /// <p>The job document. Required if you don't specify a value for <code>documentSource</code>.</p>
161    pub fn document(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162        self.inner = self.inner.document(input.into());
163        self
164    }
165    /// <p>The job document. Required if you don't specify a value for <code>documentSource</code>.</p>
166    pub fn set_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167        self.inner = self.inner.set_document(input);
168        self
169    }
170    /// <p>The job document. Required if you don't specify a value for <code>documentSource</code>.</p>
171    pub fn get_document(&self) -> &::std::option::Option<::std::string::String> {
172        self.inner.get_document()
173    }
174    /// <p>A description of the job document.</p>
175    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176        self.inner = self.inner.description(input.into());
177        self
178    }
179    /// <p>A description of the job document.</p>
180    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181        self.inner = self.inner.set_description(input);
182        self
183    }
184    /// <p>A description of the job document.</p>
185    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
186        self.inner.get_description()
187    }
188    /// <p>Configuration for pre-signed S3 URLs.</p>
189    pub fn presigned_url_config(mut self, input: crate::types::PresignedUrlConfig) -> Self {
190        self.inner = self.inner.presigned_url_config(input);
191        self
192    }
193    /// <p>Configuration for pre-signed S3 URLs.</p>
194    pub fn set_presigned_url_config(mut self, input: ::std::option::Option<crate::types::PresignedUrlConfig>) -> Self {
195        self.inner = self.inner.set_presigned_url_config(input);
196        self
197    }
198    /// <p>Configuration for pre-signed S3 URLs.</p>
199    pub fn get_presigned_url_config(&self) -> &::std::option::Option<crate::types::PresignedUrlConfig> {
200        self.inner.get_presigned_url_config()
201    }
202    /// <p>Allows you to create a staged rollout of a job.</p>
203    pub fn job_executions_rollout_config(mut self, input: crate::types::JobExecutionsRolloutConfig) -> Self {
204        self.inner = self.inner.job_executions_rollout_config(input);
205        self
206    }
207    /// <p>Allows you to create a staged rollout of a job.</p>
208    pub fn set_job_executions_rollout_config(mut self, input: ::std::option::Option<crate::types::JobExecutionsRolloutConfig>) -> Self {
209        self.inner = self.inner.set_job_executions_rollout_config(input);
210        self
211    }
212    /// <p>Allows you to create a staged rollout of a job.</p>
213    pub fn get_job_executions_rollout_config(&self) -> &::std::option::Option<crate::types::JobExecutionsRolloutConfig> {
214        self.inner.get_job_executions_rollout_config()
215    }
216    /// <p>The criteria that determine when and how a job abort takes place.</p>
217    pub fn abort_config(mut self, input: crate::types::AbortConfig) -> Self {
218        self.inner = self.inner.abort_config(input);
219        self
220    }
221    /// <p>The criteria that determine when and how a job abort takes place.</p>
222    pub fn set_abort_config(mut self, input: ::std::option::Option<crate::types::AbortConfig>) -> Self {
223        self.inner = self.inner.set_abort_config(input);
224        self
225    }
226    /// <p>The criteria that determine when and how a job abort takes place.</p>
227    pub fn get_abort_config(&self) -> &::std::option::Option<crate::types::AbortConfig> {
228        self.inner.get_abort_config()
229    }
230    /// <p>Specifies the amount of time each device has to finish its execution of the job. A timer is started when the job execution status is set to <code>IN_PROGRESS</code>. If the job execution status is not set to another terminal state before the timer expires, it will be automatically set to <code>TIMED_OUT</code>.</p>
231    pub fn timeout_config(mut self, input: crate::types::TimeoutConfig) -> Self {
232        self.inner = self.inner.timeout_config(input);
233        self
234    }
235    /// <p>Specifies the amount of time each device has to finish its execution of the job. A timer is started when the job execution status is set to <code>IN_PROGRESS</code>. If the job execution status is not set to another terminal state before the timer expires, it will be automatically set to <code>TIMED_OUT</code>.</p>
236    pub fn set_timeout_config(mut self, input: ::std::option::Option<crate::types::TimeoutConfig>) -> Self {
237        self.inner = self.inner.set_timeout_config(input);
238        self
239    }
240    /// <p>Specifies the amount of time each device has to finish its execution of the job. A timer is started when the job execution status is set to <code>IN_PROGRESS</code>. If the job execution status is not set to another terminal state before the timer expires, it will be automatically set to <code>TIMED_OUT</code>.</p>
241    pub fn get_timeout_config(&self) -> &::std::option::Option<crate::types::TimeoutConfig> {
242        self.inner.get_timeout_config()
243    }
244    ///
245    /// Appends an item to `tags`.
246    ///
247    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
248    ///
249    /// <p>Metadata that can be used to manage the job template.</p>
250    pub fn tags(mut self, input: crate::types::Tag) -> Self {
251        self.inner = self.inner.tags(input);
252        self
253    }
254    /// <p>Metadata that can be used to manage the job template.</p>
255    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
256        self.inner = self.inner.set_tags(input);
257        self
258    }
259    /// <p>Metadata that can be used to manage the job template.</p>
260    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
261        self.inner.get_tags()
262    }
263    /// <p>Allows you to create the criteria to retry a job.</p>
264    pub fn job_executions_retry_config(mut self, input: crate::types::JobExecutionsRetryConfig) -> Self {
265        self.inner = self.inner.job_executions_retry_config(input);
266        self
267    }
268    /// <p>Allows you to create the criteria to retry a job.</p>
269    pub fn set_job_executions_retry_config(mut self, input: ::std::option::Option<crate::types::JobExecutionsRetryConfig>) -> Self {
270        self.inner = self.inner.set_job_executions_retry_config(input);
271        self
272    }
273    /// <p>Allows you to create the criteria to retry a job.</p>
274    pub fn get_job_executions_retry_config(&self) -> &::std::option::Option<crate::types::JobExecutionsRetryConfig> {
275        self.inner.get_job_executions_retry_config()
276    }
277    ///
278    /// Appends an item to `maintenanceWindows`.
279    ///
280    /// To override the contents of this collection use [`set_maintenance_windows`](Self::set_maintenance_windows).
281    ///
282    /// <p>Allows you to configure an optional maintenance window for the rollout of a job document to all devices in the target group for a job.</p>
283    pub fn maintenance_windows(mut self, input: crate::types::MaintenanceWindow) -> Self {
284        self.inner = self.inner.maintenance_windows(input);
285        self
286    }
287    /// <p>Allows you to configure an optional maintenance window for the rollout of a job document to all devices in the target group for a job.</p>
288    pub fn set_maintenance_windows(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::MaintenanceWindow>>) -> Self {
289        self.inner = self.inner.set_maintenance_windows(input);
290        self
291    }
292    /// <p>Allows you to configure an optional maintenance window for the rollout of a job document to all devices in the target group for a job.</p>
293    pub fn get_maintenance_windows(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::MaintenanceWindow>> {
294        self.inner.get_maintenance_windows()
295    }
296    ///
297    /// Appends an item to `destinationPackageVersions`.
298    ///
299    /// To override the contents of this collection use [`set_destination_package_versions`](Self::set_destination_package_versions).
300    ///
301    /// <p>The package version Amazon Resource Names (ARNs) that are installed on the device when the job successfully completes. The package version must be in either the Published or Deprecated state when the job deploys. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/preparing-to-use-software-package-catalog.html#package-version-lifecycle">Package version lifecycle</a>.</p>
302    /// <p><b>Note:</b>The following Length Constraints relates to a single ARN. Up to 25 package version ARNs are allowed.</p>
303    pub fn destination_package_versions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
304        self.inner = self.inner.destination_package_versions(input.into());
305        self
306    }
307    /// <p>The package version Amazon Resource Names (ARNs) that are installed on the device when the job successfully completes. The package version must be in either the Published or Deprecated state when the job deploys. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/preparing-to-use-software-package-catalog.html#package-version-lifecycle">Package version lifecycle</a>.</p>
308    /// <p><b>Note:</b>The following Length Constraints relates to a single ARN. Up to 25 package version ARNs are allowed.</p>
309    pub fn set_destination_package_versions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
310        self.inner = self.inner.set_destination_package_versions(input);
311        self
312    }
313    /// <p>The package version Amazon Resource Names (ARNs) that are installed on the device when the job successfully completes. The package version must be in either the Published or Deprecated state when the job deploys. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/preparing-to-use-software-package-catalog.html#package-version-lifecycle">Package version lifecycle</a>.</p>
314    /// <p><b>Note:</b>The following Length Constraints relates to a single ARN. Up to 25 package version ARNs are allowed.</p>
315    pub fn get_destination_package_versions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
316        self.inner.get_destination_package_versions()
317    }
318}