aws-sdk-credentialbroker 1.0.0

AWS SDK for AWS IAM CredentialBroker
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>The caller is not authorized to perform the request, or a resource the request depends on refused access. <code>reason</code> distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.</p>
    AccessDeniedException(crate::types::error::AccessDeniedException),
    /// <p>The request conflicts with the current state of the resource. Nothing was changed. Depending on <code>reason</code>, the request may succeed if retried once the resource reaches a settled state, or it may require different input (for example a name that is not already taken).</p>
    ConflictException(crate::types::error::ConflictException),
    /// <p>The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.</p>
    InternalServerException(crate::types::error::InternalServerException),
    /// <p>The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.</p>
    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
    /// <p>The request would exceed a service quota, so it was rejected and nothing was created or changed. Delete resources that are no longer needed, or request a quota increase in Service Quotas using <code>serviceCode</code> and <code>quotaCode</code>, then retry.</p>
    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
    /// <p>A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, <code>server_error</code>, or <code>temporarily_unavailable</code>). Retryable: the same request may succeed later.</p>
    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
    /// <p>The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring <code>retryAfterSeconds</code> when it is present.</p>
    ThrottlingException(crate::types::error::ThrottlingException),
    /// <p>The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use <code>reason</code> to branch in code and <code>message</code> for the human-readable detail of which field or combination of fields was at fault.</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::ResourceNotFoundException(inner) => inner.fmt(f),
            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
            Error::ServiceUnavailableException(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::ResourceNotFoundException(inner) => inner.meta(),
            Self::ServiceQuotaExceededException(inner) => inner.meta(),
            Self::ServiceUnavailableException(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::complete_o_auth_session_binding::CompleteOAuthSessionBindingError, R>>
    for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(
        err: ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError,
            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_o_auth_session_binding::CompleteOAuthSessionBindingError> for Error {
    fn from(err: crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError) -> Self {
        match err {
            crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError::AccessDeniedException(inner) => {
                Error::AccessDeniedException(inner)
            }
            crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError::ConflictException(inner) => {
                Error::ConflictException(inner)
            }
            crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError::InternalServerException(inner) => {
                Error::InternalServerException(inner)
            }
            crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError::ResourceNotFoundException(inner) => {
                Error::ResourceNotFoundException(inner)
            }
            crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError::ServiceUnavailableException(inner) => {
                Error::ServiceUnavailableException(inner)
            }
            crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError::ThrottlingException(inner) => {
                Error::ThrottlingException(inner)
            }
            crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError::ValidationException(inner) => {
                Error::ValidationException(inner)
            }
            crate::operation::complete_o_auth_session_binding::CompleteOAuthSessionBindingError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_api_key::GetApiKeyError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_api_key::GetApiKeyError, 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_api_key::GetApiKeyError> for Error {
    fn from(err: crate::operation::get_api_key::GetApiKeyError) -> Self {
        match err {
            crate::operation::get_api_key::GetApiKeyError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::get_api_key::GetApiKeyError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::get_api_key::GetApiKeyError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
            crate::operation::get_api_key::GetApiKeyError::ThrottlingException(inner) => Error::ThrottlingException(inner),
            crate::operation::get_api_key::GetApiKeyError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::get_api_key::GetApiKeyError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_o_auth_token::GetOAuthTokenError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_o_auth_token::GetOAuthTokenError, 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_o_auth_token::GetOAuthTokenError> for Error {
    fn from(err: crate::operation::get_o_auth_token::GetOAuthTokenError) -> Self {
        match err {
            crate::operation::get_o_auth_token::GetOAuthTokenError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::get_o_auth_token::GetOAuthTokenError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::get_o_auth_token::GetOAuthTokenError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
            crate::operation::get_o_auth_token::GetOAuthTokenError::ServiceQuotaExceededException(inner) => {
                Error::ServiceQuotaExceededException(inner)
            }
            crate::operation::get_o_auth_token::GetOAuthTokenError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
            crate::operation::get_o_auth_token::GetOAuthTokenError::ThrottlingException(inner) => Error::ThrottlingException(inner),
            crate::operation::get_o_auth_token::GetOAuthTokenError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::get_o_auth_token::GetOAuthTokenError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_o_auth_session::StartOAuthSessionError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_o_auth_session::StartOAuthSessionError, 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_o_auth_session::StartOAuthSessionError> for Error {
    fn from(err: crate::operation::start_o_auth_session::StartOAuthSessionError) -> Self {
        match err {
            crate::operation::start_o_auth_session::StartOAuthSessionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
            crate::operation::start_o_auth_session::StartOAuthSessionError::InternalServerException(inner) => Error::InternalServerException(inner),
            crate::operation::start_o_auth_session::StartOAuthSessionError::ResourceNotFoundException(inner) => {
                Error::ResourceNotFoundException(inner)
            }
            crate::operation::start_o_auth_session::StartOAuthSessionError::ServiceUnavailableException(inner) => {
                Error::ServiceUnavailableException(inner)
            }
            crate::operation::start_o_auth_session::StartOAuthSessionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
            crate::operation::start_o_auth_session::StartOAuthSessionError::ValidationException(inner) => Error::ValidationException(inner),
            crate::operation::start_o_auth_session::StartOAuthSessionError::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::ResourceNotFoundException(inner) => inner.source(),
            Error::ServiceQuotaExceededException(inner) => inner.source(),
            Error::ServiceUnavailableException(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::ResourceNotFoundException(e) => e.request_id(),
            Self::ServiceQuotaExceededException(e) => e.request_id(),
            Self::ServiceUnavailableException(e) => e.request_id(),
            Self::ThrottlingException(e) => e.request_id(),
            Self::ValidationException(e) => e.request_id(),
            Self::Unhandled(e) => e.meta.request_id(),
        }
    }
}