aws_sdk_machinelearning/types/_evaluation_filter_variable.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// When writing a match expression against `EvaluationFilterVariable`, 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 evaluationfiltervariable = unimplemented!();
14/// match evaluationfiltervariable {
15/// EvaluationFilterVariable::CreatedAt => { /* ... */ },
16/// EvaluationFilterVariable::DatasourceId => { /* ... */ },
17/// EvaluationFilterVariable::DataUri => { /* ... */ },
18/// EvaluationFilterVariable::IamUser => { /* ... */ },
19/// EvaluationFilterVariable::LastUpdatedAt => { /* ... */ },
20/// EvaluationFilterVariable::MlModelId => { /* ... */ },
21/// EvaluationFilterVariable::Name => { /* ... */ },
22/// EvaluationFilterVariable::Status => { /* ... */ },
23/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
24/// _ => { /* ... */ },
25/// }
26/// ```
27/// The above code demonstrates that when `evaluationfiltervariable` represents
28/// `NewFeature`, the execution path will lead to the second last match arm,
29/// even though the enum does not contain a variant `EvaluationFilterVariable::NewFeature`
30/// in the current version of SDK. The reason is that the variable `other`,
31/// created by the `@` operator, is bound to
32/// `EvaluationFilterVariable::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
33/// and calling `as_str` on it yields `"NewFeature"`.
34/// This match expression is forward-compatible when executed with a newer
35/// version of SDK where the variant `EvaluationFilterVariable::NewFeature` is defined.
36/// Specifically, when `evaluationfiltervariable` represents `NewFeature`,
37/// the execution path will hit the second last match arm as before by virtue of
38/// calling `as_str` on `EvaluationFilterVariable::NewFeature` also yielding `"NewFeature"`.
39///
40/// Explicitly matching on the `Unknown` variant should
41/// be avoided for two reasons:
42/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
43/// - It might inadvertently shadow other intended match arms.
44///
45/// <p>A list of the variables to use in searching or filtering <code>Evaluation</code>.</p>
46/// <ul>
47/// <li>
48/// <p>
49/// <code>CreatedAt</code> - Sets the search criteria to <code>Evaluation</code> creation date.</p>
50/// </li>
51/// <li>
52/// <p>
53/// <code>Status</code> - Sets the search criteria to <code>Evaluation</code> status.</p>
54/// </li>
55/// <li>
56/// <p>
57/// <code>Name</code> - Sets the search criteria to the contents of <code>Evaluation</code>
58/// <b> </b>
59/// <code>Name</code>.</p>
60/// </li>
61/// <li>
62/// <p>
63/// <code>IAMUser</code> - Sets the search criteria to the user account that invoked an evaluation.</p>
64/// </li>
65/// <li>
66/// <p>
67/// <code>MLModelId</code> - Sets the search criteria to the <code>Predictor</code> that was evaluated.</p>
68/// </li>
69/// <li>
70/// <p>
71/// <code>DataSourceId</code> - Sets the search criteria to the <code>DataSource</code> used in evaluation.</p>
72/// </li>
73/// <li>
74/// <p>
75/// <code>DataUri</code> - Sets the search criteria to the data file(s) used in evaluation. The URL can identify either a file or an Amazon Simple Storage Service (Amazon S3) bucket or directory.</p>
76/// </li>
77/// </ul>
78#[non_exhaustive]
79#[derive(
80 ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
81)]
82pub enum EvaluationFilterVariable {
83 #[allow(missing_docs)] // documentation missing in model
84 CreatedAt,
85 #[allow(missing_docs)] // documentation missing in model
86 DatasourceId,
87 #[allow(missing_docs)] // documentation missing in model
88 DataUri,
89 #[allow(missing_docs)] // documentation missing in model
90 IamUser,
91 #[allow(missing_docs)] // documentation missing in model
92 LastUpdatedAt,
93 #[allow(missing_docs)] // documentation missing in model
94 MlModelId,
95 #[allow(missing_docs)] // documentation missing in model
96 Name,
97 #[allow(missing_docs)] // documentation missing in model
98 Status,
99 /// `Unknown` contains new variants that have been added since this code was generated.
100 #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
101 Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
102}
103impl ::std::convert::From<&str> for EvaluationFilterVariable {
104 fn from(s: &str) -> Self {
105 match s {
106 "CreatedAt" => EvaluationFilterVariable::CreatedAt,
107 "DataSourceId" => EvaluationFilterVariable::DatasourceId,
108 "DataURI" => EvaluationFilterVariable::DataUri,
109 "IAMUser" => EvaluationFilterVariable::IamUser,
110 "LastUpdatedAt" => EvaluationFilterVariable::LastUpdatedAt,
111 "MLModelId" => EvaluationFilterVariable::MlModelId,
112 "Name" => EvaluationFilterVariable::Name,
113 "Status" => EvaluationFilterVariable::Status,
114 other => EvaluationFilterVariable::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
115 }
116 }
117}
118impl ::std::str::FromStr for EvaluationFilterVariable {
119 type Err = ::std::convert::Infallible;
120
121 fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
122 ::std::result::Result::Ok(EvaluationFilterVariable::from(s))
123 }
124}
125impl EvaluationFilterVariable {
126 /// Returns the `&str` value of the enum member.
127 pub fn as_str(&self) -> &str {
128 match self {
129 EvaluationFilterVariable::CreatedAt => "CreatedAt",
130 EvaluationFilterVariable::DatasourceId => "DataSourceId",
131 EvaluationFilterVariable::DataUri => "DataURI",
132 EvaluationFilterVariable::IamUser => "IAMUser",
133 EvaluationFilterVariable::LastUpdatedAt => "LastUpdatedAt",
134 EvaluationFilterVariable::MlModelId => "MLModelId",
135 EvaluationFilterVariable::Name => "Name",
136 EvaluationFilterVariable::Status => "Status",
137 EvaluationFilterVariable::Unknown(value) => value.as_str(),
138 }
139 }
140 /// Returns all the `&str` representations of the enum members.
141 pub const fn values() -> &'static [&'static str] {
142 &[
143 "CreatedAt",
144 "DataSourceId",
145 "DataURI",
146 "IAMUser",
147 "LastUpdatedAt",
148 "MLModelId",
149 "Name",
150 "Status",
151 ]
152 }
153}
154impl ::std::convert::AsRef<str> for EvaluationFilterVariable {
155 fn as_ref(&self) -> &str {
156 self.as_str()
157 }
158}
159impl EvaluationFilterVariable {
160 /// Parses the enum value while disallowing unknown variants.
161 ///
162 /// Unknown variants will result in an error.
163 pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
164 match Self::from(value) {
165 #[allow(deprecated)]
166 Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
167 known => Ok(known),
168 }
169 }
170}
171impl ::std::fmt::Display for EvaluationFilterVariable {
172 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
173 match self {
174 EvaluationFilterVariable::CreatedAt => write!(f, "CreatedAt"),
175 EvaluationFilterVariable::DatasourceId => write!(f, "DataSourceId"),
176 EvaluationFilterVariable::DataUri => write!(f, "DataURI"),
177 EvaluationFilterVariable::IamUser => write!(f, "IAMUser"),
178 EvaluationFilterVariable::LastUpdatedAt => write!(f, "LastUpdatedAt"),
179 EvaluationFilterVariable::MlModelId => write!(f, "MLModelId"),
180 EvaluationFilterVariable::Name => write!(f, "Name"),
181 EvaluationFilterVariable::Status => write!(f, "Status"),
182 EvaluationFilterVariable::Unknown(value) => write!(f, "{value}"),
183 }
184 }
185}