1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A general abstraction of a signal. A node can be specified as an actuator, attribute, branch, or sensor.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum Node {
/// <p>Information about a node specified as an actuator.</p><note>
/// <p>An actuator is a digital representation of a vehicle device.</p>
/// </note>
Actuator(crate::types::Actuator),
/// <p>Information about a node specified as an attribute.</p><note>
/// <p>An attribute represents static information about a vehicle.</p>
/// </note>
Attribute(crate::types::Attribute),
/// <p>Information about a node specified as a branch.</p><note>
/// <p>A group of signals that are defined in a hierarchical structure.</p>
/// </note>
Branch(crate::types::Branch),
/// <p>Represents a member of the complex data structure. The <code>datatype</code> of the property can be either primitive or another <code>struct</code>.</p>
Property(crate::types::CustomProperty),
/// <p>An input component that reports the environmental condition of a vehicle.</p><note>
/// <p>You can collect data about fluid levels, temperatures, vibrations, or battery voltage from sensors.</p>
/// </note>
Sensor(crate::types::Sensor),
/// <p>Represents a complex or higher-order data structure.</p>
Struct(crate::types::CustomStruct),
/// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
/// An unknown enum variant
///
/// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
/// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
/// by the client. This can happen when the server adds new functionality, but the client has not been updated.
/// To investigate this, consider turning on debug logging to print the raw HTTP response.
#[non_exhaustive]
Unknown,
}
impl Node {
/// Tries to convert the enum instance into [`Actuator`](crate::types::Node::Actuator), extracting the inner [`Actuator`](crate::types::Actuator).
/// Returns `Err(&Self)` if it can't be converted.
pub fn as_actuator(&self) -> ::std::result::Result<&crate::types::Actuator, &Self> {
if let Node::Actuator(val) = &self {
::std::result::Result::Ok(val)
} else {
::std::result::Result::Err(self)
}
}
/// Returns true if this is a [`Actuator`](crate::types::Node::Actuator).
pub fn is_actuator(&self) -> bool {
self.as_actuator().is_ok()
}
/// Tries to convert the enum instance into [`Attribute`](crate::types::Node::Attribute), extracting the inner [`Attribute`](crate::types::Attribute).
/// Returns `Err(&Self)` if it can't be converted.
pub fn as_attribute(&self) -> ::std::result::Result<&crate::types::Attribute, &Self> {
if let Node::Attribute(val) = &self {
::std::result::Result::Ok(val)
} else {
::std::result::Result::Err(self)
}
}
/// Returns true if this is a [`Attribute`](crate::types::Node::Attribute).
pub fn is_attribute(&self) -> bool {
self.as_attribute().is_ok()
}
/// Tries to convert the enum instance into [`Branch`](crate::types::Node::Branch), extracting the inner [`Branch`](crate::types::Branch).
/// Returns `Err(&Self)` if it can't be converted.
pub fn as_branch(&self) -> ::std::result::Result<&crate::types::Branch, &Self> {
if let Node::Branch(val) = &self {
::std::result::Result::Ok(val)
} else {
::std::result::Result::Err(self)
}
}
/// Returns true if this is a [`Branch`](crate::types::Node::Branch).
pub fn is_branch(&self) -> bool {
self.as_branch().is_ok()
}
/// Tries to convert the enum instance into [`Property`](crate::types::Node::Property), extracting the inner [`CustomProperty`](crate::types::CustomProperty).
/// Returns `Err(&Self)` if it can't be converted.
pub fn as_property(&self) -> ::std::result::Result<&crate::types::CustomProperty, &Self> {
if let Node::Property(val) = &self {
::std::result::Result::Ok(val)
} else {
::std::result::Result::Err(self)
}
}
/// Returns true if this is a [`Property`](crate::types::Node::Property).
pub fn is_property(&self) -> bool {
self.as_property().is_ok()
}
/// Tries to convert the enum instance into [`Sensor`](crate::types::Node::Sensor), extracting the inner [`Sensor`](crate::types::Sensor).
/// Returns `Err(&Self)` if it can't be converted.
pub fn as_sensor(&self) -> ::std::result::Result<&crate::types::Sensor, &Self> {
if let Node::Sensor(val) = &self {
::std::result::Result::Ok(val)
} else {
::std::result::Result::Err(self)
}
}
/// Returns true if this is a [`Sensor`](crate::types::Node::Sensor).
pub fn is_sensor(&self) -> bool {
self.as_sensor().is_ok()
}
/// Tries to convert the enum instance into [`Struct`](crate::types::Node::Struct), extracting the inner [`CustomStruct`](crate::types::CustomStruct).
/// Returns `Err(&Self)` if it can't be converted.
pub fn as_struct(&self) -> ::std::result::Result<&crate::types::CustomStruct, &Self> {
if let Node::Struct(val) = &self {
::std::result::Result::Ok(val)
} else {
::std::result::Result::Err(self)
}
}
/// Returns true if this is a [`Struct`](crate::types::Node::Struct).
pub fn is_struct(&self) -> bool {
self.as_struct().is_ok()
}
/// Returns true if the enum instance is the `Unknown` variant.
pub fn is_unknown(&self) -> bool {
matches!(self, Self::Unknown)
}
}