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 command. You must specify this information when using the <code>AWS-IoT</code> namespace.</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>A list of parameters that are required by the <code>StartCommandExecution</code> API. These parameters need to be specified only when using the <code>AWS-IoT-FleetWise</code> namespace. You can either specify them here or when running the command using the <code>StartCommandExecution</code> API.</p>
18    pub mandatory_parameters: ::std::option::Option<::std::vec::Vec<crate::types::CommandParameter>>,
19    /// <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 required when you use the <code>AWS-IoT</code> namespace.</p>
20    pub role_arn: ::std::option::Option<::std::string::String>,
21    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
22    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
23}
24impl CreateCommandInput {
25    /// <p>A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.</p>
26    pub fn command_id(&self) -> ::std::option::Option<&str> {
27        self.command_id.as_deref()
28    }
29    /// <p>The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.</p>
30    pub fn namespace(&self) -> ::std::option::Option<&crate::types::CommandNamespace> {
31        self.namespace.as_ref()
32    }
33    /// <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>
34    pub fn display_name(&self) -> ::std::option::Option<&str> {
35        self.display_name.as_deref()
36    }
37    /// <p>A short text decription of the command.</p>
38    pub fn description(&self) -> ::std::option::Option<&str> {
39        self.description.as_deref()
40    }
41    /// <p>The payload object for the command. You must specify this information when using the <code>AWS-IoT</code> namespace.</p>
42    /// <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>
43    pub fn payload(&self) -> ::std::option::Option<&crate::types::CommandPayload> {
44        self.payload.as_ref()
45    }
46    /// <p>A list of parameters that are required by the <code>StartCommandExecution</code> API. These parameters need to be specified only when using the <code>AWS-IoT-FleetWise</code> namespace. You can either specify them here or when running the command using the <code>StartCommandExecution</code> API.</p>
47    ///
48    /// 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()`.
49    pub fn mandatory_parameters(&self) -> &[crate::types::CommandParameter] {
50        self.mandatory_parameters.as_deref().unwrap_or_default()
51    }
52    /// <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 required when you use the <code>AWS-IoT</code> namespace.</p>
53    pub fn role_arn(&self) -> ::std::option::Option<&str> {
54        self.role_arn.as_deref()
55    }
56    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
57    ///
58    /// 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()`.
59    pub fn tags(&self) -> &[crate::types::Tag] {
60        self.tags.as_deref().unwrap_or_default()
61    }
62}
63impl CreateCommandInput {
64    /// Creates a new builder-style object to manufacture [`CreateCommandInput`](crate::operation::create_command::CreateCommandInput).
65    pub fn builder() -> crate::operation::create_command::builders::CreateCommandInputBuilder {
66        crate::operation::create_command::builders::CreateCommandInputBuilder::default()
67    }
68}
69
70/// A builder for [`CreateCommandInput`](crate::operation::create_command::CreateCommandInput).
71#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
72#[non_exhaustive]
73pub struct CreateCommandInputBuilder {
74    pub(crate) command_id: ::std::option::Option<::std::string::String>,
75    pub(crate) namespace: ::std::option::Option<crate::types::CommandNamespace>,
76    pub(crate) display_name: ::std::option::Option<::std::string::String>,
77    pub(crate) description: ::std::option::Option<::std::string::String>,
78    pub(crate) payload: ::std::option::Option<crate::types::CommandPayload>,
79    pub(crate) mandatory_parameters: ::std::option::Option<::std::vec::Vec<crate::types::CommandParameter>>,
80    pub(crate) role_arn: ::std::option::Option<::std::string::String>,
81    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
82}
83impl CreateCommandInputBuilder {
84    /// <p>A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.</p>
85    /// This field is required.
86    pub fn command_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
87        self.command_id = ::std::option::Option::Some(input.into());
88        self
89    }
90    /// <p>A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.</p>
91    pub fn set_command_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
92        self.command_id = input;
93        self
94    }
95    /// <p>A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.</p>
96    pub fn get_command_id(&self) -> &::std::option::Option<::std::string::String> {
97        &self.command_id
98    }
99    /// <p>The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.</p>
100    pub fn namespace(mut self, input: crate::types::CommandNamespace) -> Self {
101        self.namespace = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.</p>
105    pub fn set_namespace(mut self, input: ::std::option::Option<crate::types::CommandNamespace>) -> Self {
106        self.namespace = input;
107        self
108    }
109    /// <p>The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.</p>
110    pub fn get_namespace(&self) -> &::std::option::Option<crate::types::CommandNamespace> {
111        &self.namespace
112    }
113    /// <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>
114    pub fn display_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.display_name = ::std::option::Option::Some(input.into());
116        self
117    }
118    /// <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>
119    pub fn set_display_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.display_name = input;
121        self
122    }
123    /// <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>
124    pub fn get_display_name(&self) -> &::std::option::Option<::std::string::String> {
125        &self.display_name
126    }
127    /// <p>A short text decription of the command.</p>
128    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.description = ::std::option::Option::Some(input.into());
130        self
131    }
132    /// <p>A short text decription of the command.</p>
133    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.description = input;
135        self
136    }
137    /// <p>A short text decription of the command.</p>
138    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
139        &self.description
140    }
141    /// <p>The payload object for the command. You must specify this information when using the <code>AWS-IoT</code> namespace.</p>
142    /// <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>
143    pub fn payload(mut self, input: crate::types::CommandPayload) -> Self {
144        self.payload = ::std::option::Option::Some(input);
145        self
146    }
147    /// <p>The payload object for the command. You must specify this information when using the <code>AWS-IoT</code> namespace.</p>
148    /// <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>
149    pub fn set_payload(mut self, input: ::std::option::Option<crate::types::CommandPayload>) -> Self {
150        self.payload = input;
151        self
152    }
153    /// <p>The payload object for the command. You must specify this information when using the <code>AWS-IoT</code> namespace.</p>
154    /// <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>
155    pub fn get_payload(&self) -> &::std::option::Option<crate::types::CommandPayload> {
156        &self.payload
157    }
158    /// Appends an item to `mandatory_parameters`.
159    ///
160    /// To override the contents of this collection use [`set_mandatory_parameters`](Self::set_mandatory_parameters).
161    ///
162    /// <p>A list of parameters that are required by the <code>StartCommandExecution</code> API. These parameters need to be specified only when using the <code>AWS-IoT-FleetWise</code> namespace. You can either specify them here or when running the command using the <code>StartCommandExecution</code> API.</p>
163    pub fn mandatory_parameters(mut self, input: crate::types::CommandParameter) -> Self {
164        let mut v = self.mandatory_parameters.unwrap_or_default();
165        v.push(input);
166        self.mandatory_parameters = ::std::option::Option::Some(v);
167        self
168    }
169    /// <p>A list of parameters that are required by the <code>StartCommandExecution</code> API. These parameters need to be specified only when using the <code>AWS-IoT-FleetWise</code> namespace. You can either specify them here or when running the command using the <code>StartCommandExecution</code> API.</p>
170    pub fn set_mandatory_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CommandParameter>>) -> Self {
171        self.mandatory_parameters = input;
172        self
173    }
174    /// <p>A list of parameters that are required by the <code>StartCommandExecution</code> API. These parameters need to be specified only when using the <code>AWS-IoT-FleetWise</code> namespace. You can either specify them here or when running the command using the <code>StartCommandExecution</code> API.</p>
175    pub fn get_mandatory_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CommandParameter>> {
176        &self.mandatory_parameters
177    }
178    /// <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 required when you use the <code>AWS-IoT</code> namespace.</p>
179    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
180        self.role_arn = ::std::option::Option::Some(input.into());
181        self
182    }
183    /// <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 required when you use the <code>AWS-IoT</code> namespace.</p>
184    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
185        self.role_arn = input;
186        self
187    }
188    /// <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 required when you use the <code>AWS-IoT</code> namespace.</p>
189    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
190        &self.role_arn
191    }
192    /// Appends an item to `tags`.
193    ///
194    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
195    ///
196    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
197    pub fn tags(mut self, input: crate::types::Tag) -> Self {
198        let mut v = self.tags.unwrap_or_default();
199        v.push(input);
200        self.tags = ::std::option::Option::Some(v);
201        self
202    }
203    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
204    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
205        self.tags = input;
206        self
207    }
208    /// <p>Name-value pairs that are used as metadata to manage a command.</p>
209    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
210        &self.tags
211    }
212    /// Consumes the builder and constructs a [`CreateCommandInput`](crate::operation::create_command::CreateCommandInput).
213    pub fn build(
214        self,
215    ) -> ::std::result::Result<crate::operation::create_command::CreateCommandInput, ::aws_smithy_types::error::operation::BuildError> {
216        ::std::result::Result::Ok(crate::operation::create_command::CreateCommandInput {
217            command_id: self.command_id,
218            namespace: self.namespace,
219            display_name: self.display_name,
220            description: self.description,
221            payload: self.payload,
222            mandatory_parameters: self.mandatory_parameters,
223            role_arn: self.role_arn,
224            tags: self.tags,
225        })
226    }
227}