Skip to main content

aws_sdk_pricingplanmanager/
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 do not have the required permissions to perform this operation. Verify that your IAM policy grants access to this action.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>The request conflicts with the current state of the resource. This typically occurs when the <code>ETag</code> value in the <code>If-Match</code> header does not match the current version of the subscription. Retrieve the latest version and retry.</p>
9    ConflictException(crate::types::error::ConflictException),
10    /// <p>An unexpected error occurred on the server. Retry the request.</p>
11    InternalServerException(crate::types::error::InternalServerException),
12    /// <p>The specified subscription was not found. Verify that the ARN is correct and that the subscription belongs to your account.</p>
13    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
14    /// <p>The request would exceed a service limit. You have reached the maximum number of subscriptions allowed for your account.</p>
15    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
16    /// <p>The request rate exceeds the allowed limit. Wait briefly and retry the request.</p>
17    ThrottlingException(crate::types::error::ThrottlingException),
18    /// <p>The request failed a business rule validation. For example, the specified resource might already be associated with another subscription, or the subscription might not be in the required state for this operation.</p>
19    ValidationException(crate::types::error::ValidationException),
20    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
21    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
22    variable wildcard pattern and check `.code()`:
23     \
24    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
25     \
26    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
27    Unhandled(crate::error::sealed_unhandled::Unhandled),
28}
29impl ::std::fmt::Display for Error {
30    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31        match self {
32            Error::AccessDeniedException(inner) => inner.fmt(f),
33            Error::ConflictException(inner) => inner.fmt(f),
34            Error::InternalServerException(inner) => inner.fmt(f),
35            Error::ResourceNotFoundException(inner) => inner.fmt(f),
36            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
37            Error::ThrottlingException(inner) => inner.fmt(f),
38            Error::ValidationException(inner) => inner.fmt(f),
39            Error::Unhandled(_) => {
40                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
41                    write!(f, "unhandled error ({code})")
42                } else {
43                    f.write_str("unhandled error")
44                }
45            }
46        }
47    }
48}
49impl From<::aws_smithy_types::error::operation::BuildError> for Error {
50    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
51        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
52            source: value.into(),
53            meta: ::std::default::Default::default(),
54        })
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::AccessDeniedException(inner) => inner.meta(),
61            Self::ConflictException(inner) => inner.meta(),
62            Self::InternalServerException(inner) => inner.meta(),
63            Self::ResourceNotFoundException(inner) => inner.meta(),
64            Self::ServiceQuotaExceededException(inner) => inner.meta(),
65            Self::ThrottlingException(inner) => inner.meta(),
66            Self::ValidationException(inner) => inner.meta(),
67            Self::Unhandled(inner) => &inner.meta,
68        }
69    }
70}
71impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError, R>>
72    for Error
73where
74    R: Send + Sync + std::fmt::Debug + 'static,
75{
76    fn from(
77        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError, R>,
78    ) -> Self {
79        match err {
80            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
81            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
82                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
83                source: err.into(),
84            }),
85        }
86    }
87}
88impl From<crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError> for Error {
89    fn from(err: crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError) -> Self {
90        match err {
91            crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError::AccessDeniedException(inner) => {
92                Error::AccessDeniedException(inner)
93            }
94            crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError::ConflictException(inner) => Error::ConflictException(inner),
95            crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError::InternalServerException(inner) => {
96                Error::InternalServerException(inner)
97            }
98            crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError::ResourceNotFoundException(inner) => {
99                Error::ResourceNotFoundException(inner)
100            }
101            crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError::ThrottlingException(inner) => {
102                Error::ThrottlingException(inner)
103            }
104            crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError::ValidationException(inner) => {
105                Error::ValidationException(inner)
106            }
107            crate::operation::approve_paid_subscription::ApprovePaidSubscriptionError::Unhandled(inner) => Error::Unhandled(inner),
108        }
109    }
110}
111impl<R>
112    From<
113        ::aws_smithy_runtime_api::client::result::SdkError<
114            crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError,
115            R,
116        >,
117    > for Error
118where
119    R: Send + Sync + std::fmt::Debug + 'static,
120{
121    fn from(
122        err: ::aws_smithy_runtime_api::client::result::SdkError<
123            crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError,
124            R,
125        >,
126    ) -> Self {
127        match err {
128            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
129            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
130                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
131                source: err.into(),
132            }),
133        }
134    }
135}
136impl From<crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError> for Error {
137    fn from(err: crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError) -> Self {
138        match err {
139            crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError::AccessDeniedException(inner) => {
140                Error::AccessDeniedException(inner)
141            }
142            crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError::ConflictException(inner) => {
143                Error::ConflictException(inner)
144            }
145            crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError::InternalServerException(inner) => {
146                Error::InternalServerException(inner)
147            }
148            crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError::ResourceNotFoundException(inner) => {
149                Error::ResourceNotFoundException(inner)
150            }
151            crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError::ThrottlingException(inner) => {
152                Error::ThrottlingException(inner)
153            }
154            crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError::ValidationException(inner) => {
155                Error::ValidationException(inner)
156            }
157            crate::operation::associate_resources_to_subscription::AssociateResourcesToSubscriptionError::Unhandled(inner) => Error::Unhandled(inner),
158        }
159    }
160}
161impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::cancel_subscription::CancelSubscriptionError, R>> for Error
162where
163    R: Send + Sync + std::fmt::Debug + 'static,
164{
165    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::cancel_subscription::CancelSubscriptionError, R>) -> Self {
166        match err {
167            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
168            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
169                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
170                source: err.into(),
171            }),
172        }
173    }
174}
175impl From<crate::operation::cancel_subscription::CancelSubscriptionError> for Error {
176    fn from(err: crate::operation::cancel_subscription::CancelSubscriptionError) -> Self {
177        match err {
178            crate::operation::cancel_subscription::CancelSubscriptionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
179            crate::operation::cancel_subscription::CancelSubscriptionError::ConflictException(inner) => Error::ConflictException(inner),
180            crate::operation::cancel_subscription::CancelSubscriptionError::InternalServerException(inner) => Error::InternalServerException(inner),
181            crate::operation::cancel_subscription::CancelSubscriptionError::ResourceNotFoundException(inner) => {
182                Error::ResourceNotFoundException(inner)
183            }
184            crate::operation::cancel_subscription::CancelSubscriptionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
185            crate::operation::cancel_subscription::CancelSubscriptionError::ValidationException(inner) => Error::ValidationException(inner),
186            crate::operation::cancel_subscription::CancelSubscriptionError::Unhandled(inner) => Error::Unhandled(inner),
187        }
188    }
189}
190impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::cancel_subscription_change::CancelSubscriptionChangeError, R>>
191    for Error
192where
193    R: Send + Sync + std::fmt::Debug + 'static,
194{
195    fn from(
196        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::cancel_subscription_change::CancelSubscriptionChangeError, R>,
197    ) -> Self {
198        match err {
199            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
200            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
201                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
202                source: err.into(),
203            }),
204        }
205    }
206}
207impl From<crate::operation::cancel_subscription_change::CancelSubscriptionChangeError> for Error {
208    fn from(err: crate::operation::cancel_subscription_change::CancelSubscriptionChangeError) -> Self {
209        match err {
210            crate::operation::cancel_subscription_change::CancelSubscriptionChangeError::AccessDeniedException(inner) => {
211                Error::AccessDeniedException(inner)
212            }
213            crate::operation::cancel_subscription_change::CancelSubscriptionChangeError::ConflictException(inner) => Error::ConflictException(inner),
214            crate::operation::cancel_subscription_change::CancelSubscriptionChangeError::InternalServerException(inner) => {
215                Error::InternalServerException(inner)
216            }
217            crate::operation::cancel_subscription_change::CancelSubscriptionChangeError::ResourceNotFoundException(inner) => {
218                Error::ResourceNotFoundException(inner)
219            }
220            crate::operation::cancel_subscription_change::CancelSubscriptionChangeError::ThrottlingException(inner) => {
221                Error::ThrottlingException(inner)
222            }
223            crate::operation::cancel_subscription_change::CancelSubscriptionChangeError::ValidationException(inner) => {
224                Error::ValidationException(inner)
225            }
226            crate::operation::cancel_subscription_change::CancelSubscriptionChangeError::Unhandled(inner) => Error::Unhandled(inner),
227        }
228    }
229}
230impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_subscription::CreateSubscriptionError, 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::create_subscription::CreateSubscriptionError, 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::create_subscription::CreateSubscriptionError> for Error {
245    fn from(err: crate::operation::create_subscription::CreateSubscriptionError) -> Self {
246        match err {
247            crate::operation::create_subscription::CreateSubscriptionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
248            crate::operation::create_subscription::CreateSubscriptionError::ConflictException(inner) => Error::ConflictException(inner),
249            crate::operation::create_subscription::CreateSubscriptionError::InternalServerException(inner) => Error::InternalServerException(inner),
250            crate::operation::create_subscription::CreateSubscriptionError::ResourceNotFoundException(inner) => {
251                Error::ResourceNotFoundException(inner)
252            }
253            crate::operation::create_subscription::CreateSubscriptionError::ServiceQuotaExceededException(inner) => {
254                Error::ServiceQuotaExceededException(inner)
255            }
256            crate::operation::create_subscription::CreateSubscriptionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
257            crate::operation::create_subscription::CreateSubscriptionError::ValidationException(inner) => Error::ValidationException(inner),
258            crate::operation::create_subscription::CreateSubscriptionError::Unhandled(inner) => Error::Unhandled(inner),
259        }
260    }
261}
262impl<R>
263    From<
264        ::aws_smithy_runtime_api::client::result::SdkError<
265            crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError,
266            R,
267        >,
268    > for Error
269where
270    R: Send + Sync + std::fmt::Debug + 'static,
271{
272    fn from(
273        err: ::aws_smithy_runtime_api::client::result::SdkError<
274            crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError,
275            R,
276        >,
277    ) -> Self {
278        match err {
279            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
280            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
281                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
282                source: err.into(),
283            }),
284        }
285    }
286}
287impl From<crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError> for Error {
288    fn from(err: crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError) -> Self {
289        match err {
290            crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError::AccessDeniedException(inner) => {
291                Error::AccessDeniedException(inner)
292            }
293            crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError::ConflictException(inner) => {
294                Error::ConflictException(inner)
295            }
296            crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError::InternalServerException(
297                inner,
298            ) => Error::InternalServerException(inner),
299            crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError::ResourceNotFoundException(
300                inner,
301            ) => Error::ResourceNotFoundException(inner),
302            crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError::ThrottlingException(inner) => {
303                Error::ThrottlingException(inner)
304            }
305            crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError::ValidationException(inner) => {
306                Error::ValidationException(inner)
307            }
308            crate::operation::disassociate_resources_from_subscription::DisassociateResourcesFromSubscriptionError::Unhandled(inner) => {
309                Error::Unhandled(inner)
310            }
311        }
312    }
313}
314impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_subscription::GetSubscriptionError, R>> for Error
315where
316    R: Send + Sync + std::fmt::Debug + 'static,
317{
318    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_subscription::GetSubscriptionError, R>) -> Self {
319        match err {
320            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
321            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
322                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
323                source: err.into(),
324            }),
325        }
326    }
327}
328impl From<crate::operation::get_subscription::GetSubscriptionError> for Error {
329    fn from(err: crate::operation::get_subscription::GetSubscriptionError) -> Self {
330        match err {
331            crate::operation::get_subscription::GetSubscriptionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
332            crate::operation::get_subscription::GetSubscriptionError::InternalServerException(inner) => Error::InternalServerException(inner),
333            crate::operation::get_subscription::GetSubscriptionError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
334            crate::operation::get_subscription::GetSubscriptionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
335            crate::operation::get_subscription::GetSubscriptionError::ValidationException(inner) => Error::ValidationException(inner),
336            crate::operation::get_subscription::GetSubscriptionError::Unhandled(inner) => Error::Unhandled(inner),
337        }
338    }
339}
340impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_subscriptions::ListSubscriptionsError, R>> for Error
341where
342    R: Send + Sync + std::fmt::Debug + 'static,
343{
344    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_subscriptions::ListSubscriptionsError, R>) -> Self {
345        match err {
346            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
347            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
348                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
349                source: err.into(),
350            }),
351        }
352    }
353}
354impl From<crate::operation::list_subscriptions::ListSubscriptionsError> for Error {
355    fn from(err: crate::operation::list_subscriptions::ListSubscriptionsError) -> Self {
356        match err {
357            crate::operation::list_subscriptions::ListSubscriptionsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
358            crate::operation::list_subscriptions::ListSubscriptionsError::InternalServerException(inner) => Error::InternalServerException(inner),
359            crate::operation::list_subscriptions::ListSubscriptionsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
360            crate::operation::list_subscriptions::ListSubscriptionsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
361            crate::operation::list_subscriptions::ListSubscriptionsError::ValidationException(inner) => Error::ValidationException(inner),
362            crate::operation::list_subscriptions::ListSubscriptionsError::Unhandled(inner) => Error::Unhandled(inner),
363        }
364    }
365}
366impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_subscription::UpdateSubscriptionError, R>> for Error
367where
368    R: Send + Sync + std::fmt::Debug + 'static,
369{
370    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_subscription::UpdateSubscriptionError, R>) -> Self {
371        match err {
372            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
373            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
374                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
375                source: err.into(),
376            }),
377        }
378    }
379}
380impl From<crate::operation::update_subscription::UpdateSubscriptionError> for Error {
381    fn from(err: crate::operation::update_subscription::UpdateSubscriptionError) -> Self {
382        match err {
383            crate::operation::update_subscription::UpdateSubscriptionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
384            crate::operation::update_subscription::UpdateSubscriptionError::ConflictException(inner) => Error::ConflictException(inner),
385            crate::operation::update_subscription::UpdateSubscriptionError::InternalServerException(inner) => Error::InternalServerException(inner),
386            crate::operation::update_subscription::UpdateSubscriptionError::ResourceNotFoundException(inner) => {
387                Error::ResourceNotFoundException(inner)
388            }
389            crate::operation::update_subscription::UpdateSubscriptionError::ServiceQuotaExceededException(inner) => {
390                Error::ServiceQuotaExceededException(inner)
391            }
392            crate::operation::update_subscription::UpdateSubscriptionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
393            crate::operation::update_subscription::UpdateSubscriptionError::ValidationException(inner) => Error::ValidationException(inner),
394            crate::operation::update_subscription::UpdateSubscriptionError::Unhandled(inner) => Error::Unhandled(inner),
395        }
396    }
397}
398impl ::std::error::Error for Error {
399    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
400        match self {
401            Error::AccessDeniedException(inner) => inner.source(),
402            Error::ConflictException(inner) => inner.source(),
403            Error::InternalServerException(inner) => inner.source(),
404            Error::ResourceNotFoundException(inner) => inner.source(),
405            Error::ServiceQuotaExceededException(inner) => inner.source(),
406            Error::ThrottlingException(inner) => inner.source(),
407            Error::ValidationException(inner) => inner.source(),
408            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
409        }
410    }
411}
412impl ::aws_types::request_id::RequestId for Error {
413    fn request_id(&self) -> Option<&str> {
414        match self {
415            Self::AccessDeniedException(e) => e.request_id(),
416            Self::ConflictException(e) => e.request_id(),
417            Self::InternalServerException(e) => e.request_id(),
418            Self::ResourceNotFoundException(e) => e.request_id(),
419            Self::ServiceQuotaExceededException(e) => e.request_id(),
420            Self::ThrottlingException(e) => e.request_id(),
421            Self::ValidationException(e) => e.request_id(),
422            Self::Unhandled(e) => e.meta.request_id(),
423        }
424    }
425}