aws_sdk_nimble/types/
_streaming_session_status_code.rs

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