aws_sdk_iot/operation/create_ota_update/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_ota_update::_create_ota_update_output::CreateOtaUpdateOutputBuilder;
3
4pub use crate::operation::create_ota_update::_create_ota_update_input::CreateOtaUpdateInputBuilder;
5
6impl crate::operation::create_ota_update::builders::CreateOtaUpdateInputBuilder {
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_ota_update::CreateOtaUpdateOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_ota_update::CreateOTAUpdateError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_ota_update();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateOTAUpdate`.
24///
25/// <p>Creates an IoT OTA update on a target group of things or groups.</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">CreateOTAUpdate</a> action.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateOTAUpdateFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_ota_update::builders::CreateOtaUpdateInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::create_ota_update::CreateOtaUpdateOutput,
36        crate::operation::create_ota_update::CreateOTAUpdateError,
37    > for CreateOTAUpdateFluentBuilder
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_ota_update::CreateOtaUpdateOutput,
45            crate::operation::create_ota_update::CreateOTAUpdateError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl CreateOTAUpdateFluentBuilder {
52    /// Creates a new `CreateOTAUpdateFluentBuilder`.
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 CreateOTAUpdate as a reference.
61    pub fn as_input(&self) -> &crate::operation::create_ota_update::builders::CreateOtaUpdateInputBuilder {
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_ota_update::CreateOtaUpdateOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::create_ota_update::CreateOTAUpdateError,
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_ota_update::CreateOTAUpdate::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::create_ota_update::CreateOTAUpdate::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_ota_update::CreateOtaUpdateOutput,
98        crate::operation::create_ota_update::CreateOTAUpdateError,
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 ID of the OTA update to be created.</p>
113    pub fn ota_update_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.ota_update_id(input.into());
115        self
116    }
117    /// <p>The ID of the OTA update to be created.</p>
118    pub fn set_ota_update_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_ota_update_id(input);
120        self
121    }
122    /// <p>The ID of the OTA update to be created.</p>
123    pub fn get_ota_update_id(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_ota_update_id()
125    }
126    /// <p>The description of the OTA update.</p>
127    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.description(input.into());
129        self
130    }
131    /// <p>The description of the OTA update.</p>
132    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_description(input);
134        self
135    }
136    /// <p>The description of the OTA update.</p>
137    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_description()
139    }
140    ///
141    /// Appends an item to `targets`.
142    ///
143    /// To override the contents of this collection use [`set_targets`](Self::set_targets).
144    ///
145    /// <p>The devices targeted to receive OTA updates.</p>
146    pub fn targets(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.targets(input.into());
148        self
149    }
150    /// <p>The devices targeted to receive OTA updates.</p>
151    pub fn set_targets(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
152        self.inner = self.inner.set_targets(input);
153        self
154    }
155    /// <p>The devices targeted to receive OTA updates.</p>
156    pub fn get_targets(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
157        self.inner.get_targets()
158    }
159    ///
160    /// Appends an item to `protocols`.
161    ///
162    /// To override the contents of this collection use [`set_protocols`](Self::set_protocols).
163    ///
164    /// <p>The protocol used to transfer the OTA update image. Valid values are \[HTTP\], \[MQTT\], \[HTTP, MQTT\]. When both HTTP and MQTT are specified, the target device can choose the protocol.</p>
165    pub fn protocols(mut self, input: crate::types::Protocol) -> Self {
166        self.inner = self.inner.protocols(input);
167        self
168    }
169    /// <p>The protocol used to transfer the OTA update image. Valid values are \[HTTP\], \[MQTT\], \[HTTP, MQTT\]. When both HTTP and MQTT are specified, the target device can choose the protocol.</p>
170    pub fn set_protocols(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Protocol>>) -> Self {
171        self.inner = self.inner.set_protocols(input);
172        self
173    }
174    /// <p>The protocol used to transfer the OTA update image. Valid values are \[HTTP\], \[MQTT\], \[HTTP, MQTT\]. When both HTTP and MQTT are specified, the target device can choose the protocol.</p>
175    pub fn get_protocols(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Protocol>> {
176        self.inner.get_protocols()
177    }
178    /// <p>Specifies whether the update will continue to run (CONTINUOUS), or will be complete after all the things specified as targets have completed the update (SNAPSHOT). If continuous, the update may also be run on a thing when a change is detected in a target. For example, an update will run on a thing when the thing is added to a target group, even after the update was completed by all things originally in the group. Valid values: CONTINUOUS | SNAPSHOT.</p>
179    pub fn target_selection(mut self, input: crate::types::TargetSelection) -> Self {
180        self.inner = self.inner.target_selection(input);
181        self
182    }
183    /// <p>Specifies whether the update will continue to run (CONTINUOUS), or will be complete after all the things specified as targets have completed the update (SNAPSHOT). If continuous, the update may also be run on a thing when a change is detected in a target. For example, an update will run on a thing when the thing is added to a target group, even after the update was completed by all things originally in the group. Valid values: CONTINUOUS | SNAPSHOT.</p>
184    pub fn set_target_selection(mut self, input: ::std::option::Option<crate::types::TargetSelection>) -> Self {
185        self.inner = self.inner.set_target_selection(input);
186        self
187    }
188    /// <p>Specifies whether the update will continue to run (CONTINUOUS), or will be complete after all the things specified as targets have completed the update (SNAPSHOT). If continuous, the update may also be run on a thing when a change is detected in a target. For example, an update will run on a thing when the thing is added to a target group, even after the update was completed by all things originally in the group. Valid values: CONTINUOUS | SNAPSHOT.</p>
189    pub fn get_target_selection(&self) -> &::std::option::Option<crate::types::TargetSelection> {
190        self.inner.get_target_selection()
191    }
192    /// <p>Configuration for the rollout of OTA updates.</p>
193    pub fn aws_job_executions_rollout_config(mut self, input: crate::types::AwsJobExecutionsRolloutConfig) -> Self {
194        self.inner = self.inner.aws_job_executions_rollout_config(input);
195        self
196    }
197    /// <p>Configuration for the rollout of OTA updates.</p>
198    pub fn set_aws_job_executions_rollout_config(mut self, input: ::std::option::Option<crate::types::AwsJobExecutionsRolloutConfig>) -> Self {
199        self.inner = self.inner.set_aws_job_executions_rollout_config(input);
200        self
201    }
202    /// <p>Configuration for the rollout of OTA updates.</p>
203    pub fn get_aws_job_executions_rollout_config(&self) -> &::std::option::Option<crate::types::AwsJobExecutionsRolloutConfig> {
204        self.inner.get_aws_job_executions_rollout_config()
205    }
206    /// <p>Configuration information for pre-signed URLs.</p>
207    pub fn aws_job_presigned_url_config(mut self, input: crate::types::AwsJobPresignedUrlConfig) -> Self {
208        self.inner = self.inner.aws_job_presigned_url_config(input);
209        self
210    }
211    /// <p>Configuration information for pre-signed URLs.</p>
212    pub fn set_aws_job_presigned_url_config(mut self, input: ::std::option::Option<crate::types::AwsJobPresignedUrlConfig>) -> Self {
213        self.inner = self.inner.set_aws_job_presigned_url_config(input);
214        self
215    }
216    /// <p>Configuration information for pre-signed URLs.</p>
217    pub fn get_aws_job_presigned_url_config(&self) -> &::std::option::Option<crate::types::AwsJobPresignedUrlConfig> {
218        self.inner.get_aws_job_presigned_url_config()
219    }
220    /// <p>The criteria that determine when and how a job abort takes place.</p>
221    pub fn aws_job_abort_config(mut self, input: crate::types::AwsJobAbortConfig) -> Self {
222        self.inner = self.inner.aws_job_abort_config(input);
223        self
224    }
225    /// <p>The criteria that determine when and how a job abort takes place.</p>
226    pub fn set_aws_job_abort_config(mut self, input: ::std::option::Option<crate::types::AwsJobAbortConfig>) -> Self {
227        self.inner = self.inner.set_aws_job_abort_config(input);
228        self
229    }
230    /// <p>The criteria that determine when and how a job abort takes place.</p>
231    pub fn get_aws_job_abort_config(&self) -> &::std::option::Option<crate::types::AwsJobAbortConfig> {
232        self.inner.get_aws_job_abort_config()
233    }
234    /// <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>
235    pub fn aws_job_timeout_config(mut self, input: crate::types::AwsJobTimeoutConfig) -> Self {
236        self.inner = self.inner.aws_job_timeout_config(input);
237        self
238    }
239    /// <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>
240    pub fn set_aws_job_timeout_config(mut self, input: ::std::option::Option<crate::types::AwsJobTimeoutConfig>) -> Self {
241        self.inner = self.inner.set_aws_job_timeout_config(input);
242        self
243    }
244    /// <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>
245    pub fn get_aws_job_timeout_config(&self) -> &::std::option::Option<crate::types::AwsJobTimeoutConfig> {
246        self.inner.get_aws_job_timeout_config()
247    }
248    ///
249    /// Appends an item to `files`.
250    ///
251    /// To override the contents of this collection use [`set_files`](Self::set_files).
252    ///
253    /// <p>The files to be streamed by the OTA update.</p>
254    pub fn files(mut self, input: crate::types::OtaUpdateFile) -> Self {
255        self.inner = self.inner.files(input);
256        self
257    }
258    /// <p>The files to be streamed by the OTA update.</p>
259    pub fn set_files(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::OtaUpdateFile>>) -> Self {
260        self.inner = self.inner.set_files(input);
261        self
262    }
263    /// <p>The files to be streamed by the OTA update.</p>
264    pub fn get_files(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::OtaUpdateFile>> {
265        self.inner.get_files()
266    }
267    /// <p>The IAM role that grants Amazon Web Services IoT Core access to the Amazon S3, IoT jobs and Amazon Web Services Code Signing resources to create an OTA update job.</p>
268    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
269        self.inner = self.inner.role_arn(input.into());
270        self
271    }
272    /// <p>The IAM role that grants Amazon Web Services IoT Core access to the Amazon S3, IoT jobs and Amazon Web Services Code Signing resources to create an OTA update job.</p>
273    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
274        self.inner = self.inner.set_role_arn(input);
275        self
276    }
277    /// <p>The IAM role that grants Amazon Web Services IoT Core access to the Amazon S3, IoT jobs and Amazon Web Services Code Signing resources to create an OTA update job.</p>
278    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
279        self.inner.get_role_arn()
280    }
281    ///
282    /// Adds a key-value pair to `additionalParameters`.
283    ///
284    /// To override the contents of this collection use [`set_additional_parameters`](Self::set_additional_parameters).
285    ///
286    /// <p>A list of additional OTA update parameters, which are name-value pairs. They won't be sent to devices as a part of the Job document.</p>
287    pub fn additional_parameters(
288        mut self,
289        k: impl ::std::convert::Into<::std::string::String>,
290        v: impl ::std::convert::Into<::std::string::String>,
291    ) -> Self {
292        self.inner = self.inner.additional_parameters(k.into(), v.into());
293        self
294    }
295    /// <p>A list of additional OTA update parameters, which are name-value pairs. They won't be sent to devices as a part of the Job document.</p>
296    pub fn set_additional_parameters(
297        mut self,
298        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
299    ) -> Self {
300        self.inner = self.inner.set_additional_parameters(input);
301        self
302    }
303    /// <p>A list of additional OTA update parameters, which are name-value pairs. They won't be sent to devices as a part of the Job document.</p>
304    pub fn get_additional_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
305        self.inner.get_additional_parameters()
306    }
307    ///
308    /// Appends an item to `tags`.
309    ///
310    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
311    ///
312    /// <p>Metadata which can be used to manage updates.</p>
313    pub fn tags(mut self, input: crate::types::Tag) -> Self {
314        self.inner = self.inner.tags(input);
315        self
316    }
317    /// <p>Metadata which can be used to manage updates.</p>
318    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
319        self.inner = self.inner.set_tags(input);
320        self
321    }
322    /// <p>Metadata which can be used to manage updates.</p>
323    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
324        self.inner.get_tags()
325    }
326}