1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + |
|
3 + | /// When writing a match expression against `NodeFilterKey`, it is important to ensure
|
4 + | /// your code is forward-compatible. That is, if a match arm handles a case for a
|
5 + | /// feature that is supported by the service but has not been represented as an enum
|
6 + | /// variant in a current version of SDK, your code should continue to work when you
|
7 + | /// upgrade SDK to a future version in which the enum does include a variant for that
|
8 + | /// feature.
|
9 + | ///
|
10 + | /// Here is an example of how you can make a match expression forward-compatible:
|
11 + | ///
|
12 + | /// ```text
|
13 + | /// # let nodefilterkey = unimplemented!();
|
14 + | /// match nodefilterkey {
|
15 + | /// NodeFilterKey::AccountId => { /* ... */ },
|
16 + | /// NodeFilterKey::AgentType => { /* ... */ },
|
17 + | /// NodeFilterKey::AgentVersion => { /* ... */ },
|
18 + | /// NodeFilterKey::AvailabilityZone => { /* ... */ },
|
19 + | /// NodeFilterKey::AvailabilityZoneId => { /* ... */ },
|
20 + | /// NodeFilterKey::ComputerName => { /* ... */ },
|
21 + | /// NodeFilterKey::InstanceId => { /* ... */ },
|
22 + | /// NodeFilterKey::InstanceStatus => { /* ... */ },
|
23 + | /// NodeFilterKey::IpAddress => { /* ... */ },
|
24 + | /// NodeFilterKey::ManagedStatus => { /* ... */ },
|
25 + | /// NodeFilterKey::OrganizationalUnitId => { /* ... */ },
|
26 + | /// NodeFilterKey::OrganizationalUnitPath => { /* ... */ },
|
27 + | /// NodeFilterKey::PlatformName => { /* ... */ },
|
28 + | /// NodeFilterKey::PlatformType => { /* ... */ },
|
29 + | /// NodeFilterKey::PlatformVersion => { /* ... */ },
|
30 + | /// NodeFilterKey::Region => { /* ... */ },
|
31 + | /// NodeFilterKey::ResourceType => { /* ... */ },
|
32 + | /// NodeFilterKey::SourceId => { /* ... */ },
|
33 + | /// NodeFilterKey::SourceLocation => { /* ... */ },
|
34 + | /// NodeFilterKey::SourceType => { /* ... */ },
|
35 + | /// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
|
36 + | /// _ => { /* ... */ },
|
37 + | /// }
|
38 + | /// ```
|
39 + | /// The above code demonstrates that when `nodefilterkey` represents
|
40 + | /// `NewFeature`, the execution path will lead to the second last match arm,
|
41 + | /// even though the enum does not contain a variant `NodeFilterKey::NewFeature`
|
42 + | /// in the current version of SDK. The reason is that the variable `other`,
|
43 + | /// created by the `@` operator, is bound to
|
44 + | /// `NodeFilterKey::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
|
45 + | /// and calling `as_str` on it yields `"NewFeature"`.
|
46 + | /// This match expression is forward-compatible when executed with a newer
|
47 + | /// version of SDK where the variant `NodeFilterKey::NewFeature` is defined.
|
48 + | /// Specifically, when `nodefilterkey` represents `NewFeature`,
|
49 + | /// the execution path will hit the second last match arm as before by virtue of
|
50 + | /// calling `as_str` on `NodeFilterKey::NewFeature` also yielding `"NewFeature"`.
|
51 + | ///
|
52 + | /// Explicitly matching on the `Unknown` variant should
|
53 + | /// be avoided for two reasons:
|
54 + | /// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
|
55 + | /// - It might inadvertently shadow other intended match arms.
|
56 + | ///
|
57 + | #[allow(missing_docs)] // documentation missing in model
|
58 + | #[non_exhaustive]
|
59 + | #[derive(
|
60 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
|
61 + | )]
|
62 + | pub enum NodeFilterKey {
|
63 + | #[allow(missing_docs)] // documentation missing in model
|
64 + | AccountId,
|
65 + | #[allow(missing_docs)] // documentation missing in model
|
66 + | AgentType,
|
67 + | #[allow(missing_docs)] // documentation missing in model
|
68 + | AgentVersion,
|
69 + | #[allow(missing_docs)] // documentation missing in model
|
70 + | AvailabilityZone,
|
71 + | #[allow(missing_docs)] // documentation missing in model
|
72 + | AvailabilityZoneId,
|
73 + | #[allow(missing_docs)] // documentation missing in model
|
74 + | ComputerName,
|
75 + | #[allow(missing_docs)] // documentation missing in model
|
76 + | InstanceId,
|
77 + | #[allow(missing_docs)] // documentation missing in model
|
78 + | InstanceStatus,
|
79 + | #[allow(missing_docs)] // documentation missing in model
|
80 + | IpAddress,
|
81 + | #[allow(missing_docs)] // documentation missing in model
|
82 + | ManagedStatus,
|
83 + | #[allow(missing_docs)] // documentation missing in model
|
84 + | OrganizationalUnitId,
|
85 + | #[allow(missing_docs)] // documentation missing in model
|
86 + | OrganizationalUnitPath,
|
87 + | #[allow(missing_docs)] // documentation missing in model
|
88 + | PlatformName,
|
89 + | #[allow(missing_docs)] // documentation missing in model
|
90 + | PlatformType,
|
91 + | #[allow(missing_docs)] // documentation missing in model
|
92 + | PlatformVersion,
|
93 + | #[allow(missing_docs)] // documentation missing in model
|
94 + | Region,
|
95 + | #[allow(missing_docs)] // documentation missing in model
|
96 + | ResourceType,
|
97 + | #[allow(missing_docs)] // documentation missing in model
|
98 + | SourceId,
|
99 + | #[allow(missing_docs)] // documentation missing in model
|
100 + | SourceLocation,
|
101 + | #[allow(missing_docs)] // documentation missing in model
|
102 + | SourceType,
|
103 + | /// `Unknown` contains new variants that have been added since this code was generated.
|
104 + | #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
|
105 + | Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
|
106 + | }
|
107 + | impl ::std::convert::From<&str> for NodeFilterKey {
|
108 + | fn from(s: &str) -> Self {
|
109 + | match s {
|
110 + | "AccountId" => NodeFilterKey::AccountId,
|
111 + | "AgentType" => NodeFilterKey::AgentType,
|
112 + | "AgentVersion" => NodeFilterKey::AgentVersion,
|
113 + | "AvailabilityZone" => NodeFilterKey::AvailabilityZone,
|
114 + | "AvailabilityZoneId" => NodeFilterKey::AvailabilityZoneId,
|
115 + | "ComputerName" => NodeFilterKey::ComputerName,
|
116 + | "InstanceId" => NodeFilterKey::InstanceId,
|
117 + | "InstanceStatus" => NodeFilterKey::InstanceStatus,
|
118 + | "IpAddress" => NodeFilterKey::IpAddress,
|
119 + | "ManagedStatus" => NodeFilterKey::ManagedStatus,
|
120 + | "OrganizationalUnitId" => NodeFilterKey::OrganizationalUnitId,
|
121 + | "OrganizationalUnitPath" => NodeFilterKey::OrganizationalUnitPath,
|
122 + | "PlatformName" => NodeFilterKey::PlatformName,
|
123 + | "PlatformType" => NodeFilterKey::PlatformType,
|
124 + | "PlatformVersion" => NodeFilterKey::PlatformVersion,
|
125 + | "Region" => NodeFilterKey::Region,
|
126 + | "ResourceType" => NodeFilterKey::ResourceType,
|
127 + | "SourceId" => NodeFilterKey::SourceId,
|
128 + | "SourceLocation" => NodeFilterKey::SourceLocation,
|
129 + | "SourceType" => NodeFilterKey::SourceType,
|
130 + | other => NodeFilterKey::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
|
131 + | }
|
132 + | }
|
133 + | }
|
134 + | impl ::std::str::FromStr for NodeFilterKey {
|
135 + | type Err = ::std::convert::Infallible;
|
136 + |
|
137 + | fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
|
138 + | ::std::result::Result::Ok(NodeFilterKey::from(s))
|
139 + | }
|
140 + | }
|
141 + | impl NodeFilterKey {
|
142 + | /// Returns the `&str` value of the enum member.
|
143 + | pub fn as_str(&self) -> &str {
|
144 + | match self {
|
145 + | NodeFilterKey::AccountId => "AccountId",
|
146 + | NodeFilterKey::AgentType => "AgentType",
|
147 + | NodeFilterKey::AgentVersion => "AgentVersion",
|
148 + | NodeFilterKey::AvailabilityZone => "AvailabilityZone",
|
149 + | NodeFilterKey::AvailabilityZoneId => "AvailabilityZoneId",
|
150 + | NodeFilterKey::ComputerName => "ComputerName",
|
151 + | NodeFilterKey::InstanceId => "InstanceId",
|
152 + | NodeFilterKey::InstanceStatus => "InstanceStatus",
|
153 + | NodeFilterKey::IpAddress => "IpAddress",
|
154 + | NodeFilterKey::ManagedStatus => "ManagedStatus",
|
155 + | NodeFilterKey::OrganizationalUnitId => "OrganizationalUnitId",
|
156 + | NodeFilterKey::OrganizationalUnitPath => "OrganizationalUnitPath",
|
157 + | NodeFilterKey::PlatformName => "PlatformName",
|
158 + | NodeFilterKey::PlatformType => "PlatformType",
|
159 + | NodeFilterKey::PlatformVersion => "PlatformVersion",
|
160 + | NodeFilterKey::Region => "Region",
|
161 + | NodeFilterKey::ResourceType => "ResourceType",
|
162 + | NodeFilterKey::SourceId => "SourceId",
|
163 + | NodeFilterKey::SourceLocation => "SourceLocation",
|
164 + | NodeFilterKey::SourceType => "SourceType",
|
165 + | NodeFilterKey::Unknown(value) => value.as_str(),
|
166 + | }
|
167 + | }
|
168 + | /// Returns all the `&str` representations of the enum members.
|
169 + | pub const fn values() -> &'static [&'static str] {
|
170 + | &[
|
171 + | "AccountId",
|
172 + | "AgentType",
|
173 + | "AgentVersion",
|
174 + | "AvailabilityZone",
|
175 + | "AvailabilityZoneId",
|
176 + | "ComputerName",
|
177 + | "InstanceId",
|
178 + | "InstanceStatus",
|
179 + | "IpAddress",
|
180 + | "ManagedStatus",
|
181 + | "OrganizationalUnitId",
|
182 + | "OrganizationalUnitPath",
|
183 + | "PlatformName",
|
184 + | "PlatformType",
|
185 + | "PlatformVersion",
|
186 + | "Region",
|
187 + | "ResourceType",
|
188 + | "SourceId",
|
189 + | "SourceLocation",
|
190 + | "SourceType",
|
191 + | ]
|
192 + | }
|
193 + | }
|
194 + | impl ::std::convert::AsRef<str> for NodeFilterKey {
|
195 + | fn as_ref(&self) -> &str {
|
196 + | self.as_str()
|
197 + | }
|
198 + | }
|
199 + | impl NodeFilterKey {
|
200 + | /// Parses the enum value while disallowing unknown variants.
|
201 + | ///
|
202 + | /// Unknown variants will result in an error.
|
203 + | pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
|
204 + | match Self::from(value) {
|
205 + | #[allow(deprecated)]
|
206 + | Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
|
207 + | known => Ok(known),
|
208 + | }
|
209 + | }
|
210 + | }
|
211 + | impl ::std::fmt::Display for NodeFilterKey {
|
212 + | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
213 + | match self {
|
214 + | NodeFilterKey::AccountId => write!(f, "AccountId"),
|
215 + | NodeFilterKey::AgentType => write!(f, "AgentType"),
|
216 + | NodeFilterKey::AgentVersion => write!(f, "AgentVersion"),
|
217 + | NodeFilterKey::AvailabilityZone => write!(f, "AvailabilityZone"),
|
218 + | NodeFilterKey::AvailabilityZoneId => write!(f, "AvailabilityZoneId"),
|
219 + | NodeFilterKey::ComputerName => write!(f, "ComputerName"),
|
220 + | NodeFilterKey::InstanceId => write!(f, "InstanceId"),
|
221 + | NodeFilterKey::InstanceStatus => write!(f, "InstanceStatus"),
|
222 + | NodeFilterKey::IpAddress => write!(f, "IpAddress"),
|
223 + | NodeFilterKey::ManagedStatus => write!(f, "ManagedStatus"),
|
224 + | NodeFilterKey::OrganizationalUnitId => write!(f, "OrganizationalUnitId"),
|
225 + | NodeFilterKey::OrganizationalUnitPath => write!(f, "OrganizationalUnitPath"),
|
226 + | NodeFilterKey::PlatformName => write!(f, "PlatformName"),
|
227 + | NodeFilterKey::PlatformType => write!(f, "PlatformType"),
|
228 + | NodeFilterKey::PlatformVersion => write!(f, "PlatformVersion"),
|
229 + | NodeFilterKey::Region => write!(f, "Region"),
|
230 + | NodeFilterKey::ResourceType => write!(f, "ResourceType"),
|
231 + | NodeFilterKey::SourceId => write!(f, "SourceId"),
|
232 + | NodeFilterKey::SourceLocation => write!(f, "SourceLocation"),
|
233 + | NodeFilterKey::SourceType => write!(f, "SourceType"),
|
234 + | NodeFilterKey::Unknown(value) => write!(f, "{value}"),
|
235 + | }
|
236 + | }
|
237 + | }
|