Skip to main content

aws_sdk_iot/operation/create_ota_update/
_create_ota_update_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateOtaUpdateInput {
6    /// <p>The ID of the OTA update to be created.</p>
7    pub ota_update_id: ::std::option::Option<::std::string::String>,
8    /// <p>The description of the OTA update.</p>
9    pub description: ::std::option::Option<::std::string::String>,
10    /// <p>The devices targeted to receive OTA updates.</p>
11    pub targets: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
12    /// <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>
13    pub protocols: ::std::option::Option<::std::vec::Vec<crate::types::Protocol>>,
14    /// <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>
15    pub target_selection: ::std::option::Option<crate::types::TargetSelection>,
16    /// <p>Configuration for the rollout of OTA updates.</p>
17    pub aws_job_executions_rollout_config: ::std::option::Option<crate::types::AwsJobExecutionsRolloutConfig>,
18    /// <p>Configuration information for pre-signed URLs.</p>
19    pub aws_job_presigned_url_config: ::std::option::Option<crate::types::AwsJobPresignedUrlConfig>,
20    /// <p>The criteria that determine when and how a job abort takes place.</p>
21    pub aws_job_abort_config: ::std::option::Option<crate::types::AwsJobAbortConfig>,
22    /// <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>
23    pub aws_job_timeout_config: ::std::option::Option<crate::types::AwsJobTimeoutConfig>,
24    /// <p>The files to be streamed by the OTA update.</p>
25    pub files: ::std::option::Option<::std::vec::Vec<crate::types::OtaUpdateFile>>,
26    /// <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>
27    pub role_arn: ::std::option::Option<::std::string::String>,
28    /// <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>
29    pub additional_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
30    /// <p>Metadata which can be used to manage updates.</p>
31    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
32}
33impl CreateOtaUpdateInput {
34    /// <p>The ID of the OTA update to be created.</p>
35    pub fn ota_update_id(&self) -> ::std::option::Option<&str> {
36        self.ota_update_id.as_deref()
37    }
38    /// <p>The description of the OTA update.</p>
39    pub fn description(&self) -> ::std::option::Option<&str> {
40        self.description.as_deref()
41    }
42    /// <p>The devices targeted to receive OTA updates.</p>
43    ///
44    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.targets.is_none()`.
45    pub fn targets(&self) -> &[::std::string::String] {
46        self.targets.as_deref().unwrap_or_default()
47    }
48    /// <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>
49    ///
50    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.protocols.is_none()`.
51    pub fn protocols(&self) -> &[crate::types::Protocol] {
52        self.protocols.as_deref().unwrap_or_default()
53    }
54    /// <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>
55    pub fn target_selection(&self) -> ::std::option::Option<&crate::types::TargetSelection> {
56        self.target_selection.as_ref()
57    }
58    /// <p>Configuration for the rollout of OTA updates.</p>
59    pub fn aws_job_executions_rollout_config(&self) -> ::std::option::Option<&crate::types::AwsJobExecutionsRolloutConfig> {
60        self.aws_job_executions_rollout_config.as_ref()
61    }
62    /// <p>Configuration information for pre-signed URLs.</p>
63    pub fn aws_job_presigned_url_config(&self) -> ::std::option::Option<&crate::types::AwsJobPresignedUrlConfig> {
64        self.aws_job_presigned_url_config.as_ref()
65    }
66    /// <p>The criteria that determine when and how a job abort takes place.</p>
67    pub fn aws_job_abort_config(&self) -> ::std::option::Option<&crate::types::AwsJobAbortConfig> {
68        self.aws_job_abort_config.as_ref()
69    }
70    /// <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>
71    pub fn aws_job_timeout_config(&self) -> ::std::option::Option<&crate::types::AwsJobTimeoutConfig> {
72        self.aws_job_timeout_config.as_ref()
73    }
74    /// <p>The files to be streamed by the OTA update.</p>
75    ///
76    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.files.is_none()`.
77    pub fn files(&self) -> &[crate::types::OtaUpdateFile] {
78        self.files.as_deref().unwrap_or_default()
79    }
80    /// <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>
81    pub fn role_arn(&self) -> ::std::option::Option<&str> {
82        self.role_arn.as_deref()
83    }
84    /// <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>
85    pub fn additional_parameters(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
86        self.additional_parameters.as_ref()
87    }
88    /// <p>Metadata which can be used to manage updates.</p>
89    ///
90    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
91    pub fn tags(&self) -> &[crate::types::Tag] {
92        self.tags.as_deref().unwrap_or_default()
93    }
94}
95impl CreateOtaUpdateInput {
96    /// Creates a new builder-style object to manufacture [`CreateOtaUpdateInput`](crate::operation::create_ota_update::CreateOtaUpdateInput).
97    pub fn builder() -> crate::operation::create_ota_update::builders::CreateOtaUpdateInputBuilder {
98        crate::operation::create_ota_update::builders::CreateOtaUpdateInputBuilder::default()
99    }
100}
101
102/// A builder for [`CreateOtaUpdateInput`](crate::operation::create_ota_update::CreateOtaUpdateInput).
103#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
104#[non_exhaustive]
105pub struct CreateOtaUpdateInputBuilder {
106    pub(crate) ota_update_id: ::std::option::Option<::std::string::String>,
107    pub(crate) description: ::std::option::Option<::std::string::String>,
108    pub(crate) targets: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
109    pub(crate) protocols: ::std::option::Option<::std::vec::Vec<crate::types::Protocol>>,
110    pub(crate) target_selection: ::std::option::Option<crate::types::TargetSelection>,
111    pub(crate) aws_job_executions_rollout_config: ::std::option::Option<crate::types::AwsJobExecutionsRolloutConfig>,
112    pub(crate) aws_job_presigned_url_config: ::std::option::Option<crate::types::AwsJobPresignedUrlConfig>,
113    pub(crate) aws_job_abort_config: ::std::option::Option<crate::types::AwsJobAbortConfig>,
114    pub(crate) aws_job_timeout_config: ::std::option::Option<crate::types::AwsJobTimeoutConfig>,
115    pub(crate) files: ::std::option::Option<::std::vec::Vec<crate::types::OtaUpdateFile>>,
116    pub(crate) role_arn: ::std::option::Option<::std::string::String>,
117    pub(crate) additional_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
118    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
119}
120impl CreateOtaUpdateInputBuilder {
121    /// <p>The ID of the OTA update to be created.</p>
122    /// This field is required.
123    pub fn ota_update_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.ota_update_id = ::std::option::Option::Some(input.into());
125        self
126    }
127    /// <p>The ID of the OTA update to be created.</p>
128    pub fn set_ota_update_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129        self.ota_update_id = input;
130        self
131    }
132    /// <p>The ID of the OTA update to be created.</p>
133    pub fn get_ota_update_id(&self) -> &::std::option::Option<::std::string::String> {
134        &self.ota_update_id
135    }
136    /// <p>The description of the OTA update.</p>
137    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.description = ::std::option::Option::Some(input.into());
139        self
140    }
141    /// <p>The description of the OTA update.</p>
142    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.description = input;
144        self
145    }
146    /// <p>The description of the OTA update.</p>
147    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
148        &self.description
149    }
150    /// Appends an item to `targets`.
151    ///
152    /// To override the contents of this collection use [`set_targets`](Self::set_targets).
153    ///
154    /// <p>The devices targeted to receive OTA updates.</p>
155    pub fn targets(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        let mut v = self.targets.unwrap_or_default();
157        v.push(input.into());
158        self.targets = ::std::option::Option::Some(v);
159        self
160    }
161    /// <p>The devices targeted to receive OTA updates.</p>
162    pub fn set_targets(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
163        self.targets = input;
164        self
165    }
166    /// <p>The devices targeted to receive OTA updates.</p>
167    pub fn get_targets(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
168        &self.targets
169    }
170    /// Appends an item to `protocols`.
171    ///
172    /// To override the contents of this collection use [`set_protocols`](Self::set_protocols).
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 protocols(mut self, input: crate::types::Protocol) -> Self {
176        let mut v = self.protocols.unwrap_or_default();
177        v.push(input);
178        self.protocols = ::std::option::Option::Some(v);
179        self
180    }
181    /// <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>
182    pub fn set_protocols(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Protocol>>) -> Self {
183        self.protocols = input;
184        self
185    }
186    /// <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>
187    pub fn get_protocols(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Protocol>> {
188        &self.protocols
189    }
190    /// <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>
191    pub fn target_selection(mut self, input: crate::types::TargetSelection) -> Self {
192        self.target_selection = ::std::option::Option::Some(input);
193        self
194    }
195    /// <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>
196    pub fn set_target_selection(mut self, input: ::std::option::Option<crate::types::TargetSelection>) -> Self {
197        self.target_selection = input;
198        self
199    }
200    /// <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>
201    pub fn get_target_selection(&self) -> &::std::option::Option<crate::types::TargetSelection> {
202        &self.target_selection
203    }
204    /// <p>Configuration for the rollout of OTA updates.</p>
205    pub fn aws_job_executions_rollout_config(mut self, input: crate::types::AwsJobExecutionsRolloutConfig) -> Self {
206        self.aws_job_executions_rollout_config = ::std::option::Option::Some(input);
207        self
208    }
209    /// <p>Configuration for the rollout of OTA updates.</p>
210    pub fn set_aws_job_executions_rollout_config(mut self, input: ::std::option::Option<crate::types::AwsJobExecutionsRolloutConfig>) -> Self {
211        self.aws_job_executions_rollout_config = input;
212        self
213    }
214    /// <p>Configuration for the rollout of OTA updates.</p>
215    pub fn get_aws_job_executions_rollout_config(&self) -> &::std::option::Option<crate::types::AwsJobExecutionsRolloutConfig> {
216        &self.aws_job_executions_rollout_config
217    }
218    /// <p>Configuration information for pre-signed URLs.</p>
219    pub fn aws_job_presigned_url_config(mut self, input: crate::types::AwsJobPresignedUrlConfig) -> Self {
220        self.aws_job_presigned_url_config = ::std::option::Option::Some(input);
221        self
222    }
223    /// <p>Configuration information for pre-signed URLs.</p>
224    pub fn set_aws_job_presigned_url_config(mut self, input: ::std::option::Option<crate::types::AwsJobPresignedUrlConfig>) -> Self {
225        self.aws_job_presigned_url_config = input;
226        self
227    }
228    /// <p>Configuration information for pre-signed URLs.</p>
229    pub fn get_aws_job_presigned_url_config(&self) -> &::std::option::Option<crate::types::AwsJobPresignedUrlConfig> {
230        &self.aws_job_presigned_url_config
231    }
232    /// <p>The criteria that determine when and how a job abort takes place.</p>
233    pub fn aws_job_abort_config(mut self, input: crate::types::AwsJobAbortConfig) -> Self {
234        self.aws_job_abort_config = ::std::option::Option::Some(input);
235        self
236    }
237    /// <p>The criteria that determine when and how a job abort takes place.</p>
238    pub fn set_aws_job_abort_config(mut self, input: ::std::option::Option<crate::types::AwsJobAbortConfig>) -> Self {
239        self.aws_job_abort_config = input;
240        self
241    }
242    /// <p>The criteria that determine when and how a job abort takes place.</p>
243    pub fn get_aws_job_abort_config(&self) -> &::std::option::Option<crate::types::AwsJobAbortConfig> {
244        &self.aws_job_abort_config
245    }
246    /// <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>
247    pub fn aws_job_timeout_config(mut self, input: crate::types::AwsJobTimeoutConfig) -> Self {
248        self.aws_job_timeout_config = ::std::option::Option::Some(input);
249        self
250    }
251    /// <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>
252    pub fn set_aws_job_timeout_config(mut self, input: ::std::option::Option<crate::types::AwsJobTimeoutConfig>) -> Self {
253        self.aws_job_timeout_config = input;
254        self
255    }
256    /// <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>
257    pub fn get_aws_job_timeout_config(&self) -> &::std::option::Option<crate::types::AwsJobTimeoutConfig> {
258        &self.aws_job_timeout_config
259    }
260    /// Appends an item to `files`.
261    ///
262    /// To override the contents of this collection use [`set_files`](Self::set_files).
263    ///
264    /// <p>The files to be streamed by the OTA update.</p>
265    pub fn files(mut self, input: crate::types::OtaUpdateFile) -> Self {
266        let mut v = self.files.unwrap_or_default();
267        v.push(input);
268        self.files = ::std::option::Option::Some(v);
269        self
270    }
271    /// <p>The files to be streamed by the OTA update.</p>
272    pub fn set_files(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::OtaUpdateFile>>) -> Self {
273        self.files = input;
274        self
275    }
276    /// <p>The files to be streamed by the OTA update.</p>
277    pub fn get_files(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::OtaUpdateFile>> {
278        &self.files
279    }
280    /// <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>
281    /// This field is required.
282    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
283        self.role_arn = ::std::option::Option::Some(input.into());
284        self
285    }
286    /// <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>
287    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
288        self.role_arn = input;
289        self
290    }
291    /// <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>
292    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
293        &self.role_arn
294    }
295    /// Adds a key-value pair to `additional_parameters`.
296    ///
297    /// To override the contents of this collection use [`set_additional_parameters`](Self::set_additional_parameters).
298    ///
299    /// <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>
300    pub fn additional_parameters(
301        mut self,
302        k: impl ::std::convert::Into<::std::string::String>,
303        v: impl ::std::convert::Into<::std::string::String>,
304    ) -> Self {
305        let mut hash_map = self.additional_parameters.unwrap_or_default();
306        hash_map.insert(k.into(), v.into());
307        self.additional_parameters = ::std::option::Option::Some(hash_map);
308        self
309    }
310    /// <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>
311    pub fn set_additional_parameters(
312        mut self,
313        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
314    ) -> Self {
315        self.additional_parameters = input;
316        self
317    }
318    /// <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>
319    pub fn get_additional_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
320        &self.additional_parameters
321    }
322    /// Appends an item to `tags`.
323    ///
324    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
325    ///
326    /// <p>Metadata which can be used to manage updates.</p>
327    pub fn tags(mut self, input: crate::types::Tag) -> Self {
328        let mut v = self.tags.unwrap_or_default();
329        v.push(input);
330        self.tags = ::std::option::Option::Some(v);
331        self
332    }
333    /// <p>Metadata which can be used to manage updates.</p>
334    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
335        self.tags = input;
336        self
337    }
338    /// <p>Metadata which can be used to manage updates.</p>
339    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
340        &self.tags
341    }
342    /// Consumes the builder and constructs a [`CreateOtaUpdateInput`](crate::operation::create_ota_update::CreateOtaUpdateInput).
343    pub fn build(
344        self,
345    ) -> ::std::result::Result<crate::operation::create_ota_update::CreateOtaUpdateInput, ::aws_smithy_types::error::operation::BuildError> {
346        ::std::result::Result::Ok(crate::operation::create_ota_update::CreateOtaUpdateInput {
347            ota_update_id: self.ota_update_id,
348            description: self.description,
349            targets: self.targets,
350            protocols: self.protocols,
351            target_selection: self.target_selection,
352            aws_job_executions_rollout_config: self.aws_job_executions_rollout_config,
353            aws_job_presigned_url_config: self.aws_job_presigned_url_config,
354            aws_job_abort_config: self.aws_job_abort_config,
355            aws_job_timeout_config: self.aws_job_timeout_config,
356            files: self.files,
357            role_arn: self.role_arn,
358            additional_parameters: self.additional_parameters,
359            tags: self.tags,
360        })
361    }
362}