aws_sdk_licensemanagerlinuxsubscriptions/
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>An exception occurred with the service.</p>
7    InternalServerException(crate::types::error::InternalServerException),
8    /// <p>Unable to find the requested Amazon Web Services resource.</p>
9    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
10    /// <p>The request was denied due to request throttling.</p>
11    ThrottlingException(crate::types::error::ThrottlingException),
12    /// <p>The provided input is not valid. Try your request again.</p>
13    ValidationException(crate::types::error::ValidationException),
14    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
15    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
16    variable wildcard pattern and check `.code()`:
17     \
18    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
19     \
20    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
21    Unhandled(crate::error::sealed_unhandled::Unhandled),
22}
23impl ::std::fmt::Display for Error {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        match self {
26            Error::InternalServerException(inner) => inner.fmt(f),
27            Error::ResourceNotFoundException(inner) => inner.fmt(f),
28            Error::ThrottlingException(inner) => inner.fmt(f),
29            Error::ValidationException(inner) => inner.fmt(f),
30            Error::Unhandled(_) => {
31                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
32                    write!(f, "unhandled error ({code})")
33                } else {
34                    f.write_str("unhandled error")
35                }
36            }
37        }
38    }
39}
40impl From<::aws_smithy_types::error::operation::BuildError> for Error {
41    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
42        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
43            source: value.into(),
44            meta: ::std::default::Default::default(),
45        })
46    }
47}
48impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
49    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
50        match self {
51            Self::InternalServerException(inner) => inner.meta(),
52            Self::ResourceNotFoundException(inner) => inner.meta(),
53            Self::ThrottlingException(inner) => inner.meta(),
54            Self::ValidationException(inner) => inner.meta(),
55            Self::Unhandled(inner) => &inner.meta,
56        }
57    }
58}
59impl<R>
60    From<
61        ::aws_smithy_runtime_api::client::result::SdkError<
62            crate::operation::deregister_subscription_provider::DeregisterSubscriptionProviderError,
63            R,
64        >,
65    > for Error
66where
67    R: Send + Sync + std::fmt::Debug + 'static,
68{
69    fn from(
70        err: ::aws_smithy_runtime_api::client::result::SdkError<
71            crate::operation::deregister_subscription_provider::DeregisterSubscriptionProviderError,
72            R,
73        >,
74    ) -> Self {
75        match err {
76            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
77            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
78                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
79                source: err.into(),
80            }),
81        }
82    }
83}
84impl From<crate::operation::deregister_subscription_provider::DeregisterSubscriptionProviderError> for Error {
85    fn from(err: crate::operation::deregister_subscription_provider::DeregisterSubscriptionProviderError) -> Self {
86        match err {
87            crate::operation::deregister_subscription_provider::DeregisterSubscriptionProviderError::InternalServerException(inner) => {
88                Error::InternalServerException(inner)
89            }
90            crate::operation::deregister_subscription_provider::DeregisterSubscriptionProviderError::ResourceNotFoundException(inner) => {
91                Error::ResourceNotFoundException(inner)
92            }
93            crate::operation::deregister_subscription_provider::DeregisterSubscriptionProviderError::ThrottlingException(inner) => {
94                Error::ThrottlingException(inner)
95            }
96            crate::operation::deregister_subscription_provider::DeregisterSubscriptionProviderError::ValidationException(inner) => {
97                Error::ValidationException(inner)
98            }
99            crate::operation::deregister_subscription_provider::DeregisterSubscriptionProviderError::Unhandled(inner) => Error::Unhandled(inner),
100        }
101    }
102}
103impl<R>
104    From<
105        ::aws_smithy_runtime_api::client::result::SdkError<
106            crate::operation::get_registered_subscription_provider::GetRegisteredSubscriptionProviderError,
107            R,
108        >,
109    > for Error
110where
111    R: Send + Sync + std::fmt::Debug + 'static,
112{
113    fn from(
114        err: ::aws_smithy_runtime_api::client::result::SdkError<
115            crate::operation::get_registered_subscription_provider::GetRegisteredSubscriptionProviderError,
116            R,
117        >,
118    ) -> Self {
119        match err {
120            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
121            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
122                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
123                source: err.into(),
124            }),
125        }
126    }
127}
128impl From<crate::operation::get_registered_subscription_provider::GetRegisteredSubscriptionProviderError> for Error {
129    fn from(err: crate::operation::get_registered_subscription_provider::GetRegisteredSubscriptionProviderError) -> Self {
130        match err {
131            crate::operation::get_registered_subscription_provider::GetRegisteredSubscriptionProviderError::InternalServerException(inner) => {
132                Error::InternalServerException(inner)
133            }
134            crate::operation::get_registered_subscription_provider::GetRegisteredSubscriptionProviderError::ResourceNotFoundException(inner) => {
135                Error::ResourceNotFoundException(inner)
136            }
137            crate::operation::get_registered_subscription_provider::GetRegisteredSubscriptionProviderError::ThrottlingException(inner) => {
138                Error::ThrottlingException(inner)
139            }
140            crate::operation::get_registered_subscription_provider::GetRegisteredSubscriptionProviderError::ValidationException(inner) => {
141                Error::ValidationException(inner)
142            }
143            crate::operation::get_registered_subscription_provider::GetRegisteredSubscriptionProviderError::Unhandled(inner) => {
144                Error::Unhandled(inner)
145            }
146        }
147    }
148}
149impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_service_settings::GetServiceSettingsError, R>> for Error
150where
151    R: Send + Sync + std::fmt::Debug + 'static,
152{
153    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_service_settings::GetServiceSettingsError, R>) -> Self {
154        match err {
155            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
156            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
157                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
158                source: err.into(),
159            }),
160        }
161    }
162}
163impl From<crate::operation::get_service_settings::GetServiceSettingsError> for Error {
164    fn from(err: crate::operation::get_service_settings::GetServiceSettingsError) -> Self {
165        match err {
166            crate::operation::get_service_settings::GetServiceSettingsError::InternalServerException(inner) => Error::InternalServerException(inner),
167            crate::operation::get_service_settings::GetServiceSettingsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
168            crate::operation::get_service_settings::GetServiceSettingsError::ValidationException(inner) => Error::ValidationException(inner),
169            crate::operation::get_service_settings::GetServiceSettingsError::Unhandled(inner) => Error::Unhandled(inner),
170        }
171    }
172}
173impl<R>
174    From<
175        ::aws_smithy_runtime_api::client::result::SdkError<
176            crate::operation::list_linux_subscription_instances::ListLinuxSubscriptionInstancesError,
177            R,
178        >,
179    > for Error
180where
181    R: Send + Sync + std::fmt::Debug + 'static,
182{
183    fn from(
184        err: ::aws_smithy_runtime_api::client::result::SdkError<
185            crate::operation::list_linux_subscription_instances::ListLinuxSubscriptionInstancesError,
186            R,
187        >,
188    ) -> Self {
189        match err {
190            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
191            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
192                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
193                source: err.into(),
194            }),
195        }
196    }
197}
198impl From<crate::operation::list_linux_subscription_instances::ListLinuxSubscriptionInstancesError> for Error {
199    fn from(err: crate::operation::list_linux_subscription_instances::ListLinuxSubscriptionInstancesError) -> Self {
200        match err {
201            crate::operation::list_linux_subscription_instances::ListLinuxSubscriptionInstancesError::InternalServerException(inner) => {
202                Error::InternalServerException(inner)
203            }
204            crate::operation::list_linux_subscription_instances::ListLinuxSubscriptionInstancesError::ThrottlingException(inner) => {
205                Error::ThrottlingException(inner)
206            }
207            crate::operation::list_linux_subscription_instances::ListLinuxSubscriptionInstancesError::ValidationException(inner) => {
208                Error::ValidationException(inner)
209            }
210            crate::operation::list_linux_subscription_instances::ListLinuxSubscriptionInstancesError::Unhandled(inner) => Error::Unhandled(inner),
211        }
212    }
213}
214impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_linux_subscriptions::ListLinuxSubscriptionsError, R>> for Error
215where
216    R: Send + Sync + std::fmt::Debug + 'static,
217{
218    fn from(
219        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_linux_subscriptions::ListLinuxSubscriptionsError, R>,
220    ) -> Self {
221        match err {
222            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
223            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
224                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
225                source: err.into(),
226            }),
227        }
228    }
229}
230impl From<crate::operation::list_linux_subscriptions::ListLinuxSubscriptionsError> for Error {
231    fn from(err: crate::operation::list_linux_subscriptions::ListLinuxSubscriptionsError) -> Self {
232        match err {
233            crate::operation::list_linux_subscriptions::ListLinuxSubscriptionsError::InternalServerException(inner) => {
234                Error::InternalServerException(inner)
235            }
236            crate::operation::list_linux_subscriptions::ListLinuxSubscriptionsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
237            crate::operation::list_linux_subscriptions::ListLinuxSubscriptionsError::ValidationException(inner) => Error::ValidationException(inner),
238            crate::operation::list_linux_subscriptions::ListLinuxSubscriptionsError::Unhandled(inner) => Error::Unhandled(inner),
239        }
240    }
241}
242impl<R>
243    From<
244        ::aws_smithy_runtime_api::client::result::SdkError<
245            crate::operation::list_registered_subscription_providers::ListRegisteredSubscriptionProvidersError,
246            R,
247        >,
248    > for Error
249where
250    R: Send + Sync + std::fmt::Debug + 'static,
251{
252    fn from(
253        err: ::aws_smithy_runtime_api::client::result::SdkError<
254            crate::operation::list_registered_subscription_providers::ListRegisteredSubscriptionProvidersError,
255            R,
256        >,
257    ) -> Self {
258        match err {
259            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
260            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
261                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
262                source: err.into(),
263            }),
264        }
265    }
266}
267impl From<crate::operation::list_registered_subscription_providers::ListRegisteredSubscriptionProvidersError> for Error {
268    fn from(err: crate::operation::list_registered_subscription_providers::ListRegisteredSubscriptionProvidersError) -> Self {
269        match err {
270            crate::operation::list_registered_subscription_providers::ListRegisteredSubscriptionProvidersError::InternalServerException(inner) => {
271                Error::InternalServerException(inner)
272            }
273            crate::operation::list_registered_subscription_providers::ListRegisteredSubscriptionProvidersError::ThrottlingException(inner) => {
274                Error::ThrottlingException(inner)
275            }
276            crate::operation::list_registered_subscription_providers::ListRegisteredSubscriptionProvidersError::ValidationException(inner) => {
277                Error::ValidationException(inner)
278            }
279            crate::operation::list_registered_subscription_providers::ListRegisteredSubscriptionProvidersError::Unhandled(inner) => {
280                Error::Unhandled(inner)
281            }
282        }
283    }
284}
285impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
286where
287    R: Send + Sync + std::fmt::Debug + 'static,
288{
289    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
290        match err {
291            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
292            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
293                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
294                source: err.into(),
295            }),
296        }
297    }
298}
299impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
300    fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
301        match err {
302            crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
303                Error::InternalServerException(inner)
304            }
305            crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
306                Error::ResourceNotFoundException(inner)
307            }
308            crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
309            crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
310        }
311    }
312}
313impl<R>
314    From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::register_subscription_provider::RegisterSubscriptionProviderError, R>>
315    for Error
316where
317    R: Send + Sync + std::fmt::Debug + 'static,
318{
319    fn from(
320        err: ::aws_smithy_runtime_api::client::result::SdkError<
321            crate::operation::register_subscription_provider::RegisterSubscriptionProviderError,
322            R,
323        >,
324    ) -> Self {
325        match err {
326            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
327            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
328                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
329                source: err.into(),
330            }),
331        }
332    }
333}
334impl From<crate::operation::register_subscription_provider::RegisterSubscriptionProviderError> for Error {
335    fn from(err: crate::operation::register_subscription_provider::RegisterSubscriptionProviderError) -> Self {
336        match err {
337            crate::operation::register_subscription_provider::RegisterSubscriptionProviderError::InternalServerException(inner) => {
338                Error::InternalServerException(inner)
339            }
340            crate::operation::register_subscription_provider::RegisterSubscriptionProviderError::ThrottlingException(inner) => {
341                Error::ThrottlingException(inner)
342            }
343            crate::operation::register_subscription_provider::RegisterSubscriptionProviderError::ValidationException(inner) => {
344                Error::ValidationException(inner)
345            }
346            crate::operation::register_subscription_provider::RegisterSubscriptionProviderError::Unhandled(inner) => Error::Unhandled(inner),
347        }
348    }
349}
350impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
351where
352    R: Send + Sync + std::fmt::Debug + 'static,
353{
354    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
355        match err {
356            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
357            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
358                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
359                source: err.into(),
360            }),
361        }
362    }
363}
364impl From<crate::operation::tag_resource::TagResourceError> for Error {
365    fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
366        match err {
367            crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
368            crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
369            crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
370            crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
371        }
372    }
373}
374impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
375where
376    R: Send + Sync + std::fmt::Debug + 'static,
377{
378    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
379        match err {
380            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
381            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
382                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
383                source: err.into(),
384            }),
385        }
386    }
387}
388impl From<crate::operation::untag_resource::UntagResourceError> for Error {
389    fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
390        match err {
391            crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
392            crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
393            crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
394        }
395    }
396}
397impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_service_settings::UpdateServiceSettingsError, R>> for Error
398where
399    R: Send + Sync + std::fmt::Debug + 'static,
400{
401    fn from(
402        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_service_settings::UpdateServiceSettingsError, R>,
403    ) -> Self {
404        match err {
405            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
406            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
407                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
408                source: err.into(),
409            }),
410        }
411    }
412}
413impl From<crate::operation::update_service_settings::UpdateServiceSettingsError> for Error {
414    fn from(err: crate::operation::update_service_settings::UpdateServiceSettingsError) -> Self {
415        match err {
416            crate::operation::update_service_settings::UpdateServiceSettingsError::InternalServerException(inner) => {
417                Error::InternalServerException(inner)
418            }
419            crate::operation::update_service_settings::UpdateServiceSettingsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
420            crate::operation::update_service_settings::UpdateServiceSettingsError::ValidationException(inner) => Error::ValidationException(inner),
421            crate::operation::update_service_settings::UpdateServiceSettingsError::Unhandled(inner) => Error::Unhandled(inner),
422        }
423    }
424}
425impl ::std::error::Error for Error {
426    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
427        match self {
428            Error::InternalServerException(inner) => inner.source(),
429            Error::ResourceNotFoundException(inner) => inner.source(),
430            Error::ThrottlingException(inner) => inner.source(),
431            Error::ValidationException(inner) => inner.source(),
432            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
433        }
434    }
435}
436impl ::aws_types::request_id::RequestId for Error {
437    fn request_id(&self) -> Option<&str> {
438        match self {
439            Self::InternalServerException(e) => e.request_id(),
440            Self::ResourceNotFoundException(e) => e.request_id(),
441            Self::ThrottlingException(e) => e.request_id(),
442            Self::ValidationException(e) => e.request_id(),
443            Self::Unhandled(e) => e.meta.request_id(),
444        }
445    }
446}