aws-sdk-ebs 1.97.0

AWS SDK for Amazon Elastic Block Store
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// All possible error types for this service.
#[non_exhaustive]
#[derive(::std::fmt::Debug)]
pub enum Error {
    /// <p>You do not have sufficient access to perform this action.</p>
    AccessDeniedException(crate::types::error::AccessDeniedException),
    /// <p>You have reached the limit for concurrent API requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapi-performance">Optimizing performance of the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
    ConcurrentLimitExceededException(crate::types::error::ConcurrentLimitExceededException),
    /// <p>The request uses the same client token as a previous, but non-identical request.</p>
    ConflictException(crate::types::error::ConflictException),
    /// <p>An internal error has occurred. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a>.</p>
    InternalServerException(crate::types::error::InternalServerException),
    /// <p>The number of API requests has exceeded the maximum allowed API request throttling limit for the snapshot. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a>.</p>
    RequestThrottledException(crate::types::error::RequestThrottledException),
    /// <p>The specified resource does not exist.</p>
    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
    /// <p>Your current service quotas do not allow you to perform this action.</p>
    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
    /// <p>The input fails to satisfy the constraints of the EBS direct APIs.</p>
    ValidationException(crate::types::error::ValidationException),
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
    variable wildcard pattern and check `.code()`:
     \
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
     \
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
    Unhandled(crate::error::sealed_unhandled::Unhandled),
}
impl ::std::fmt::Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Error::AccessDeniedException(inner) => inner.fmt(f),
            Error::ConcurrentLimitExceededException(inner) => inner.fmt(f),
            Error::ConflictException(inner) => inner.fmt(f),
            Error::InternalServerException(inner) => inner.fmt(f),
            Error::RequestThrottledException(inner) => inner.fmt(f),
            Error::ResourceNotFoundException(inner) => inner.fmt(f),
            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
            Error::ValidationException(inner) => inner.fmt(f),
            Error::Unhandled(_) => {
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
                    write!(f, "unhandled error ({code})")
                } else {
                    f.write_str("unhandled error")
                }
            }
        }
    }
}
impl From<::aws_smithy_types::error::operation::BuildError> for Error {
    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
            source: value.into(),
            meta: ::std::default::Default::default(),
        })
    }
}
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
        match self {
            Self::AccessDeniedException(inner) => inner.meta(),
            Self::ConcurrentLimitExceededException(inner) => inner.meta(),
            Self::ConflictException(inner) => inner.meta(),
            Self::InternalServerException(inner) => inner.meta(),
            Self::RequestThrottledException(inner) => inner.meta(),
            Self::ResourceNotFoundException(inner) => inner.meta(),
            Self::ServiceQuotaExceededException(inner) => inner.meta(),
            Self::ValidationException(inner) => inner.meta(),
            Self::Unhandled(inner) => &inner.meta,
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::complete_snapshot::CompleteSnapshotError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::complete_snapshot::CompleteSnapshotError, R>) -> Self {
        match err {
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
                source: err.into(),
            }),
        }
    }
}
impl From<crate::operation::complete_snapshot::CompleteSnapshotError> for Error {
    fn from(err: crate::operation::complete_snapshot::CompleteSnapshotError) -> Self {
        match err {
            crate::operation::complete_snapshot::CompleteSnapshotError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::complete_snapshot::CompleteSnapshotError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::complete_snapshot::CompleteSnapshotError::RequestThrottledException(inner) => Error::RequestThrottledException(inner),
            crate::operation::complete_snapshot::CompleteSnapshotError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
            crate::operation::complete_snapshot::CompleteSnapshotError::ServiceQuotaExceededException(inner) => {
                Error::ServiceQuotaExceededException(inner)
            }
            crate::operation::complete_snapshot::CompleteSnapshotError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::complete_snapshot::CompleteSnapshotError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_snapshot_block::GetSnapshotBlockError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_snapshot_block::GetSnapshotBlockError, R>) -> Self {
        match err {
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
                source: err.into(),
            }),
        }
    }
}
impl From<crate::operation::get_snapshot_block::GetSnapshotBlockError> for Error {
    fn from(err: crate::operation::get_snapshot_block::GetSnapshotBlockError) -> Self {
        match err {
            crate::operation::get_snapshot_block::GetSnapshotBlockError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::get_snapshot_block::GetSnapshotBlockError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::get_snapshot_block::GetSnapshotBlockError::RequestThrottledException(inner) => Error::RequestThrottledException(inner),
            crate::operation::get_snapshot_block::GetSnapshotBlockError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
            crate::operation::get_snapshot_block::GetSnapshotBlockError::ServiceQuotaExceededException(inner) => {
                Error::ServiceQuotaExceededException(inner)
            }
            crate::operation::get_snapshot_block::GetSnapshotBlockError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::get_snapshot_block::GetSnapshotBlockError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_changed_blocks::ListChangedBlocksError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_changed_blocks::ListChangedBlocksError, R>) -> Self {
        match err {
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
                source: err.into(),
            }),
        }
    }
}
impl From<crate::operation::list_changed_blocks::ListChangedBlocksError> for Error {
    fn from(err: crate::operation::list_changed_blocks::ListChangedBlocksError) -> Self {
        match err {
            crate::operation::list_changed_blocks::ListChangedBlocksError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::list_changed_blocks::ListChangedBlocksError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::list_changed_blocks::ListChangedBlocksError::RequestThrottledException(inner) => {
                Error::RequestThrottledException(inner)
            }
            crate::operation::list_changed_blocks::ListChangedBlocksError::ResourceNotFoundException(inner) => {
                Error::ResourceNotFoundException(inner)
            }
            crate::operation::list_changed_blocks::ListChangedBlocksError::ServiceQuotaExceededException(inner) => {
                Error::ServiceQuotaExceededException(inner)
            }
            crate::operation::list_changed_blocks::ListChangedBlocksError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::list_changed_blocks::ListChangedBlocksError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_snapshot_blocks::ListSnapshotBlocksError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_snapshot_blocks::ListSnapshotBlocksError, R>) -> Self {
        match err {
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
                source: err.into(),
            }),
        }
    }
}
impl From<crate::operation::list_snapshot_blocks::ListSnapshotBlocksError> for Error {
    fn from(err: crate::operation::list_snapshot_blocks::ListSnapshotBlocksError) -> Self {
        match err {
            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::RequestThrottledException(inner) => {
                Error::RequestThrottledException(inner)
            }
            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::ResourceNotFoundException(inner) => {
                Error::ResourceNotFoundException(inner)
            }
            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::ServiceQuotaExceededException(inner) => {
                Error::ServiceQuotaExceededException(inner)
            }
            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_snapshot_block::PutSnapshotBlockError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_snapshot_block::PutSnapshotBlockError, R>) -> Self {
        match err {
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
                source: err.into(),
            }),
        }
    }
}
impl From<crate::operation::put_snapshot_block::PutSnapshotBlockError> for Error {
    fn from(err: crate::operation::put_snapshot_block::PutSnapshotBlockError) -> Self {
        match err {
            crate::operation::put_snapshot_block::PutSnapshotBlockError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::put_snapshot_block::PutSnapshotBlockError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::put_snapshot_block::PutSnapshotBlockError::RequestThrottledException(inner) => Error::RequestThrottledException(inner),
            crate::operation::put_snapshot_block::PutSnapshotBlockError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
            crate::operation::put_snapshot_block::PutSnapshotBlockError::ServiceQuotaExceededException(inner) => {
                Error::ServiceQuotaExceededException(inner)
            }
            crate::operation::put_snapshot_block::PutSnapshotBlockError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::put_snapshot_block::PutSnapshotBlockError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_snapshot::StartSnapshotError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_snapshot::StartSnapshotError, R>) -> Self {
        match err {
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
                source: err.into(),
            }),
        }
    }
}
impl From<crate::operation::start_snapshot::StartSnapshotError> for Error {
    fn from(err: crate::operation::start_snapshot::StartSnapshotError) -> Self {
        match err {
            crate::operation::start_snapshot::StartSnapshotError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::start_snapshot::StartSnapshotError::ConcurrentLimitExceededException(inner) => {
                Error::ConcurrentLimitExceededException(inner)
            }
            crate::operation::start_snapshot::StartSnapshotError::ConflictException(inner) => Error::ConflictException(inner),
            crate::operation::start_snapshot::StartSnapshotError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::start_snapshot::StartSnapshotError::RequestThrottledException(inner) => Error::RequestThrottledException(inner),
            crate::operation::start_snapshot::StartSnapshotError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
            crate::operation::start_snapshot::StartSnapshotError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
            crate::operation::start_snapshot::StartSnapshotError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::start_snapshot::StartSnapshotError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl ::std::error::Error for Error {
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
        match self {
            Error::AccessDeniedException(inner) => inner.source(),
            Error::ConcurrentLimitExceededException(inner) => inner.source(),
            Error::ConflictException(inner) => inner.source(),
            Error::InternalServerException(inner) => inner.source(),
            Error::RequestThrottledException(inner) => inner.source(),
            Error::ResourceNotFoundException(inner) => inner.source(),
            Error::ServiceQuotaExceededException(inner) => inner.source(),
            Error::ValidationException(inner) => inner.source(),
            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
        }
    }
}
impl ::aws_types::request_id::RequestId for Error {
    fn request_id(&self) -> Option<&str> {
        match self {
            Self::AccessDeniedException(e) => e.request_id(),
            Self::ConcurrentLimitExceededException(e) => e.request_id(),
            Self::ConflictException(e) => e.request_id(),
            Self::InternalServerException(e) => e.request_id(),
            Self::RequestThrottledException(e) => e.request_id(),
            Self::ResourceNotFoundException(e) => e.request_id(),
            Self::ServiceQuotaExceededException(e) => e.request_id(),
            Self::ValidationException(e) => e.request_id(),
            Self::Unhandled(e) => e.meta.request_id(),
        }
    }
}