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 line breaks, or if the message has expired.</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 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(_) => if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
45                                        write!(f, "unhandled error ({code})")
46                                    } else {
47                                        f.write_str("unhandled error")
48                                    }
49        }
50    }
51}
52impl From<::aws_smithy_types::error::operation::BuildError> for Error {
53                fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
54                    Error::Unhandled(crate::error::sealed_unhandled::Unhandled { source: value.into(), meta: ::std::default::Default::default() })
55                }
56            }
57impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
58                fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
59                    match self {
60                        Self::ExpiredTokenException(inner) => inner.meta(),
61Self::IdpCommunicationErrorException(inner) => inner.meta(),
62Self::IdpRejectedClaimException(inner) => inner.meta(),
63Self::InvalidAuthorizationMessageException(inner) => inner.meta(),
64Self::InvalidIdentityTokenException(inner) => inner.meta(),
65Self::MalformedPolicyDocumentException(inner) => inner.meta(),
66Self::PackedPolicyTooLargeException(inner) => inner.meta(),
67Self::RegionDisabledException(inner) => inner.meta(),
68                        Self::Unhandled(inner) => &inner.meta,
69                    }
70                }
71            }
72impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role::AssumeRoleError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
73    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role::AssumeRoleError, R>) -> Self {
74        match err {
75            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
76            _ => Error::Unhandled(
77                                        crate::error::sealed_unhandled::Unhandled {
78                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
79                                            source: err.into(),
80                                        }
81                                    ),
82        }
83    }
84}
85impl From<crate::operation::assume_role::AssumeRoleError> for Error {
86    fn from(err: crate::operation::assume_role::AssumeRoleError) -> Self {
87        match err {
88            crate::operation::assume_role::AssumeRoleError::ExpiredTokenException(inner) => Error::ExpiredTokenException(inner),
89            crate::operation::assume_role::AssumeRoleError::MalformedPolicyDocumentException(inner) => Error::MalformedPolicyDocumentException(inner),
90            crate::operation::assume_role::AssumeRoleError::PackedPolicyTooLargeException(inner) => Error::PackedPolicyTooLargeException(inner),
91            crate::operation::assume_role::AssumeRoleError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
92            crate::operation::assume_role::AssumeRoleError::Unhandled(inner) => Error::Unhandled(inner),
93        }
94    }
95}
96impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
97    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError, R>) -> Self {
98        match err {
99            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
100            _ => Error::Unhandled(
101                                        crate::error::sealed_unhandled::Unhandled {
102                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
103                                            source: err.into(),
104                                        }
105                                    ),
106        }
107    }
108}
109impl From<crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError> for Error {
110    fn from(err: crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError) -> Self {
111        match err {
112            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::ExpiredTokenException(inner) => Error::ExpiredTokenException(inner),
113            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::IdpRejectedClaimException(inner) => Error::IdpRejectedClaimException(inner),
114            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::InvalidIdentityTokenException(inner) => Error::InvalidIdentityTokenException(inner),
115            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::MalformedPolicyDocumentException(inner) => Error::MalformedPolicyDocumentException(inner),
116            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::PackedPolicyTooLargeException(inner) => Error::PackedPolicyTooLargeException(inner),
117            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
118            crate::operation::assume_role_with_saml::AssumeRoleWithSAMLError::Unhandled(inner) => Error::Unhandled(inner),
119        }
120    }
121}
122impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
123    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError, R>) -> Self {
124        match err {
125            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
126            _ => Error::Unhandled(
127                                        crate::error::sealed_unhandled::Unhandled {
128                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
129                                            source: err.into(),
130                                        }
131                                    ),
132        }
133    }
134}
135impl From<crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError> for Error {
136    fn from(err: crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError) -> Self {
137        match err {
138            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::ExpiredTokenException(inner) => Error::ExpiredTokenException(inner),
139            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::IdpCommunicationErrorException(inner) => Error::IdpCommunicationErrorException(inner),
140            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::IdpRejectedClaimException(inner) => Error::IdpRejectedClaimException(inner),
141            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::InvalidIdentityTokenException(inner) => Error::InvalidIdentityTokenException(inner),
142            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::MalformedPolicyDocumentException(inner) => Error::MalformedPolicyDocumentException(inner),
143            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::PackedPolicyTooLargeException(inner) => Error::PackedPolicyTooLargeException(inner),
144            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
145            crate::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError::Unhandled(inner) => Error::Unhandled(inner),
146        }
147    }
148}
149impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_root::AssumeRootError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
150    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_root::AssumeRootError, R>) -> Self {
151        match err {
152            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
153            _ => Error::Unhandled(
154                                        crate::error::sealed_unhandled::Unhandled {
155                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
156                                            source: err.into(),
157                                        }
158                                    ),
159        }
160    }
161}
162impl From<crate::operation::assume_root::AssumeRootError> for Error {
163    fn from(err: crate::operation::assume_root::AssumeRootError) -> Self {
164        match err {
165            crate::operation::assume_root::AssumeRootError::ExpiredTokenException(inner) => Error::ExpiredTokenException(inner),
166            crate::operation::assume_root::AssumeRootError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
167            crate::operation::assume_root::AssumeRootError::Unhandled(inner) => Error::Unhandled(inner),
168        }
169    }
170}
171impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::decode_authorization_message::DecodeAuthorizationMessageError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
172    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::decode_authorization_message::DecodeAuthorizationMessageError, R>) -> Self {
173        match err {
174            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
175            _ => Error::Unhandled(
176                                        crate::error::sealed_unhandled::Unhandled {
177                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
178                                            source: err.into(),
179                                        }
180                                    ),
181        }
182    }
183}
184impl From<crate::operation::decode_authorization_message::DecodeAuthorizationMessageError> for Error {
185    fn from(err: crate::operation::decode_authorization_message::DecodeAuthorizationMessageError) -> Self {
186        match err {
187            crate::operation::decode_authorization_message::DecodeAuthorizationMessageError::InvalidAuthorizationMessageException(inner) => Error::InvalidAuthorizationMessageException(inner),
188            crate::operation::decode_authorization_message::DecodeAuthorizationMessageError::Unhandled(inner) => Error::Unhandled(inner),
189        }
190    }
191}
192impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_access_key_info::GetAccessKeyInfoError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
193    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_access_key_info::GetAccessKeyInfoError, R>) -> Self {
194        match err {
195            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
196            _ => Error::Unhandled(
197                                        crate::error::sealed_unhandled::Unhandled {
198                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
199                                            source: err.into(),
200                                        }
201                                    ),
202        }
203    }
204}
205impl From<crate::operation::get_access_key_info::GetAccessKeyInfoError> for Error {
206    fn from(err: crate::operation::get_access_key_info::GetAccessKeyInfoError) -> Self {
207        match err {
208            crate::operation::get_access_key_info::GetAccessKeyInfoError::Unhandled(inner) => Error::Unhandled(inner),
209        }
210    }
211}
212impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_caller_identity::GetCallerIdentityError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
213    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_caller_identity::GetCallerIdentityError, R>) -> Self {
214        match err {
215            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
216            _ => Error::Unhandled(
217                                        crate::error::sealed_unhandled::Unhandled {
218                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
219                                            source: err.into(),
220                                        }
221                                    ),
222        }
223    }
224}
225impl From<crate::operation::get_caller_identity::GetCallerIdentityError> for Error {
226    fn from(err: crate::operation::get_caller_identity::GetCallerIdentityError) -> Self {
227        match err {
228            crate::operation::get_caller_identity::GetCallerIdentityError::Unhandled(inner) => Error::Unhandled(inner),
229        }
230    }
231}
232impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_federation_token::GetFederationTokenError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
233    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_federation_token::GetFederationTokenError, R>) -> Self {
234        match err {
235            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
236            _ => Error::Unhandled(
237                                        crate::error::sealed_unhandled::Unhandled {
238                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
239                                            source: err.into(),
240                                        }
241                                    ),
242        }
243    }
244}
245impl From<crate::operation::get_federation_token::GetFederationTokenError> for Error {
246    fn from(err: crate::operation::get_federation_token::GetFederationTokenError) -> Self {
247        match err {
248            crate::operation::get_federation_token::GetFederationTokenError::MalformedPolicyDocumentException(inner) => Error::MalformedPolicyDocumentException(inner),
249            crate::operation::get_federation_token::GetFederationTokenError::PackedPolicyTooLargeException(inner) => Error::PackedPolicyTooLargeException(inner),
250            crate::operation::get_federation_token::GetFederationTokenError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
251            crate::operation::get_federation_token::GetFederationTokenError::Unhandled(inner) => Error::Unhandled(inner),
252        }
253    }
254}
255impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_session_token::GetSessionTokenError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
256    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_session_token::GetSessionTokenError, R>) -> Self {
257        match err {
258            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
259            _ => Error::Unhandled(
260                                        crate::error::sealed_unhandled::Unhandled {
261                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
262                                            source: err.into(),
263                                        }
264                                    ),
265        }
266    }
267}
268impl From<crate::operation::get_session_token::GetSessionTokenError> for Error {
269    fn from(err: crate::operation::get_session_token::GetSessionTokenError) -> Self {
270        match err {
271            crate::operation::get_session_token::GetSessionTokenError::RegionDisabledException(inner) => Error::RegionDisabledException(inner),
272            crate::operation::get_session_token::GetSessionTokenError::Unhandled(inner) => Error::Unhandled(inner),
273        }
274    }
275}
276impl ::std::error::Error for Error {
277    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
278        match self {
279            Error::ExpiredTokenException(inner) => inner.source(),
280            Error::IdpCommunicationErrorException(inner) => inner.source(),
281            Error::IdpRejectedClaimException(inner) => inner.source(),
282            Error::InvalidAuthorizationMessageException(inner) => inner.source(),
283            Error::InvalidIdentityTokenException(inner) => inner.source(),
284            Error::MalformedPolicyDocumentException(inner) => inner.source(),
285            Error::PackedPolicyTooLargeException(inner) => inner.source(),
286            Error::RegionDisabledException(inner) => inner.source(),
287            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source)
288        }
289    }
290}
291impl ::aws_types::request_id::RequestId for Error {
292    fn request_id(&self) -> Option<&str> {
293        match self {
294            Self::ExpiredTokenException(e) => e.request_id(),
295            Self::IdpCommunicationErrorException(e) => e.request_id(),
296            Self::IdpRejectedClaimException(e) => e.request_id(),
297            Self::InvalidAuthorizationMessageException(e) => e.request_id(),
298            Self::InvalidIdentityTokenException(e) => e.request_id(),
299            Self::MalformedPolicyDocumentException(e) => e.request_id(),
300            Self::PackedPolicyTooLargeException(e) => e.request_id(),
301            Self::RegionDisabledException(e) => e.request_id(),
302            Self::Unhandled(e) => e.meta.request_id(),
303        }
304    }
305}
306