aws_sdk_eksauth/
error_meta.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// All possible error types for this service.
3#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6    /// <p>You don't have permissions to perform the requested operation. The IAM principal making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access management</a> in the <i>IAM User Guide</i>.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>The specified Kubernetes service account token is expired.</p>
9    ExpiredTokenException(crate::types::error::ExpiredTokenException),
10    /// <p>These errors are usually caused by a server-side issue.</p>
11    InternalServerException(crate::types::error::InternalServerException),
12    /// <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
13    InvalidParameterException(crate::types::error::InvalidParameterException),
14    /// <p>This exception is thrown if the request contains a semantic error. The precise meaning will depend on the API, and will be documented in the error message.</p>
15    InvalidRequestException(crate::types::error::InvalidRequestException),
16    /// <p>The specified Kubernetes service account token is invalid.</p>
17    InvalidTokenException(crate::types::error::InvalidTokenException),
18    /// <p>The specified resource could not be found.</p>
19    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
20    /// <p>The service is unavailable. Back off and retry the operation.</p>
21    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
22    /// <p>The request was denied because your request rate is too high. Reduce the frequency of requests.</p>
23    ThrottlingException(crate::types::error::ThrottlingException),
24    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
25    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
26    variable wildcard pattern and check `.code()`:
27     \
28    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
29     \
30    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
31    Unhandled(crate::error::sealed_unhandled::Unhandled),
32}
33impl ::std::fmt::Display for Error {
34    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35        match self {
36            Error::AccessDeniedException(inner) => inner.fmt(f),
37            Error::ExpiredTokenException(inner) => inner.fmt(f),
38            Error::InternalServerException(inner) => inner.fmt(f),
39            Error::InvalidParameterException(inner) => inner.fmt(f),
40            Error::InvalidRequestException(inner) => inner.fmt(f),
41            Error::InvalidTokenException(inner) => inner.fmt(f),
42            Error::ResourceNotFoundException(inner) => inner.fmt(f),
43            Error::ServiceUnavailableException(inner) => inner.fmt(f),
44            Error::ThrottlingException(inner) => inner.fmt(f),
45            Error::Unhandled(_) => {
46                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
47                    write!(f, "unhandled error ({code})")
48                } else {
49                    f.write_str("unhandled error")
50                }
51            }
52        }
53    }
54}
55impl From<::aws_smithy_types::error::operation::BuildError> for Error {
56    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
57        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
58            source: value.into(),
59            meta: ::std::default::Default::default(),
60        })
61    }
62}
63impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
64    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
65        match self {
66            Self::AccessDeniedException(inner) => inner.meta(),
67            Self::ExpiredTokenException(inner) => inner.meta(),
68            Self::InternalServerException(inner) => inner.meta(),
69            Self::InvalidParameterException(inner) => inner.meta(),
70            Self::InvalidRequestException(inner) => inner.meta(),
71            Self::InvalidTokenException(inner) => inner.meta(),
72            Self::ResourceNotFoundException(inner) => inner.meta(),
73            Self::ServiceUnavailableException(inner) => inner.meta(),
74            Self::ThrottlingException(inner) => inner.meta(),
75            Self::Unhandled(inner) => &inner.meta,
76        }
77    }
78}
79impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError, R>>
80    for Error
81where
82    R: Send + Sync + std::fmt::Debug + 'static,
83{
84    fn from(
85        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError, R>,
86    ) -> Self {
87        match err {
88            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
89            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
90                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
91                source: err.into(),
92            }),
93        }
94    }
95}
96impl From<crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError> for Error {
97    fn from(err: crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError) -> Self {
98        match err {
99            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::AccessDeniedException(inner) => {
100                Error::AccessDeniedException(inner)
101            }
102            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::ExpiredTokenException(inner) => {
103                Error::ExpiredTokenException(inner)
104            }
105            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::InternalServerException(inner) => {
106                Error::InternalServerException(inner)
107            }
108            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::InvalidParameterException(inner) => {
109                Error::InvalidParameterException(inner)
110            }
111            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::InvalidRequestException(inner) => {
112                Error::InvalidRequestException(inner)
113            }
114            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::InvalidTokenException(inner) => {
115                Error::InvalidTokenException(inner)
116            }
117            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::ResourceNotFoundException(inner) => {
118                Error::ResourceNotFoundException(inner)
119            }
120            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::ServiceUnavailableException(inner) => {
121                Error::ServiceUnavailableException(inner)
122            }
123            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::ThrottlingException(inner) => {
124                Error::ThrottlingException(inner)
125            }
126            crate::operation::assume_role_for_pod_identity::AssumeRoleForPodIdentityError::Unhandled(inner) => Error::Unhandled(inner),
127        }
128    }
129}
130impl ::std::error::Error for Error {
131    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
132        match self {
133            Error::AccessDeniedException(inner) => inner.source(),
134            Error::ExpiredTokenException(inner) => inner.source(),
135            Error::InternalServerException(inner) => inner.source(),
136            Error::InvalidParameterException(inner) => inner.source(),
137            Error::InvalidRequestException(inner) => inner.source(),
138            Error::InvalidTokenException(inner) => inner.source(),
139            Error::ResourceNotFoundException(inner) => inner.source(),
140            Error::ServiceUnavailableException(inner) => inner.source(),
141            Error::ThrottlingException(inner) => inner.source(),
142            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
143        }
144    }
145}
146impl ::aws_types::request_id::RequestId for Error {
147    fn request_id(&self) -> Option<&str> {
148        match self {
149            Self::AccessDeniedException(e) => e.request_id(),
150            Self::ExpiredTokenException(e) => e.request_id(),
151            Self::InternalServerException(e) => e.request_id(),
152            Self::InvalidParameterException(e) => e.request_id(),
153            Self::InvalidRequestException(e) => e.request_id(),
154            Self::InvalidTokenException(e) => e.request_id(),
155            Self::ResourceNotFoundException(e) => e.request_id(),
156            Self::ServiceUnavailableException(e) => e.request_id(),
157            Self::ThrottlingException(e) => e.request_id(),
158            Self::Unhandled(e) => e.meta.request_id(),
159        }
160    }
161}