aws_sdk_sesv2/types/_list_recommendations_filter_key.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// When writing a match expression against `ListRecommendationsFilterKey`, 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 listrecommendationsfilterkey = unimplemented!();
14/// match listrecommendationsfilterkey {
15/// ListRecommendationsFilterKey::Impact => { /* ... */ },
16/// ListRecommendationsFilterKey::ResourceArn => { /* ... */ },
17/// ListRecommendationsFilterKey::Status => { /* ... */ },
18/// ListRecommendationsFilterKey::Type => { /* ... */ },
19/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
20/// _ => { /* ... */ },
21/// }
22/// ```
23/// The above code demonstrates that when `listrecommendationsfilterkey` represents
24/// `NewFeature`, the execution path will lead to the second last match arm,
25/// even though the enum does not contain a variant `ListRecommendationsFilterKey::NewFeature`
26/// in the current version of SDK. The reason is that the variable `other`,
27/// created by the `@` operator, is bound to
28/// `ListRecommendationsFilterKey::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
29/// and calling `as_str` on it yields `"NewFeature"`.
30/// This match expression is forward-compatible when executed with a newer
31/// version of SDK where the variant `ListRecommendationsFilterKey::NewFeature` is defined.
32/// Specifically, when `listrecommendationsfilterkey` represents `NewFeature`,
33/// the execution path will hit the second last match arm as before by virtue of
34/// calling `as_str` on `ListRecommendationsFilterKey::NewFeature` also yielding `"NewFeature"`.
35///
36/// Explicitly matching on the `Unknown` variant should
37/// be avoided for two reasons:
38/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
39/// - It might inadvertently shadow other intended match arms.
40///
41/// <p>The <code>ListRecommendations</code> filter type. This can be one of the following:</p>
42/// <ul>
43/// <li>
44/// <p>
45/// <code>TYPE</code> – The recommendation type, with values like <code>DKIM</code>,
46/// <code>SPF</code>, <code>DMARC</code>, <code>BIMI</code>, or <code>COMPLAINT</code>.</p>
47/// </li>
48/// <li>
49/// <p>
50/// <code>IMPACT</code> – The recommendation impact, with values like
51/// <code>HIGH</code> or <code>LOW</code>.</p>
52/// </li>
53/// <li>
54/// <p>
55/// <code>STATUS</code> – The recommendation status, with values like
56/// <code>OPEN</code> or <code>FIXED</code>.</p>
57/// </li>
58/// <li>
59/// <p>
60/// <code>RESOURCE_ARN</code> – The resource affected by the recommendation,
61/// with values like <code>arn:aws:ses:us-east-1:123456789012:identity/example.com</code>.</p>
62/// </li>
63/// </ul>
64#[non_exhaustive]
65#[derive(
66 ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
67)]
68pub enum ListRecommendationsFilterKey {
69 #[allow(missing_docs)] // documentation missing in model
70 Impact,
71 #[allow(missing_docs)] // documentation missing in model
72 ResourceArn,
73 #[allow(missing_docs)] // documentation missing in model
74 Status,
75 #[allow(missing_docs)] // documentation missing in model
76 Type,
77 /// `Unknown` contains new variants that have been added since this code was generated.
78 #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
79 Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
80}
81impl ::std::convert::From<&str> for ListRecommendationsFilterKey {
82 fn from(s: &str) -> Self {
83 match s {
84 "IMPACT" => ListRecommendationsFilterKey::Impact,
85 "RESOURCE_ARN" => ListRecommendationsFilterKey::ResourceArn,
86 "STATUS" => ListRecommendationsFilterKey::Status,
87 "TYPE" => ListRecommendationsFilterKey::Type,
88 other => ListRecommendationsFilterKey::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
89 }
90 }
91}
92impl ::std::str::FromStr for ListRecommendationsFilterKey {
93 type Err = ::std::convert::Infallible;
94
95 fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
96 ::std::result::Result::Ok(ListRecommendationsFilterKey::from(s))
97 }
98}
99impl ListRecommendationsFilterKey {
100 /// Returns the `&str` value of the enum member.
101 pub fn as_str(&self) -> &str {
102 match self {
103 ListRecommendationsFilterKey::Impact => "IMPACT",
104 ListRecommendationsFilterKey::ResourceArn => "RESOURCE_ARN",
105 ListRecommendationsFilterKey::Status => "STATUS",
106 ListRecommendationsFilterKey::Type => "TYPE",
107 ListRecommendationsFilterKey::Unknown(value) => value.as_str(),
108 }
109 }
110 /// Returns all the `&str` representations of the enum members.
111 pub const fn values() -> &'static [&'static str] {
112 &["IMPACT", "RESOURCE_ARN", "STATUS", "TYPE"]
113 }
114}
115impl ::std::convert::AsRef<str> for ListRecommendationsFilterKey {
116 fn as_ref(&self) -> &str {
117 self.as_str()
118 }
119}
120impl ListRecommendationsFilterKey {
121 /// Parses the enum value while disallowing unknown variants.
122 ///
123 /// Unknown variants will result in an error.
124 pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
125 match Self::from(value) {
126 #[allow(deprecated)]
127 Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
128 known => Ok(known),
129 }
130 }
131}
132impl ::std::fmt::Display for ListRecommendationsFilterKey {
133 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
134 match self {
135 ListRecommendationsFilterKey::Impact => write!(f, "IMPACT"),
136 ListRecommendationsFilterKey::ResourceArn => write!(f, "RESOURCE_ARN"),
137 ListRecommendationsFilterKey::Status => write!(f, "STATUS"),
138 ListRecommendationsFilterKey::Type => write!(f, "TYPE"),
139 ListRecommendationsFilterKey::Unknown(value) => write!(f, "{}", value),
140 }
141 }
142}