Enum aws_sdk_storagegateway::model::ErrorCode
source · #[non_exhaustive]
pub enum ErrorCode {
Show 63 variants
ActivationKeyExpired,
ActivationKeyInvalid,
ActivationKeyNotFound,
AuthenticationFailure,
BandwidthThrottleScheduleNotFound,
Blocked,
CannotExportSnapshot,
ChapCredentialNotFound,
DiskAlreadyAllocated,
DiskDoesNotExist,
DiskSizeGreaterThanVolumeMaxSize,
DiskSizeLessThanVolumeSize,
DiskSizeNotGigAligned,
DuplicateCertificateInfo,
DuplicateSchedule,
EndpointNotFound,
GatewayInternalError,
GatewayNotConnected,
GatewayNotFound,
GatewayProxyNetworkConnectionBusy,
IamNotSupported,
InitiatorInvalid,
InitiatorNotFound,
InternalError,
InvalidEndpoint,
InvalidGateway,
InvalidParameters,
InvalidSchedule,
JoinDomainInProgress,
LocalStorageLimitExceeded,
LunAlreadyAllocated,
LunInvalid,
MaximumContentLengthExceeded,
MaximumTapeCartridgeCountExceeded,
MaximumVolumeCountExceeded,
NetworkConfigurationChanged,
NoDisksAvailable,
NotImplemented,
NotSupported,
OperationAborted,
OutdatedGateway,
ParametersNotImplemented,
RegionInvalid,
RequestTimeout,
ServiceUnavailable,
SnapshotDeleted,
SnapshotIdInvalid,
SnapshotInProgress,
SnapshotNotFound,
SnapshotScheduleNotFound,
StagingAreaFull,
StorageFailure,
TapeCartridgeNotFound,
TargetAlreadyExists,
TargetInvalid,
TargetNotFound,
UnauthorizedOperation,
VolumeAlreadyExists,
VolumeIdInvalid,
VolumeInUse,
VolumeNotFound,
VolumeNotReady,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against ErrorCode
, 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 errorcode = unimplemented!();
match errorcode {
ErrorCode::ActivationKeyExpired => { /* ... */ },
ErrorCode::ActivationKeyInvalid => { /* ... */ },
ErrorCode::ActivationKeyNotFound => { /* ... */ },
ErrorCode::AuthenticationFailure => { /* ... */ },
ErrorCode::BandwidthThrottleScheduleNotFound => { /* ... */ },
ErrorCode::Blocked => { /* ... */ },
ErrorCode::CannotExportSnapshot => { /* ... */ },
ErrorCode::ChapCredentialNotFound => { /* ... */ },
ErrorCode::DiskAlreadyAllocated => { /* ... */ },
ErrorCode::DiskDoesNotExist => { /* ... */ },
ErrorCode::DiskSizeGreaterThanVolumeMaxSize => { /* ... */ },
ErrorCode::DiskSizeLessThanVolumeSize => { /* ... */ },
ErrorCode::DiskSizeNotGigAligned => { /* ... */ },
ErrorCode::DuplicateCertificateInfo => { /* ... */ },
ErrorCode::DuplicateSchedule => { /* ... */ },
ErrorCode::EndpointNotFound => { /* ... */ },
ErrorCode::GatewayInternalError => { /* ... */ },
ErrorCode::GatewayNotConnected => { /* ... */ },
ErrorCode::GatewayNotFound => { /* ... */ },
ErrorCode::GatewayProxyNetworkConnectionBusy => { /* ... */ },
ErrorCode::IamNotSupported => { /* ... */ },
ErrorCode::InitiatorInvalid => { /* ... */ },
ErrorCode::InitiatorNotFound => { /* ... */ },
ErrorCode::InternalError => { /* ... */ },
ErrorCode::InvalidEndpoint => { /* ... */ },
ErrorCode::InvalidGateway => { /* ... */ },
ErrorCode::InvalidParameters => { /* ... */ },
ErrorCode::InvalidSchedule => { /* ... */ },
ErrorCode::JoinDomainInProgress => { /* ... */ },
ErrorCode::LocalStorageLimitExceeded => { /* ... */ },
ErrorCode::LunAlreadyAllocated => { /* ... */ },
ErrorCode::LunInvalid => { /* ... */ },
ErrorCode::MaximumContentLengthExceeded => { /* ... */ },
ErrorCode::MaximumTapeCartridgeCountExceeded => { /* ... */ },
ErrorCode::MaximumVolumeCountExceeded => { /* ... */ },
ErrorCode::NetworkConfigurationChanged => { /* ... */ },
ErrorCode::NoDisksAvailable => { /* ... */ },
ErrorCode::NotImplemented => { /* ... */ },
ErrorCode::NotSupported => { /* ... */ },
ErrorCode::OperationAborted => { /* ... */ },
ErrorCode::OutdatedGateway => { /* ... */ },
ErrorCode::ParametersNotImplemented => { /* ... */ },
ErrorCode::RegionInvalid => { /* ... */ },
ErrorCode::RequestTimeout => { /* ... */ },
ErrorCode::ServiceUnavailable => { /* ... */ },
ErrorCode::SnapshotDeleted => { /* ... */ },
ErrorCode::SnapshotIdInvalid => { /* ... */ },
ErrorCode::SnapshotInProgress => { /* ... */ },
ErrorCode::SnapshotNotFound => { /* ... */ },
ErrorCode::SnapshotScheduleNotFound => { /* ... */ },
ErrorCode::StagingAreaFull => { /* ... */ },
ErrorCode::StorageFailure => { /* ... */ },
ErrorCode::TapeCartridgeNotFound => { /* ... */ },
ErrorCode::TargetAlreadyExists => { /* ... */ },
ErrorCode::TargetInvalid => { /* ... */ },
ErrorCode::TargetNotFound => { /* ... */ },
ErrorCode::UnauthorizedOperation => { /* ... */ },
ErrorCode::VolumeAlreadyExists => { /* ... */ },
ErrorCode::VolumeIdInvalid => { /* ... */ },
ErrorCode::VolumeInUse => { /* ... */ },
ErrorCode::VolumeNotFound => { /* ... */ },
ErrorCode::VolumeNotReady => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when errorcode
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant ErrorCode::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
ErrorCode::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 ErrorCode::NewFeature
is defined.
Specifically, when errorcode
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on ErrorCode::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
ActivationKeyExpired
ActivationKeyInvalid
ActivationKeyNotFound
AuthenticationFailure
BandwidthThrottleScheduleNotFound
Blocked
CannotExportSnapshot
ChapCredentialNotFound
DiskAlreadyAllocated
DiskDoesNotExist
DiskSizeGreaterThanVolumeMaxSize
DiskSizeLessThanVolumeSize
DiskSizeNotGigAligned
DuplicateCertificateInfo
DuplicateSchedule
EndpointNotFound
GatewayInternalError
GatewayNotConnected
GatewayNotFound
GatewayProxyNetworkConnectionBusy
IamNotSupported
InitiatorInvalid
InitiatorNotFound
InternalError
InvalidEndpoint
InvalidGateway
InvalidParameters
InvalidSchedule
JoinDomainInProgress
LocalStorageLimitExceeded
LunAlreadyAllocated
LunInvalid
MaximumContentLengthExceeded
MaximumTapeCartridgeCountExceeded
MaximumVolumeCountExceeded
NetworkConfigurationChanged
NoDisksAvailable
NotImplemented
NotSupported
OperationAborted
OutdatedGateway
ParametersNotImplemented
RegionInvalid
RequestTimeout
SnapshotDeleted
SnapshotIdInvalid
SnapshotInProgress
SnapshotNotFound
SnapshotScheduleNotFound
StagingAreaFull
StorageFailure
TapeCartridgeNotFound
TargetAlreadyExists
TargetInvalid
TargetNotFound
VolumeAlreadyExists
VolumeIdInvalid
VolumeInUse
VolumeNotFound
VolumeNotReady
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
Trait Implementations§
source§impl Ord for ErrorCode
impl Ord for ErrorCode
source§impl PartialEq<ErrorCode> for ErrorCode
impl PartialEq<ErrorCode> for ErrorCode
source§impl PartialOrd<ErrorCode> for ErrorCode
impl PartialOrd<ErrorCode> for ErrorCode
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 ErrorCode
impl StructuralEq for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnwindSafe for ErrorCode
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.