Enum aws_sdk_cloudformation::model::StackStatus
source · #[non_exhaustive]
pub enum StackStatus {
Show 24 variants
CreateComplete,
CreateFailed,
CreateInProgress,
DeleteComplete,
DeleteFailed,
DeleteInProgress,
ImportComplete,
ImportInProgress,
ImportRollbackComplete,
ImportRollbackFailed,
ImportRollbackInProgress,
ReviewInProgress,
RollbackComplete,
RollbackFailed,
RollbackInProgress,
UpdateComplete,
UpdateCompleteCleanupInProgress,
UpdateFailed,
UpdateInProgress,
UpdateRollbackComplete,
UpdateRollbackCompleteCleanupInProgress,
UpdateRollbackFailed,
UpdateRollbackInProgress,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against StackStatus, it is important to ensure
your code is forward-compatible. That is, if a match arm handles a case for a
feature that is supported by the service but has not been represented as an enum
variant in a current version of SDK, your code should continue to work when you
upgrade SDK to a future version in which the enum does include a variant for that
feature.
Here is an example of how you can make a match expression forward-compatible:
# let stackstatus = unimplemented!();
match stackstatus {
StackStatus::CreateComplete => { /* ... */ },
StackStatus::CreateFailed => { /* ... */ },
StackStatus::CreateInProgress => { /* ... */ },
StackStatus::DeleteComplete => { /* ... */ },
StackStatus::DeleteFailed => { /* ... */ },
StackStatus::DeleteInProgress => { /* ... */ },
StackStatus::ImportComplete => { /* ... */ },
StackStatus::ImportInProgress => { /* ... */ },
StackStatus::ImportRollbackComplete => { /* ... */ },
StackStatus::ImportRollbackFailed => { /* ... */ },
StackStatus::ImportRollbackInProgress => { /* ... */ },
StackStatus::ReviewInProgress => { /* ... */ },
StackStatus::RollbackComplete => { /* ... */ },
StackStatus::RollbackFailed => { /* ... */ },
StackStatus::RollbackInProgress => { /* ... */ },
StackStatus::UpdateComplete => { /* ... */ },
StackStatus::UpdateCompleteCleanupInProgress => { /* ... */ },
StackStatus::UpdateFailed => { /* ... */ },
StackStatus::UpdateInProgress => { /* ... */ },
StackStatus::UpdateRollbackComplete => { /* ... */ },
StackStatus::UpdateRollbackCompleteCleanupInProgress => { /* ... */ },
StackStatus::UpdateRollbackFailed => { /* ... */ },
StackStatus::UpdateRollbackInProgress => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when stackstatus represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant StackStatus::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
StackStatus::Unknown(UnknownVariantValue("NewFeature".to_owned()))
and calling as_str on it yields "NewFeature".
This match expression is forward-compatible when executed with a newer
version of SDK where the variant StackStatus::NewFeature is defined.
Specifically, when stackstatus represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on StackStatus::NewFeature also yielding "NewFeature".
Explicitly matching on the Unknown variant should
be avoided for two reasons:
- The inner data
UnknownVariantValueis opaque, and no further information can be extracted. - It might inadvertently shadow other intended match arms.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
CreateComplete
CreateFailed
CreateInProgress
DeleteComplete
DeleteFailed
DeleteInProgress
ImportComplete
ImportInProgress
ImportRollbackComplete
ImportRollbackFailed
ImportRollbackInProgress
ReviewInProgress
RollbackComplete
RollbackFailed
RollbackInProgress
UpdateComplete
UpdateCompleteCleanupInProgress
UpdateFailed
UpdateInProgress
UpdateRollbackComplete
UpdateRollbackCompleteCleanupInProgress
UpdateRollbackFailed
UpdateRollbackInProgress
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl StackStatus
impl StackStatus
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the &str value of the enum member.
Examples found in repository?
More examples
1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587
pub fn serialize_operation_crate_operation_list_stacks(
input: &crate::input::ListStacksInput,
) -> Result<aws_smithy_http::body::SdkBody, aws_smithy_http::operation::error::SerializationError> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = aws_smithy_query::QueryWriter::new(&mut out, "ListStacks", "2010-05-15");
#[allow(unused_mut)]
let mut scope_446 = writer.prefix("NextToken");
if let Some(var_447) = &input.next_token {
scope_446.string(var_447);
}
#[allow(unused_mut)]
let mut scope_448 = writer.prefix("StackStatusFilter");
if let Some(var_449) = &input.stack_status_filter {
let mut list_451 = scope_448.start_list(false, None);
for item_450 in var_449 {
#[allow(unused_mut)]
let mut entry_452 = list_451.entry();
entry_452.string(item_450.as_str());
}
list_451.finish();
}
writer.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}Trait Implementations§
source§impl AsRef<str> for StackStatus
impl AsRef<str> for StackStatus
source§impl Clone for StackStatus
impl Clone for StackStatus
source§fn clone(&self) -> StackStatus
fn clone(&self) -> StackStatus
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for StackStatus
impl Debug for StackStatus
source§impl From<&str> for StackStatus
impl From<&str> for StackStatus
source§impl FromStr for StackStatus
impl FromStr for StackStatus
source§impl Hash for StackStatus
impl Hash for StackStatus
source§impl Ord for StackStatus
impl Ord for StackStatus
source§fn cmp(&self, other: &StackStatus) -> Ordering
fn cmp(&self, other: &StackStatus) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<StackStatus> for StackStatus
impl PartialEq<StackStatus> for StackStatus
source§fn eq(&self, other: &StackStatus) -> bool
fn eq(&self, other: &StackStatus) -> bool
source§impl PartialOrd<StackStatus> for StackStatus
impl PartialOrd<StackStatus> for StackStatus
source§fn partial_cmp(&self, other: &StackStatus) -> Option<Ordering>
fn partial_cmp(&self, other: &StackStatus) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Eq for StackStatus
impl StructuralEq for StackStatus
impl StructuralPartialEq for StackStatus
Auto Trait Implementations§
impl RefUnwindSafe for StackStatus
impl Send for StackStatus
impl Sync for StackStatus
impl Unpin for StackStatus
impl UnwindSafe for StackStatus
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.