aws_sdk_sts/
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>The web identity token that was passed is expired or is not valid. Get a new identity token from the identity provider and then retry the request.</p>
7    ExpiredTokenException(crate::types::error::ExpiredTokenException),
8    /// <p>The request could not be fulfilled because the identity provider (IDP) that was asked to verify the incoming identity token could not be reached. This is often a transient error caused by network conditions. Retry the request a limited number of times so that you don't exceed the request rate. If the error persists, the identity provider might be down or not responding.</p>
9    IdpCommunicationErrorException(crate::types::error::IdpCommunicationErrorException),
10    /// <p>The identity provider (IdP) reported that authentication failed. This might be because the claim is invalid.</p>
11    /// <p>If this error is returned for the <code>AssumeRoleWithWebIdentity</code> operation, it can also mean that the claim has expired or has been explicitly revoked.</p>
12    IdpRejectedClaimException(crate::types::error::IdpRejectedClaimException),
13    /// <p>The error returned if the message passed to <code>DecodeAuthorizationMessage</code> was invalid. This can happen if the token contains invalid characters, such as linebreaks.</p>
14    InvalidAuthorizationMessageException(crate::types::error::InvalidAuthorizationMessageException),
15    /// <p>The web identity token that was passed could not be validated by Amazon Web Services. Get a new identity token from the identity provider and then retry the request.</p>
16    InvalidIdentityTokenException(crate::types::error::InvalidIdentityTokenException),
17    /// <p>The request was rejected because the policy document was malformed. The error message describes the specific error.</p>
18    MalformedPolicyDocumentException(crate::types::error::MalformedPolicyDocumentException),
19    /// <p>The request was rejected because the total packed size of the session policies and session tags combined was too large. An Amazon Web Services conversion compresses the session policy document, session policy ARNs, and session tags into a packed binary format that has a separate limit. The error message indicates by percentage how close the policies and tags are to the upper size limit. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p>
20    /// <p>You could receive this error even though you meet other defined session policy and session tag limits. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-limits-entity-length">IAM and STS Entity Character Limits</a> in the <i>IAM User Guide</i>.</p>
21    PackedPolicyTooLargeException(crate::types::error::PackedPolicyTooLargeException),
22    /// <p>STS is not activated in the requested region for the account that is being asked to generate credentials. The account administrator must use the IAM console to activate STS in that region. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region</a> in the <i>IAM User Guide</i>.</p>
23    RegionDisabledException(crate::types::error::RegionDisabledException),
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::ExpiredTokenException(inner) => inner.fmt(f),
37            Error::IdpCommunicationErrorException(inner) => inner.fmt(f),
38            Error::IdpRejectedClaimException(inner) => inner.fmt(f),
39            Error::InvalidAuthorizationMessageException(inner) => inner.fmt(f),
40            Error::InvalidIdentityTokenException(inner) => inner.fmt(f),
41            Error::MalformedPolicyDocumentException(inner) => inner.fmt(f),
42            Error::PackedPolicyTooLargeException(inner) => inner.fmt(f),
43            Error::RegionDisabledException(inner) => inner.fmt(f),
44            Error::Unhandled(_) => {
45                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
46                    write!(f, "unhandled error ({code})")
47                } else {
48                    f.write_str("unhandled error")
49                }
50            }
51        }
52    }
53}
54impl From<::aws_smithy_types::error::operation::BuildError> for Error {
55    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
56        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
57            source: value.into(),
58            meta: ::std::default::Default::default(),
59        })
60    }
61}
62impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
63    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
64        match self {
65            Self::ExpiredTokenException(inner) => inner.meta(),
66            Self::IdpCommunicationErrorException(inner) => inner.meta(),
67            Self::IdpRejectedClaimException(inner) => inner.meta(),
68            Self::InvalidAuthorizationMessageException(inner) => inner.meta(),
69            Self::InvalidIdentityTokenException(inner) => inner.meta(),
70            Self::MalformedPolicyDocumentException(inner) => inner.meta(),
71            Self::PackedPolicyTooLargeException(inner) => inner.meta(),
72            Self::RegionDisabledException(inner) => inner.meta(),
73            Self::Unhandled(inner) => &inner.meta,
74        }
75    }
76}
77impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role::AssumeRoleError, R>> for Error
78where
79    R: Send + Sync + std::fmt::Debug + 'static,
80{
81    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role::AssumeRoleError, R>) -> Self {
82        match err {
83            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
84            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
85                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
86                source: err.into(),
87            }),
88        }
89    }
90}
91impl From<crate::operation::assume_role::AssumeRoleError> for Error {
92    fn from(err: crate::operation::assume_role::AssumeRoleError) -> Self {
93        match err {
94            crate::operation::assume_role::AssumeRoleError::ExpiredTokenException(inner) => Error::ExpiredTokenException(inner),
95            crate::operation::assume_role::AssumeRoleError::MalformedPolicyDocumentException(inner) => Error::MalformedPolicyDocumentException(inner),
96            crate::operation::assume_role::AssumeRoleError::PackedPolicyTooLargeException(inner) => Error::PackedPolicyTooLargeException(inner),
97            crate::operation::assume_role::AssumeRoleError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
98            crate::operation::assume_role::AssumeRoleError::Unhandled(inner) => Error::Unhandled(inner),
99        }
100    }
101}
102impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError, R>> for Error
103where
104    R: Send + Sync + std::fmt::Debug + 'static,
105{
106    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError, R>) -> Self {
107        match err {
108            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
109            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
110                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
111                source: err.into(),
112            }),
113        }
114    }
115}
116impl From<crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError> for Error {
117    fn from(err: crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError) -> Self {
118        match err {
119            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::ExpiredTokenException(inner) => Error::ExpiredTokenException(inner),
120            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::IdpRejectedClaimException(inner) => {
121                Error::IdpRejectedClaimException(inner)
122            }
123            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::InvalidIdentityTokenException(inner) => {
124                Error::InvalidIdentityTokenException(inner)
125            }
126            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::MalformedPolicyDocumentException(inner) => {
127                Error::MalformedPolicyDocumentException(inner)
128            }
129            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::PackedPolicyTooLargeException(inner) => {
130                Error::PackedPolicyTooLargeException(inner)
131            }
132            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
133            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::Unhandled(inner) => Error::Unhandled(inner),
134        }
135    }
136}
137impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError, R>>
138    for Error
139where
140    R: Send + Sync + std::fmt::Debug + 'static,
141{
142    fn from(
143        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError, R>,
144    ) -> Self {
145        match err {
146            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
147            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
148                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
149                source: err.into(),
150            }),
151        }
152    }
153}
154impl From<crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError> for Error {
155    fn from(err: crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError) -> Self {
156        match err {
157            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::ExpiredTokenException(inner) => {
158                Error::ExpiredTokenException(inner)
159            }
160            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::IdpCommunicationErrorException(inner) => {
161                Error::IdpCommunicationErrorException(inner)
162            }
163            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::IdpRejectedClaimException(inner) => {
164                Error::IdpRejectedClaimException(inner)
165            }
166            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::InvalidIdentityTokenException(inner) => {
167                Error::InvalidIdentityTokenException(inner)
168            }
169            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::MalformedPolicyDocumentException(inner) => {
170                Error::MalformedPolicyDocumentException(inner)
171            }
172            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::PackedPolicyTooLargeException(inner) => {
173                Error::PackedPolicyTooLargeException(inner)
174            }
175            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::RegionDisabledException(inner) => {
176                Error::RegionDisabledException(inner)
177            }
178            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::Unhandled(inner) => Error::Unhandled(inner),
179        }
180    }
181}
182impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::decode_authorization_message::DecodeAuthorizationMessageError, R>>
183    for Error
184where
185    R: Send + Sync + std::fmt::Debug + 'static,
186{
187    fn from(
188        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::decode_authorization_message::DecodeAuthorizationMessageError, R>,
189    ) -> Self {
190        match err {
191            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
192            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
193                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
194                source: err.into(),
195            }),
196        }
197    }
198}
199impl From<crate::operation::decode_authorization_message::DecodeAuthorizationMessageError> for Error {
200    fn from(err: crate::operation::decode_authorization_message::DecodeAuthorizationMessageError) -> Self {
201        match err {
202            crate::operation::decode_authorization_message::DecodeAuthorizationMessageError::InvalidAuthorizationMessageException(inner) => {
203                Error::InvalidAuthorizationMessageException(inner)
204            }
205            crate::operation::decode_authorization_message::DecodeAuthorizationMessageError::Unhandled(inner) => Error::Unhandled(inner),
206        }
207    }
208}
209impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_access_key_info::GetAccessKeyInfoError, R>> for Error
210where
211    R: Send + Sync + std::fmt::Debug + 'static,
212{
213    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_access_key_info::GetAccessKeyInfoError, R>) -> Self {
214        match err {
215            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
216            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
217                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
218                source: err.into(),
219            }),
220        }
221    }
222}
223impl From<crate::operation::get_access_key_info::GetAccessKeyInfoError> for Error {
224    fn from(err: crate::operation::get_access_key_info::GetAccessKeyInfoError) -> Self {
225        match err {
226            crate::operation::get_access_key_info::GetAccessKeyInfoError::Unhandled(inner) => Error::Unhandled(inner),
227        }
228    }
229}
230impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_caller_identity::GetCallerIdentityError, R>> for Error
231where
232    R: Send + Sync + std::fmt::Debug + 'static,
233{
234    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_caller_identity::GetCallerIdentityError, R>) -> Self {
235        match err {
236            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
237            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
238                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
239                source: err.into(),
240            }),
241        }
242    }
243}
244impl From<crate::operation::get_caller_identity::GetCallerIdentityError> for Error {
245    fn from(err: crate::operation::get_caller_identity::GetCallerIdentityError) -> Self {
246        match err {
247            crate::operation::get_caller_identity::GetCallerIdentityError::Unhandled(inner) => Error::Unhandled(inner),
248        }
249    }
250}
251impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_federation_token::GetFederationTokenError, R>> for Error
252where
253    R: Send + Sync + std::fmt::Debug + 'static,
254{
255    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_federation_token::GetFederationTokenError, R>) -> Self {
256        match err {
257            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
258            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
259                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
260                source: err.into(),
261            }),
262        }
263    }
264}
265impl From<crate::operation::get_federation_token::GetFederationTokenError> for Error {
266    fn from(err: crate::operation::get_federation_token::GetFederationTokenError) -> Self {
267        match err {
268            crate::operation::get_federation_token::GetFederationTokenError::MalformedPolicyDocumentException(inner) => {
269                Error::MalformedPolicyDocumentException(inner)
270            }
271            crate::operation::get_federation_token::GetFederationTokenError::PackedPolicyTooLargeException(inner) => {
272                Error::PackedPolicyTooLargeException(inner)
273            }
274            crate::operation::get_federation_token::GetFederationTokenError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
275            crate::operation::get_federation_token::GetFederationTokenError::Unhandled(inner) => Error::Unhandled(inner),
276        }
277    }
278}
279impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_session_token::GetSessionTokenError, R>> for Error
280where
281    R: Send + Sync + std::fmt::Debug + 'static,
282{
283    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_session_token::GetSessionTokenError, R>) -> Self {
284        match err {
285            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
286            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
287                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
288                source: err.into(),
289            }),
290        }
291    }
292}
293impl From<crate::operation::get_session_token::GetSessionTokenError> for Error {
294    fn from(err: crate::operation::get_session_token::GetSessionTokenError) -> Self {
295        match err {
296            crate::operation::get_session_token::GetSessionTokenError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
297            crate::operation::get_session_token::GetSessionTokenError::Unhandled(inner) => Error::Unhandled(inner),
298        }
299    }
300}
301impl ::std::error::Error for Error {
302    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
303        match self {
304            Error::ExpiredTokenException(inner) => inner.source(),
305            Error::IdpCommunicationErrorException(inner) => inner.source(),
306            Error::IdpRejectedClaimException(inner) => inner.source(),
307            Error::InvalidAuthorizationMessageException(inner) => inner.source(),
308            Error::InvalidIdentityTokenException(inner) => inner.source(),
309            Error::MalformedPolicyDocumentException(inner) => inner.source(),
310            Error::PackedPolicyTooLargeException(inner) => inner.source(),
311            Error::RegionDisabledException(inner) => inner.source(),
312            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
313        }
314    }
315}
316impl ::aws_types::request_id::RequestId for Error {
317    fn request_id(&self) -> Option<&str> {
318        match self {
319            Self::ExpiredTokenException(e) => e.request_id(),
320            Self::IdpCommunicationErrorException(e) => e.request_id(),
321            Self::IdpRejectedClaimException(e) => e.request_id(),
322            Self::InvalidAuthorizationMessageException(e) => e.request_id(),
323            Self::InvalidIdentityTokenException(e) => e.request_id(),
324            Self::MalformedPolicyDocumentException(e) => e.request_id(),
325            Self::PackedPolicyTooLargeException(e) => e.request_id(),
326            Self::RegionDisabledException(e) => e.request_id(),
327            Self::Unhandled(e) => e.meta.request_id(),
328        }
329    }
330}