aws_sdk_sms/types/
_app_replication_status.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// When writing a match expression against `AppReplicationStatus`, 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 appreplicationstatus = unimplemented!();
14/// match appreplicationstatus {
15///     AppReplicationStatus::ConfigurationInvalid => { /* ... */ },
16///     AppReplicationStatus::ConfigurationInProgress => { /* ... */ },
17///     AppReplicationStatus::DeltaReplicated => { /* ... */ },
18///     AppReplicationStatus::DeltaReplicationFailed => { /* ... */ },
19///     AppReplicationStatus::DeltaReplicationInProgress => { /* ... */ },
20///     AppReplicationStatus::PartiallyReplicated => { /* ... */ },
21///     AppReplicationStatus::ReadyForConfiguration => { /* ... */ },
22///     AppReplicationStatus::ReadyForReplication => { /* ... */ },
23///     AppReplicationStatus::Replicated => { /* ... */ },
24///     AppReplicationStatus::ReplicationFailed => { /* ... */ },
25///     AppReplicationStatus::ReplicationInProgress => { /* ... */ },
26///     AppReplicationStatus::ReplicationPending => { /* ... */ },
27///     AppReplicationStatus::ReplicationStopped => { /* ... */ },
28///     AppReplicationStatus::ReplicationStopping => { /* ... */ },
29///     AppReplicationStatus::ReplicationStopFailed => { /* ... */ },
30///     AppReplicationStatus::ValidationInProgress => { /* ... */ },
31///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
32///     _ => { /* ... */ },
33/// }
34/// ```
35/// The above code demonstrates that when `appreplicationstatus` represents
36/// `NewFeature`, the execution path will lead to the second last match arm,
37/// even though the enum does not contain a variant `AppReplicationStatus::NewFeature`
38/// in the current version of SDK. The reason is that the variable `other`,
39/// created by the `@` operator, is bound to
40/// `AppReplicationStatus::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 `AppReplicationStatus::NewFeature` is defined.
44/// Specifically, when `appreplicationstatus` represents `NewFeature`,
45/// the execution path will hit the second last match arm as before by virtue of
46/// calling `as_str` on `AppReplicationStatus::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///
53#[allow(missing_docs)] // documentation missing in model
54#[non_exhaustive]
55#[derive(
56    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
57)]
58pub enum AppReplicationStatus {
59    #[allow(missing_docs)] // documentation missing in model
60    ConfigurationInvalid,
61    #[allow(missing_docs)] // documentation missing in model
62    ConfigurationInProgress,
63    #[allow(missing_docs)] // documentation missing in model
64    DeltaReplicated,
65    #[allow(missing_docs)] // documentation missing in model
66    DeltaReplicationFailed,
67    #[allow(missing_docs)] // documentation missing in model
68    DeltaReplicationInProgress,
69    #[allow(missing_docs)] // documentation missing in model
70    PartiallyReplicated,
71    #[allow(missing_docs)] // documentation missing in model
72    ReadyForConfiguration,
73    #[allow(missing_docs)] // documentation missing in model
74    ReadyForReplication,
75    #[allow(missing_docs)] // documentation missing in model
76    Replicated,
77    #[allow(missing_docs)] // documentation missing in model
78    ReplicationFailed,
79    #[allow(missing_docs)] // documentation missing in model
80    ReplicationInProgress,
81    #[allow(missing_docs)] // documentation missing in model
82    ReplicationPending,
83    #[allow(missing_docs)] // documentation missing in model
84    ReplicationStopped,
85    #[allow(missing_docs)] // documentation missing in model
86    ReplicationStopping,
87    #[allow(missing_docs)] // documentation missing in model
88    ReplicationStopFailed,
89    #[allow(missing_docs)] // documentation missing in model
90    ValidationInProgress,
91    /// `Unknown` contains new variants that have been added since this code was generated.
92    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
93    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
94}
95impl ::std::convert::From<&str> for AppReplicationStatus {
96    fn from(s: &str) -> Self {
97        match s {
98            "CONFIGURATION_INVALID" => AppReplicationStatus::ConfigurationInvalid,
99            "CONFIGURATION_IN_PROGRESS" => AppReplicationStatus::ConfigurationInProgress,
100            "DELTA_REPLICATED" => AppReplicationStatus::DeltaReplicated,
101            "DELTA_REPLICATION_FAILED" => AppReplicationStatus::DeltaReplicationFailed,
102            "DELTA_REPLICATION_IN_PROGRESS" => AppReplicationStatus::DeltaReplicationInProgress,
103            "PARTIALLY_REPLICATED" => AppReplicationStatus::PartiallyReplicated,
104            "READY_FOR_CONFIGURATION" => AppReplicationStatus::ReadyForConfiguration,
105            "READY_FOR_REPLICATION" => AppReplicationStatus::ReadyForReplication,
106            "REPLICATED" => AppReplicationStatus::Replicated,
107            "REPLICATION_FAILED" => AppReplicationStatus::ReplicationFailed,
108            "REPLICATION_IN_PROGRESS" => AppReplicationStatus::ReplicationInProgress,
109            "REPLICATION_PENDING" => AppReplicationStatus::ReplicationPending,
110            "REPLICATION_STOPPED" => AppReplicationStatus::ReplicationStopped,
111            "REPLICATION_STOPPING" => AppReplicationStatus::ReplicationStopping,
112            "REPLICATION_STOP_FAILED" => AppReplicationStatus::ReplicationStopFailed,
113            "VALIDATION_IN_PROGRESS" => AppReplicationStatus::ValidationInProgress,
114            other => AppReplicationStatus::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
115        }
116    }
117}
118impl ::std::str::FromStr for AppReplicationStatus {
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(AppReplicationStatus::from(s))
123    }
124}
125impl AppReplicationStatus {
126    /// Returns the `&str` value of the enum member.
127    pub fn as_str(&self) -> &str {
128        match self {
129            AppReplicationStatus::ConfigurationInvalid => "CONFIGURATION_INVALID",
130            AppReplicationStatus::ConfigurationInProgress => "CONFIGURATION_IN_PROGRESS",
131            AppReplicationStatus::DeltaReplicated => "DELTA_REPLICATED",
132            AppReplicationStatus::DeltaReplicationFailed => "DELTA_REPLICATION_FAILED",
133            AppReplicationStatus::DeltaReplicationInProgress => "DELTA_REPLICATION_IN_PROGRESS",
134            AppReplicationStatus::PartiallyReplicated => "PARTIALLY_REPLICATED",
135            AppReplicationStatus::ReadyForConfiguration => "READY_FOR_CONFIGURATION",
136            AppReplicationStatus::ReadyForReplication => "READY_FOR_REPLICATION",
137            AppReplicationStatus::Replicated => "REPLICATED",
138            AppReplicationStatus::ReplicationFailed => "REPLICATION_FAILED",
139            AppReplicationStatus::ReplicationInProgress => "REPLICATION_IN_PROGRESS",
140            AppReplicationStatus::ReplicationPending => "REPLICATION_PENDING",
141            AppReplicationStatus::ReplicationStopped => "REPLICATION_STOPPED",
142            AppReplicationStatus::ReplicationStopping => "REPLICATION_STOPPING",
143            AppReplicationStatus::ReplicationStopFailed => "REPLICATION_STOP_FAILED",
144            AppReplicationStatus::ValidationInProgress => "VALIDATION_IN_PROGRESS",
145            AppReplicationStatus::Unknown(value) => value.as_str(),
146        }
147    }
148    /// Returns all the `&str` representations of the enum members.
149    pub const fn values() -> &'static [&'static str] {
150        &[
151            "CONFIGURATION_INVALID",
152            "CONFIGURATION_IN_PROGRESS",
153            "DELTA_REPLICATED",
154            "DELTA_REPLICATION_FAILED",
155            "DELTA_REPLICATION_IN_PROGRESS",
156            "PARTIALLY_REPLICATED",
157            "READY_FOR_CONFIGURATION",
158            "READY_FOR_REPLICATION",
159            "REPLICATED",
160            "REPLICATION_FAILED",
161            "REPLICATION_IN_PROGRESS",
162            "REPLICATION_PENDING",
163            "REPLICATION_STOPPED",
164            "REPLICATION_STOPPING",
165            "REPLICATION_STOP_FAILED",
166            "VALIDATION_IN_PROGRESS",
167        ]
168    }
169}
170impl ::std::convert::AsRef<str> for AppReplicationStatus {
171    fn as_ref(&self) -> &str {
172        self.as_str()
173    }
174}
175impl AppReplicationStatus {
176    /// Parses the enum value while disallowing unknown variants.
177    ///
178    /// Unknown variants will result in an error.
179    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
180        match Self::from(value) {
181            #[allow(deprecated)]
182            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
183            known => Ok(known),
184        }
185    }
186}
187impl ::std::fmt::Display for AppReplicationStatus {
188    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
189        match self {
190            AppReplicationStatus::ConfigurationInvalid => write!(f, "CONFIGURATION_INVALID"),
191            AppReplicationStatus::ConfigurationInProgress => write!(f, "CONFIGURATION_IN_PROGRESS"),
192            AppReplicationStatus::DeltaReplicated => write!(f, "DELTA_REPLICATED"),
193            AppReplicationStatus::DeltaReplicationFailed => write!(f, "DELTA_REPLICATION_FAILED"),
194            AppReplicationStatus::DeltaReplicationInProgress => write!(f, "DELTA_REPLICATION_IN_PROGRESS"),
195            AppReplicationStatus::PartiallyReplicated => write!(f, "PARTIALLY_REPLICATED"),
196            AppReplicationStatus::ReadyForConfiguration => write!(f, "READY_FOR_CONFIGURATION"),
197            AppReplicationStatus::ReadyForReplication => write!(f, "READY_FOR_REPLICATION"),
198            AppReplicationStatus::Replicated => write!(f, "REPLICATED"),
199            AppReplicationStatus::ReplicationFailed => write!(f, "REPLICATION_FAILED"),
200            AppReplicationStatus::ReplicationInProgress => write!(f, "REPLICATION_IN_PROGRESS"),
201            AppReplicationStatus::ReplicationPending => write!(f, "REPLICATION_PENDING"),
202            AppReplicationStatus::ReplicationStopped => write!(f, "REPLICATION_STOPPED"),
203            AppReplicationStatus::ReplicationStopping => write!(f, "REPLICATION_STOPPING"),
204            AppReplicationStatus::ReplicationStopFailed => write!(f, "REPLICATION_STOP_FAILED"),
205            AppReplicationStatus::ValidationInProgress => write!(f, "VALIDATION_IN_PROGRESS"),
206            AppReplicationStatus::Unknown(value) => write!(f, "{}", value),
207        }
208    }
209}