Skip to main content

aws_sdk_appstream/types/
_stack_attribute.rs

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