Enum aws_sdk_backup::model::BackupVaultEvent
source · #[non_exhaustive]
pub enum BackupVaultEvent {
Show 18 variants
BackupJobCompleted,
BackupJobExpired,
BackupJobFailed,
BackupJobStarted,
BackupJobSuccessful,
BackupPlanCreated,
BackupPlanModified,
CopyJobFailed,
CopyJobStarted,
CopyJobSuccessful,
RecoveryPointModified,
RestoreJobCompleted,
RestoreJobFailed,
RestoreJobStarted,
RestoreJobSuccessful,
S3BackupObjectFailed,
S3RestoreObjectFailed,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against BackupVaultEvent
, 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 backupvaultevent = unimplemented!();
match backupvaultevent {
BackupVaultEvent::BackupJobCompleted => { /* ... */ },
BackupVaultEvent::BackupJobExpired => { /* ... */ },
BackupVaultEvent::BackupJobFailed => { /* ... */ },
BackupVaultEvent::BackupJobStarted => { /* ... */ },
BackupVaultEvent::BackupJobSuccessful => { /* ... */ },
BackupVaultEvent::BackupPlanCreated => { /* ... */ },
BackupVaultEvent::BackupPlanModified => { /* ... */ },
BackupVaultEvent::CopyJobFailed => { /* ... */ },
BackupVaultEvent::CopyJobStarted => { /* ... */ },
BackupVaultEvent::CopyJobSuccessful => { /* ... */ },
BackupVaultEvent::RecoveryPointModified => { /* ... */ },
BackupVaultEvent::RestoreJobCompleted => { /* ... */ },
BackupVaultEvent::RestoreJobFailed => { /* ... */ },
BackupVaultEvent::RestoreJobStarted => { /* ... */ },
BackupVaultEvent::RestoreJobSuccessful => { /* ... */ },
BackupVaultEvent::S3BackupObjectFailed => { /* ... */ },
BackupVaultEvent::S3RestoreObjectFailed => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when backupvaultevent
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant BackupVaultEvent::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
BackupVaultEvent::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 BackupVaultEvent::NewFeature
is defined.
Specifically, when backupvaultevent
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on BackupVaultEvent::NewFeature
also yielding "NewFeature"
.
Explicitly matching on the Unknown
variant should
be avoided for two reasons:
- The inner data
UnknownVariantValue
is 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
BackupJobCompleted
BackupJobExpired
BackupJobFailed
BackupJobStarted
BackupJobSuccessful
BackupPlanCreated
BackupPlanModified
CopyJobFailed
CopyJobStarted
CopyJobSuccessful
RecoveryPointModified
RestoreJobCompleted
RestoreJobFailed
RestoreJobStarted
RestoreJobSuccessful
S3BackupObjectFailed
S3RestoreObjectFailed
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl BackupVaultEvent
impl BackupVaultEvent
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
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
pub fn serialize_structure_crate_input_put_backup_vault_notifications_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::PutBackupVaultNotificationsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_44) = &input.backup_vault_events {
let mut array_45 = object.key("BackupVaultEvents").start_array();
for item_46 in var_44 {
{
array_45.value().string(item_46.as_str());
}
}
array_45.finish();
}
if let Some(var_47) = &input.sns_topic_arn {
object.key("SNSTopicArn").string(var_47.as_str());
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for BackupVaultEvent
impl AsRef<str> for BackupVaultEvent
source§impl Clone for BackupVaultEvent
impl Clone for BackupVaultEvent
source§fn clone(&self) -> BackupVaultEvent
fn clone(&self) -> BackupVaultEvent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BackupVaultEvent
impl Debug for BackupVaultEvent
source§impl From<&str> for BackupVaultEvent
impl From<&str> for BackupVaultEvent
source§impl FromStr for BackupVaultEvent
impl FromStr for BackupVaultEvent
source§impl Hash for BackupVaultEvent
impl Hash for BackupVaultEvent
source§impl Ord for BackupVaultEvent
impl Ord for BackupVaultEvent
source§fn cmp(&self, other: &BackupVaultEvent) -> Ordering
fn cmp(&self, other: &BackupVaultEvent) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<BackupVaultEvent> for BackupVaultEvent
impl PartialEq<BackupVaultEvent> for BackupVaultEvent
source§fn eq(&self, other: &BackupVaultEvent) -> bool
fn eq(&self, other: &BackupVaultEvent) -> bool
source§impl PartialOrd<BackupVaultEvent> for BackupVaultEvent
impl PartialOrd<BackupVaultEvent> for BackupVaultEvent
source§fn partial_cmp(&self, other: &BackupVaultEvent) -> Option<Ordering>
fn partial_cmp(&self, other: &BackupVaultEvent) -> 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 BackupVaultEvent
impl StructuralEq for BackupVaultEvent
impl StructuralPartialEq for BackupVaultEvent
Auto Trait Implementations§
impl RefUnwindSafe for BackupVaultEvent
impl Send for BackupVaultEvent
impl Sync for BackupVaultEvent
impl Unpin for BackupVaultEvent
impl UnwindSafe for BackupVaultEvent
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.