aws_sdk_iot/operation/create_command/
_create_command_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 CreateCommandInput {
6    /// <p>A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.</p>
7    pub command_id: ::std::option::Option<::std::string::String>,
8    /// <p>The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.</p>
9    pub namespace: ::std::option::Option<crate::types::CommandNamespace>,
10    /// <p>The user-friendly name in the console for the command. This name doesn't have to be unique. You can update the user-friendly name after you define it.</p>
11    pub display_name: ::std::option::Option<::std::string::String>,
12    /// <p>A short text decription of the command.</p>
13    pub description: ::std::option::Option<::std::string::String>,
14    /// <p>The payload object for the static command.</p>
15    /// <p>You can upload a static payload file from your local storage that contains the instructions for the device to process. The payload file can use any format. To make sure that the device correctly interprets the payload, we recommend you to specify the payload content type.</p>
16    pub payload: ::std::option::Option<crate::types::CommandPayload>,
17    /// <p>The payload template for the dynamic command.</p><note>
18    /// <p>This parameter is required for dynamic commands where the command execution placeholders are supplied either from <code>mandatoryParameters</code> or when <code>StartCommandExecution</code> is invoked.</p>
19    /// </note>
20    pub payload_template: ::std::option::Option<::std::string::String>,
21    /// <p>Configuration that determines how <code>payloadTemplate</code> is processed to generate command execution payload.</p><note>
22    /// <p>This parameter is required for dynamic commands, along with <code>payloadTemplate</code>, and <code>mandatoryParameters</code>.</p>
23    /// </note>
24    pub preprocessor: ::std::option::Option<crate::types::CommandPreprocessor>,
25    /// <p>A list of parameters that are used by <code>StartCommandExecution</code> API for execution payload generation.</p>
26    pub mandatory_parameters: ::std::option::Option<::std::vec::Vec<crate::types::CommandParameter>>,
27    /// <p>The IAM role that you must provide when using the <code>AWS-IoT-FleetWise</code> namespace. The role grants IoT Device Management the permission to access IoT FleetWise resources for generating the payload for the command. This field is not supported when you use the <code>AWS-IoT</code> namespace.</p>
28    pub role_arn: ::std::option::Option<::std::string::String>,
29    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
30    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
31}
32impl CreateCommandInput {
33    /// <p>A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.</p>
34    pub fn command_id(&self) -> ::std::option::Option<&str> {
35        self.command_id.as_deref()
36    }
37    /// <p>The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.</p>
38    pub fn namespace(&self) -> ::std::option::Option<&crate::types::CommandNamespace> {
39        self.namespace.as_ref()
40    }
41    /// <p>The user-friendly name in the console for the command. This name doesn't have to be unique. You can update the user-friendly name after you define it.</p>
42    pub fn display_name(&self) -> ::std::option::Option<&str> {
43        self.display_name.as_deref()
44    }
45    /// <p>A short text decription of the command.</p>
46    pub fn description(&self) -> ::std::option::Option<&str> {
47        self.description.as_deref()
48    }
49    /// <p>The payload object for the static command.</p>
50    /// <p>You can upload a static payload file from your local storage that contains the instructions for the device to process. The payload file can use any format. To make sure that the device correctly interprets the payload, we recommend you to specify the payload content type.</p>
51    pub fn payload(&self) -> ::std::option::Option<&crate::types::CommandPayload> {
52        self.payload.as_ref()
53    }
54    /// <p>The payload template for the dynamic command.</p><note>
55    /// <p>This parameter is required for dynamic commands where the command execution placeholders are supplied either from <code>mandatoryParameters</code> or when <code>StartCommandExecution</code> is invoked.</p>
56    /// </note>
57    pub fn payload_template(&self) -> ::std::option::Option<&str> {
58        self.payload_template.as_deref()
59    }
60    /// <p>Configuration that determines how <code>payloadTemplate</code> is processed to generate command execution payload.</p><note>
61    /// <p>This parameter is required for dynamic commands, along with <code>payloadTemplate</code>, and <code>mandatoryParameters</code>.</p>
62    /// </note>
63    pub fn preprocessor(&self) -> ::std::option::Option<&crate::types::CommandPreprocessor> {
64        self.preprocessor.as_ref()
65    }
66    /// <p>A list of parameters that are used by <code>StartCommandExecution</code> API for execution payload generation.</p>
67    ///
68    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.mandatory_parameters.is_none()`.
69    pub fn mandatory_parameters(&self) -> &[crate::types::CommandParameter] {
70        self.mandatory_parameters.as_deref().unwrap_or_default()
71    }
72    /// <p>The IAM role that you must provide when using the <code>AWS-IoT-FleetWise</code> namespace. The role grants IoT Device Management the permission to access IoT FleetWise resources for generating the payload for the command. This field is not supported when you use the <code>AWS-IoT</code> namespace.</p>
73    pub fn role_arn(&self) -> ::std::option::Option<&str> {
74        self.role_arn.as_deref()
75    }
76    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
77    ///
78    /// 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()`.
79    pub fn tags(&self) -> &[crate::types::Tag] {
80        self.tags.as_deref().unwrap_or_default()
81    }
82}
83impl CreateCommandInput {
84    /// Creates a new builder-style object to manufacture [`CreateCommandInput`](crate::operation::create_command::CreateCommandInput).
85    pub fn builder() -> crate::operation::create_command::builders::CreateCommandInputBuilder {
86        crate::operation::create_command::builders::CreateCommandInputBuilder::default()
87    }
88}
89
90/// A builder for [`CreateCommandInput`](crate::operation::create_command::CreateCommandInput).
91#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
92#[non_exhaustive]
93pub struct CreateCommandInputBuilder {
94    pub(crate) command_id: ::std::option::Option<::std::string::String>,
95    pub(crate) namespace: ::std::option::Option<crate::types::CommandNamespace>,
96    pub(crate) display_name: ::std::option::Option<::std::string::String>,
97    pub(crate) description: ::std::option::Option<::std::string::String>,
98    pub(crate) payload: ::std::option::Option<crate::types::CommandPayload>,
99    pub(crate) payload_template: ::std::option::Option<::std::string::String>,
100    pub(crate) preprocessor: ::std::option::Option<crate::types::CommandPreprocessor>,
101    pub(crate) mandatory_parameters: ::std::option::Option<::std::vec::Vec<crate::types::CommandParameter>>,
102    pub(crate) role_arn: ::std::option::Option<::std::string::String>,
103    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
104}
105impl CreateCommandInputBuilder {
106    /// <p>A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.</p>
107    /// This field is required.
108    pub fn command_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
109        self.command_id = ::std::option::Option::Some(input.into());
110        self
111    }
112    /// <p>A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.</p>
113    pub fn set_command_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
114        self.command_id = input;
115        self
116    }
117    /// <p>A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.</p>
118    pub fn get_command_id(&self) -> &::std::option::Option<::std::string::String> {
119        &self.command_id
120    }
121    /// <p>The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.</p>
122    pub fn namespace(mut self, input: crate::types::CommandNamespace) -> Self {
123        self.namespace = ::std::option::Option::Some(input);
124        self
125    }
126    /// <p>The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.</p>
127    pub fn set_namespace(mut self, input: ::std::option::Option<crate::types::CommandNamespace>) -> Self {
128        self.namespace = input;
129        self
130    }
131    /// <p>The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.</p>
132    pub fn get_namespace(&self) -> &::std::option::Option<crate::types::CommandNamespace> {
133        &self.namespace
134    }
135    /// <p>The user-friendly name in the console for the command. This name doesn't have to be unique. You can update the user-friendly name after you define it.</p>
136    pub fn display_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.display_name = ::std::option::Option::Some(input.into());
138        self
139    }
140    /// <p>The user-friendly name in the console for the command. This name doesn't have to be unique. You can update the user-friendly name after you define it.</p>
141    pub fn set_display_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.display_name = input;
143        self
144    }
145    /// <p>The user-friendly name in the console for the command. This name doesn't have to be unique. You can update the user-friendly name after you define it.</p>
146    pub fn get_display_name(&self) -> &::std::option::Option<::std::string::String> {
147        &self.display_name
148    }
149    /// <p>A short text decription of the command.</p>
150    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151        self.description = ::std::option::Option::Some(input.into());
152        self
153    }
154    /// <p>A short text decription of the command.</p>
155    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
156        self.description = input;
157        self
158    }
159    /// <p>A short text decription of the command.</p>
160    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
161        &self.description
162    }
163    /// <p>The payload object for the static command.</p>
164    /// <p>You can upload a static payload file from your local storage that contains the instructions for the device to process. The payload file can use any format. To make sure that the device correctly interprets the payload, we recommend you to specify the payload content type.</p>
165    pub fn payload(mut self, input: crate::types::CommandPayload) -> Self {
166        self.payload = ::std::option::Option::Some(input);
167        self
168    }
169    /// <p>The payload object for the static command.</p>
170    /// <p>You can upload a static payload file from your local storage that contains the instructions for the device to process. The payload file can use any format. To make sure that the device correctly interprets the payload, we recommend you to specify the payload content type.</p>
171    pub fn set_payload(mut self, input: ::std::option::Option<crate::types::CommandPayload>) -> Self {
172        self.payload = input;
173        self
174    }
175    /// <p>The payload object for the static command.</p>
176    /// <p>You can upload a static payload file from your local storage that contains the instructions for the device to process. The payload file can use any format. To make sure that the device correctly interprets the payload, we recommend you to specify the payload content type.</p>
177    pub fn get_payload(&self) -> &::std::option::Option<crate::types::CommandPayload> {
178        &self.payload
179    }
180    /// <p>The payload template for the dynamic command.</p><note>
181    /// <p>This parameter is required for dynamic commands where the command execution placeholders are supplied either from <code>mandatoryParameters</code> or when <code>StartCommandExecution</code> is invoked.</p>
182    /// </note>
183    pub fn payload_template(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184        self.payload_template = ::std::option::Option::Some(input.into());
185        self
186    }
187    /// <p>The payload template for the dynamic command.</p><note>
188    /// <p>This parameter is required for dynamic commands where the command execution placeholders are supplied either from <code>mandatoryParameters</code> or when <code>StartCommandExecution</code> is invoked.</p>
189    /// </note>
190    pub fn set_payload_template(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
191        self.payload_template = input;
192        self
193    }
194    /// <p>The payload template for the dynamic command.</p><note>
195    /// <p>This parameter is required for dynamic commands where the command execution placeholders are supplied either from <code>mandatoryParameters</code> or when <code>StartCommandExecution</code> is invoked.</p>
196    /// </note>
197    pub fn get_payload_template(&self) -> &::std::option::Option<::std::string::String> {
198        &self.payload_template
199    }
200    /// <p>Configuration that determines how <code>payloadTemplate</code> is processed to generate command execution payload.</p><note>
201    /// <p>This parameter is required for dynamic commands, along with <code>payloadTemplate</code>, and <code>mandatoryParameters</code>.</p>
202    /// </note>
203    pub fn preprocessor(mut self, input: crate::types::CommandPreprocessor) -> Self {
204        self.preprocessor = ::std::option::Option::Some(input);
205        self
206    }
207    /// <p>Configuration that determines how <code>payloadTemplate</code> is processed to generate command execution payload.</p><note>
208    /// <p>This parameter is required for dynamic commands, along with <code>payloadTemplate</code>, and <code>mandatoryParameters</code>.</p>
209    /// </note>
210    pub fn set_preprocessor(mut self, input: ::std::option::Option<crate::types::CommandPreprocessor>) -> Self {
211        self.preprocessor = input;
212        self
213    }
214    /// <p>Configuration that determines how <code>payloadTemplate</code> is processed to generate command execution payload.</p><note>
215    /// <p>This parameter is required for dynamic commands, along with <code>payloadTemplate</code>, and <code>mandatoryParameters</code>.</p>
216    /// </note>
217    pub fn get_preprocessor(&self) -> &::std::option::Option<crate::types::CommandPreprocessor> {
218        &self.preprocessor
219    }
220    /// Appends an item to `mandatory_parameters`.
221    ///
222    /// To override the contents of this collection use [`set_mandatory_parameters`](Self::set_mandatory_parameters).
223    ///
224    /// <p>A list of parameters that are used by <code>StartCommandExecution</code> API for execution payload generation.</p>
225    pub fn mandatory_parameters(mut self, input: crate::types::CommandParameter) -> Self {
226        let mut v = self.mandatory_parameters.unwrap_or_default();
227        v.push(input);
228        self.mandatory_parameters = ::std::option::Option::Some(v);
229        self
230    }
231    /// <p>A list of parameters that are used by <code>StartCommandExecution</code> API for execution payload generation.</p>
232    pub fn set_mandatory_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CommandParameter>>) -> Self {
233        self.mandatory_parameters = input;
234        self
235    }
236    /// <p>A list of parameters that are used by <code>StartCommandExecution</code> API for execution payload generation.</p>
237    pub fn get_mandatory_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CommandParameter>> {
238        &self.mandatory_parameters
239    }
240    /// <p>The IAM role that you must provide when using the <code>AWS-IoT-FleetWise</code> namespace. The role grants IoT Device Management the permission to access IoT FleetWise resources for generating the payload for the command. This field is not supported when you use the <code>AWS-IoT</code> namespace.</p>
241    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
242        self.role_arn = ::std::option::Option::Some(input.into());
243        self
244    }
245    /// <p>The IAM role that you must provide when using the <code>AWS-IoT-FleetWise</code> namespace. The role grants IoT Device Management the permission to access IoT FleetWise resources for generating the payload for the command. This field is not supported when you use the <code>AWS-IoT</code> namespace.</p>
246    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
247        self.role_arn = input;
248        self
249    }
250    /// <p>The IAM role that you must provide when using the <code>AWS-IoT-FleetWise</code> namespace. The role grants IoT Device Management the permission to access IoT FleetWise resources for generating the payload for the command. This field is not supported when you use the <code>AWS-IoT</code> namespace.</p>
251    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
252        &self.role_arn
253    }
254    /// Appends an item to `tags`.
255    ///
256    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
257    ///
258    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
259    pub fn tags(mut self, input: crate::types::Tag) -> Self {
260        let mut v = self.tags.unwrap_or_default();
261        v.push(input);
262        self.tags = ::std::option::Option::Some(v);
263        self
264    }
265    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
266    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
267        self.tags = input;
268        self
269    }
270    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
271    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
272        &self.tags
273    }
274    /// Consumes the builder and constructs a [`CreateCommandInput`](crate::operation::create_command::CreateCommandInput).
275    pub fn build(
276        self,
277    ) -> ::std::result::Result<crate::operation::create_command::CreateCommandInput, ::aws_smithy_types::error::operation::BuildError> {
278        ::std::result::Result::Ok(crate::operation::create_command::CreateCommandInput {
279            command_id: self.command_id,
280            namespace: self.namespace,
281            display_name: self.display_name,
282            description: self.description,
283            payload: self.payload,
284            payload_template: self.payload_template,
285            preprocessor: self.preprocessor,
286            mandatory_parameters: self.mandatory_parameters,
287            role_arn: self.role_arn,
288            tags: self.tags,
289        })
290    }
291}