aws-sdk-s3outposts 1.51.0

AWS SDK for Amazon S3 on Outposts
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>Access was denied for this action.</p>
    AccessDeniedException(crate::types::error::AccessDeniedException),
    /// <p>There was a conflict with this action, and it could not be completed.</p>
    ConflictException(crate::types::error::ConflictException),
    /// <p>There was an exception with the internal server.</p>
    InternalServerException(crate::types::error::InternalServerException),
    /// <p>The service link connection to your Outposts home Region is down. Check your connection and try again.</p>
    OutpostOfflineException(crate::types::error::OutpostOfflineException),
    /// <p>The requested resource was not found.</p>
    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
    /// <p>The request was denied due to request throttling.</p>
    ThrottlingException(crate::types::error::ThrottlingException),
    /// <p>There was an exception validating this data.</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::ConflictException(inner) => inner.fmt(f),
            Error::InternalServerException(inner) => inner.fmt(f),
            Error::OutpostOfflineException(inner) => inner.fmt(f),
            Error::ResourceNotFoundException(inner) => inner.fmt(f),
            Error::ThrottlingException(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::ConflictException(inner) => inner.meta(),
            Self::InternalServerException(inner) => inner.meta(),
            Self::OutpostOfflineException(inner) => inner.meta(),
            Self::ResourceNotFoundException(inner) => inner.meta(),
            Self::ThrottlingException(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::create_endpoint::CreateEndpointError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_endpoint::CreateEndpointError, 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::create_endpoint::CreateEndpointError> for Error {
    fn from(err: crate::operation::create_endpoint::CreateEndpointError) -> Self {
        match err {
            crate::operation::create_endpoint::CreateEndpointError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::create_endpoint::CreateEndpointError::ConflictException(inner) => Error::ConflictException(inner),
            crate::operation::create_endpoint::CreateEndpointError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::create_endpoint::CreateEndpointError::OutpostOfflineException(inner) => Error::OutpostOfflineException(inner),
            crate::operation::create_endpoint::CreateEndpointError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
            crate::operation::create_endpoint::CreateEndpointError::ThrottlingException(inner) => Error::ThrottlingException(inner),
            crate::operation::create_endpoint::CreateEndpointError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::create_endpoint::CreateEndpointError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_endpoint::DeleteEndpointError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_endpoint::DeleteEndpointError, 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::delete_endpoint::DeleteEndpointError> for Error {
    fn from(err: crate::operation::delete_endpoint::DeleteEndpointError) -> Self {
        match err {
            crate::operation::delete_endpoint::DeleteEndpointError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::delete_endpoint::DeleteEndpointError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::delete_endpoint::DeleteEndpointError::OutpostOfflineException(inner) => Error::OutpostOfflineException(inner),
            crate::operation::delete_endpoint::DeleteEndpointError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
            crate::operation::delete_endpoint::DeleteEndpointError::ThrottlingException(inner) => Error::ThrottlingException(inner),
            crate::operation::delete_endpoint::DeleteEndpointError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::delete_endpoint::DeleteEndpointError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_endpoints::ListEndpointsError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_endpoints::ListEndpointsError, 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_endpoints::ListEndpointsError> for Error {
    fn from(err: crate::operation::list_endpoints::ListEndpointsError) -> Self {
        match err {
            crate::operation::list_endpoints::ListEndpointsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::list_endpoints::ListEndpointsError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::list_endpoints::ListEndpointsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
            crate::operation::list_endpoints::ListEndpointsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
            crate::operation::list_endpoints::ListEndpointsError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::list_endpoints::ListEndpointsError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error, 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_outposts_with_s3::ListOutpostsWithS3Error> for Error {
    fn from(err: crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error) -> Self {
        match err {
            crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::ThrottlingException(inner) => Error::ThrottlingException(inner),
            crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_shared_endpoints::ListSharedEndpointsError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_shared_endpoints::ListSharedEndpointsError, 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_shared_endpoints::ListSharedEndpointsError> for Error {
    fn from(err: crate::operation::list_shared_endpoints::ListSharedEndpointsError) -> Self {
        match err {
            crate::operation::list_shared_endpoints::ListSharedEndpointsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::list_shared_endpoints::ListSharedEndpointsError::InternalServerException(inner) => {
                Error::InternalServerException(inner)
            }
            crate::operation::list_shared_endpoints::ListSharedEndpointsError::ResourceNotFoundException(inner) => {
                Error::ResourceNotFoundException(inner)
            }
            crate::operation::list_shared_endpoints::ListSharedEndpointsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
            crate::operation::list_shared_endpoints::ListSharedEndpointsError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::list_shared_endpoints::ListSharedEndpointsError::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::ConflictException(inner) => inner.source(),
            Error::InternalServerException(inner) => inner.source(),
            Error::OutpostOfflineException(inner) => inner.source(),
            Error::ResourceNotFoundException(inner) => inner.source(),
            Error::ThrottlingException(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::ConflictException(e) => e.request_id(),
            Self::InternalServerException(e) => e.request_id(),
            Self::OutpostOfflineException(e) => e.request_id(),
            Self::ResourceNotFoundException(e) => e.request_id(),
            Self::ThrottlingException(e) => e.request_id(),
            Self::ValidationException(e) => e.request_id(),
            Self::Unhandled(e) => e.meta.request_id(),
        }
    }
}