aws_sdk_iotfleetwise/operation/create_vehicle/
_create_vehicle_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 CreateVehicleInput {
6    /// <p>The unique ID of the vehicle to create.</p>
7    pub vehicle_name: ::std::option::Option<::std::string::String>,
8    /// <p>The Amazon Resource Name ARN of a vehicle model.</p>
9    pub model_manifest_arn: ::std::option::Option<::std::string::String>,
10    /// <p>The ARN of a decoder manifest.</p>
11    pub decoder_manifest_arn: ::std::option::Option<::std::string::String>,
12    /// <p>Static information about a vehicle in a key-value pair. For example: <code>"engineType"</code> : <code>"1.3 L R2"</code></p>
13    /// <p>To use attributes with Campaigns or State Templates, you must include them using the request parameters <code>dataExtraDimensions</code> and/or <code>metadataExtraDimensions</code> (for state templates only) when creating your campaign/state template.</p>
14    pub attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
15    /// <p>An option to create a new Amazon Web Services IoT thing when creating a vehicle, or to validate an existing Amazon Web Services IoT thing as a vehicle.</p>
16    /// <p>Default: <code></code></p>
17    pub association_behavior: ::std::option::Option<crate::types::VehicleAssociationBehavior>,
18    /// <p>Metadata that can be used to manage the vehicle.</p>
19    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
20    /// <p>Associate state templates with the vehicle. You can monitor the last known state of the vehicle in near real time.</p>
21    pub state_templates: ::std::option::Option<::std::vec::Vec<crate::types::StateTemplateAssociation>>,
22}
23impl CreateVehicleInput {
24    /// <p>The unique ID of the vehicle to create.</p>
25    pub fn vehicle_name(&self) -> ::std::option::Option<&str> {
26        self.vehicle_name.as_deref()
27    }
28    /// <p>The Amazon Resource Name ARN of a vehicle model.</p>
29    pub fn model_manifest_arn(&self) -> ::std::option::Option<&str> {
30        self.model_manifest_arn.as_deref()
31    }
32    /// <p>The ARN of a decoder manifest.</p>
33    pub fn decoder_manifest_arn(&self) -> ::std::option::Option<&str> {
34        self.decoder_manifest_arn.as_deref()
35    }
36    /// <p>Static information about a vehicle in a key-value pair. For example: <code>"engineType"</code> : <code>"1.3 L R2"</code></p>
37    /// <p>To use attributes with Campaigns or State Templates, you must include them using the request parameters <code>dataExtraDimensions</code> and/or <code>metadataExtraDimensions</code> (for state templates only) when creating your campaign/state template.</p>
38    pub fn attributes(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
39        self.attributes.as_ref()
40    }
41    /// <p>An option to create a new Amazon Web Services IoT thing when creating a vehicle, or to validate an existing Amazon Web Services IoT thing as a vehicle.</p>
42    /// <p>Default: <code></code></p>
43    pub fn association_behavior(&self) -> ::std::option::Option<&crate::types::VehicleAssociationBehavior> {
44        self.association_behavior.as_ref()
45    }
46    /// <p>Metadata that can be used to manage the vehicle.</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 `.tags.is_none()`.
49    pub fn tags(&self) -> &[crate::types::Tag] {
50        self.tags.as_deref().unwrap_or_default()
51    }
52    /// <p>Associate state templates with the vehicle. You can monitor the last known state of the vehicle in near real time.</p>
53    ///
54    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.state_templates.is_none()`.
55    pub fn state_templates(&self) -> &[crate::types::StateTemplateAssociation] {
56        self.state_templates.as_deref().unwrap_or_default()
57    }
58}
59impl CreateVehicleInput {
60    /// Creates a new builder-style object to manufacture [`CreateVehicleInput`](crate::operation::create_vehicle::CreateVehicleInput).
61    pub fn builder() -> crate::operation::create_vehicle::builders::CreateVehicleInputBuilder {
62        crate::operation::create_vehicle::builders::CreateVehicleInputBuilder::default()
63    }
64}
65
66/// A builder for [`CreateVehicleInput`](crate::operation::create_vehicle::CreateVehicleInput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct CreateVehicleInputBuilder {
70    pub(crate) vehicle_name: ::std::option::Option<::std::string::String>,
71    pub(crate) model_manifest_arn: ::std::option::Option<::std::string::String>,
72    pub(crate) decoder_manifest_arn: ::std::option::Option<::std::string::String>,
73    pub(crate) attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
74    pub(crate) association_behavior: ::std::option::Option<crate::types::VehicleAssociationBehavior>,
75    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
76    pub(crate) state_templates: ::std::option::Option<::std::vec::Vec<crate::types::StateTemplateAssociation>>,
77}
78impl CreateVehicleInputBuilder {
79    /// <p>The unique ID of the vehicle to create.</p>
80    /// This field is required.
81    pub fn vehicle_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82        self.vehicle_name = ::std::option::Option::Some(input.into());
83        self
84    }
85    /// <p>The unique ID of the vehicle to create.</p>
86    pub fn set_vehicle_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87        self.vehicle_name = input;
88        self
89    }
90    /// <p>The unique ID of the vehicle to create.</p>
91    pub fn get_vehicle_name(&self) -> &::std::option::Option<::std::string::String> {
92        &self.vehicle_name
93    }
94    /// <p>The Amazon Resource Name ARN of a vehicle model.</p>
95    /// This field is required.
96    pub fn model_manifest_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.model_manifest_arn = ::std::option::Option::Some(input.into());
98        self
99    }
100    /// <p>The Amazon Resource Name ARN of a vehicle model.</p>
101    pub fn set_model_manifest_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.model_manifest_arn = input;
103        self
104    }
105    /// <p>The Amazon Resource Name ARN of a vehicle model.</p>
106    pub fn get_model_manifest_arn(&self) -> &::std::option::Option<::std::string::String> {
107        &self.model_manifest_arn
108    }
109    /// <p>The ARN of a decoder manifest.</p>
110    /// This field is required.
111    pub fn decoder_manifest_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
112        self.decoder_manifest_arn = ::std::option::Option::Some(input.into());
113        self
114    }
115    /// <p>The ARN of a decoder manifest.</p>
116    pub fn set_decoder_manifest_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
117        self.decoder_manifest_arn = input;
118        self
119    }
120    /// <p>The ARN of a decoder manifest.</p>
121    pub fn get_decoder_manifest_arn(&self) -> &::std::option::Option<::std::string::String> {
122        &self.decoder_manifest_arn
123    }
124    /// Adds a key-value pair to `attributes`.
125    ///
126    /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
127    ///
128    /// <p>Static information about a vehicle in a key-value pair. For example: <code>"engineType"</code> : <code>"1.3 L R2"</code></p>
129    /// <p>To use attributes with Campaigns or State Templates, you must include them using the request parameters <code>dataExtraDimensions</code> and/or <code>metadataExtraDimensions</code> (for state templates only) when creating your campaign/state template.</p>
130    pub fn attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
131        let mut hash_map = self.attributes.unwrap_or_default();
132        hash_map.insert(k.into(), v.into());
133        self.attributes = ::std::option::Option::Some(hash_map);
134        self
135    }
136    /// <p>Static information about a vehicle in a key-value pair. For example: <code>"engineType"</code> : <code>"1.3 L R2"</code></p>
137    /// <p>To use attributes with Campaigns or State Templates, you must include them using the request parameters <code>dataExtraDimensions</code> and/or <code>metadataExtraDimensions</code> (for state templates only) when creating your campaign/state template.</p>
138    pub fn set_attributes(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
139        self.attributes = input;
140        self
141    }
142    /// <p>Static information about a vehicle in a key-value pair. For example: <code>"engineType"</code> : <code>"1.3 L R2"</code></p>
143    /// <p>To use attributes with Campaigns or State Templates, you must include them using the request parameters <code>dataExtraDimensions</code> and/or <code>metadataExtraDimensions</code> (for state templates only) when creating your campaign/state template.</p>
144    pub fn get_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
145        &self.attributes
146    }
147    /// <p>An option to create a new Amazon Web Services IoT thing when creating a vehicle, or to validate an existing Amazon Web Services IoT thing as a vehicle.</p>
148    /// <p>Default: <code></code></p>
149    pub fn association_behavior(mut self, input: crate::types::VehicleAssociationBehavior) -> Self {
150        self.association_behavior = ::std::option::Option::Some(input);
151        self
152    }
153    /// <p>An option to create a new Amazon Web Services IoT thing when creating a vehicle, or to validate an existing Amazon Web Services IoT thing as a vehicle.</p>
154    /// <p>Default: <code></code></p>
155    pub fn set_association_behavior(mut self, input: ::std::option::Option<crate::types::VehicleAssociationBehavior>) -> Self {
156        self.association_behavior = input;
157        self
158    }
159    /// <p>An option to create a new Amazon Web Services IoT thing when creating a vehicle, or to validate an existing Amazon Web Services IoT thing as a vehicle.</p>
160    /// <p>Default: <code></code></p>
161    pub fn get_association_behavior(&self) -> &::std::option::Option<crate::types::VehicleAssociationBehavior> {
162        &self.association_behavior
163    }
164    /// Appends an item to `tags`.
165    ///
166    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
167    ///
168    /// <p>Metadata that can be used to manage the vehicle.</p>
169    pub fn tags(mut self, input: crate::types::Tag) -> Self {
170        let mut v = self.tags.unwrap_or_default();
171        v.push(input);
172        self.tags = ::std::option::Option::Some(v);
173        self
174    }
175    /// <p>Metadata that can be used to manage the vehicle.</p>
176    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
177        self.tags = input;
178        self
179    }
180    /// <p>Metadata that can be used to manage the vehicle.</p>
181    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
182        &self.tags
183    }
184    /// Appends an item to `state_templates`.
185    ///
186    /// To override the contents of this collection use [`set_state_templates`](Self::set_state_templates).
187    ///
188    /// <p>Associate state templates with the vehicle. You can monitor the last known state of the vehicle in near real time.</p>
189    pub fn state_templates(mut self, input: crate::types::StateTemplateAssociation) -> Self {
190        let mut v = self.state_templates.unwrap_or_default();
191        v.push(input);
192        self.state_templates = ::std::option::Option::Some(v);
193        self
194    }
195    /// <p>Associate state templates with the vehicle. You can monitor the last known state of the vehicle in near real time.</p>
196    pub fn set_state_templates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::StateTemplateAssociation>>) -> Self {
197        self.state_templates = input;
198        self
199    }
200    /// <p>Associate state templates with the vehicle. You can monitor the last known state of the vehicle in near real time.</p>
201    pub fn get_state_templates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::StateTemplateAssociation>> {
202        &self.state_templates
203    }
204    /// Consumes the builder and constructs a [`CreateVehicleInput`](crate::operation::create_vehicle::CreateVehicleInput).
205    pub fn build(
206        self,
207    ) -> ::std::result::Result<crate::operation::create_vehicle::CreateVehicleInput, ::aws_smithy_types::error::operation::BuildError> {
208        ::std::result::Result::Ok(crate::operation::create_vehicle::CreateVehicleInput {
209            vehicle_name: self.vehicle_name,
210            model_manifest_arn: self.model_manifest_arn,
211            decoder_manifest_arn: self.decoder_manifest_arn,
212            attributes: self.attributes,
213            association_behavior: self.association_behavior,
214            tags: self.tags,
215            state_templates: self.state_templates,
216        })
217    }
218}