aws_sdk_evs/
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>A service resource associated with the request could not be found. The resource might not be specified correctly, or it may have a <code>state</code> of <code>DELETED</code>.</p>
7    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
8    /// <p>The request doesn't comply with IAM tag policy. Correct your request and then retry it.</p>
9    TagPolicyException(crate::types::error::TagPolicyException),
10    /// <p>The <code>CreateEnvironmentHost</code> operation couldn't be performed because the service is throttling requests. This exception is thrown when the <code>CreateEnvironmentHost</code> request exceeds concurrency of 1 transaction per second (TPS).</p>
11    ThrottlingException(crate::types::error::ThrottlingException),
12    /// <p>A service resource associated with the request has more than 200 tags.</p>
13    TooManyTagsException(crate::types::error::TooManyTagsException),
14    /// <p>The input fails to satisfy the specified constraints. You will see this exception if invalid inputs are provided for any of the Amazon EVS environment operations, or if a list operation is performed on an environment resource that is still initializing.</p>
15    ValidationException(crate::types::error::ValidationException),
16    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
17    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
18    variable wildcard pattern and check `.code()`:
19     \
20    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
21     \
22    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
23    Unhandled(crate::error::sealed_unhandled::Unhandled),
24}
25impl ::std::fmt::Display for Error {
26    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27        match self {
28            Error::ResourceNotFoundException(inner) => inner.fmt(f),
29            Error::TagPolicyException(inner) => inner.fmt(f),
30            Error::ThrottlingException(inner) => inner.fmt(f),
31            Error::TooManyTagsException(inner) => inner.fmt(f),
32            Error::ValidationException(inner) => inner.fmt(f),
33            Error::Unhandled(_) => {
34                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
35                    write!(f, "unhandled error ({code})")
36                } else {
37                    f.write_str("unhandled error")
38                }
39            }
40        }
41    }
42}
43impl From<::aws_smithy_types::error::operation::BuildError> for Error {
44    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
45        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
46            source: value.into(),
47            meta: ::std::default::Default::default(),
48        })
49    }
50}
51impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
52    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
53        match self {
54            Self::ResourceNotFoundException(inner) => inner.meta(),
55            Self::TagPolicyException(inner) => inner.meta(),
56            Self::ThrottlingException(inner) => inner.meta(),
57            Self::TooManyTagsException(inner) => inner.meta(),
58            Self::ValidationException(inner) => inner.meta(),
59            Self::Unhandled(inner) => &inner.meta,
60        }
61    }
62}
63impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_environment::CreateEnvironmentError, R>> for Error
64where
65    R: Send + Sync + std::fmt::Debug + 'static,
66{
67    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_environment::CreateEnvironmentError, R>) -> Self {
68        match err {
69            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
70            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
71                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
72                source: err.into(),
73            }),
74        }
75    }
76}
77impl From<crate::operation::create_environment::CreateEnvironmentError> for Error {
78    fn from(err: crate::operation::create_environment::CreateEnvironmentError) -> Self {
79        match err {
80            crate::operation::create_environment::CreateEnvironmentError::ValidationException(inner) => Error::ValidationException(inner),
81            crate::operation::create_environment::CreateEnvironmentError::Unhandled(inner) => Error::Unhandled(inner),
82        }
83    }
84}
85impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_environment_host::CreateEnvironmentHostError, R>> for Error
86where
87    R: Send + Sync + std::fmt::Debug + 'static,
88{
89    fn from(
90        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_environment_host::CreateEnvironmentHostError, R>,
91    ) -> Self {
92        match err {
93            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
94            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
95                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
96                source: err.into(),
97            }),
98        }
99    }
100}
101impl From<crate::operation::create_environment_host::CreateEnvironmentHostError> for Error {
102    fn from(err: crate::operation::create_environment_host::CreateEnvironmentHostError) -> Self {
103        match err {
104            crate::operation::create_environment_host::CreateEnvironmentHostError::ThrottlingException(inner) => Error::ThrottlingException(inner),
105            crate::operation::create_environment_host::CreateEnvironmentHostError::ValidationException(inner) => Error::ValidationException(inner),
106            crate::operation::create_environment_host::CreateEnvironmentHostError::Unhandled(inner) => Error::Unhandled(inner),
107        }
108    }
109}
110impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_environment::DeleteEnvironmentError, R>> for Error
111where
112    R: Send + Sync + std::fmt::Debug + 'static,
113{
114    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_environment::DeleteEnvironmentError, R>) -> Self {
115        match err {
116            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
117            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
118                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
119                source: err.into(),
120            }),
121        }
122    }
123}
124impl From<crate::operation::delete_environment::DeleteEnvironmentError> for Error {
125    fn from(err: crate::operation::delete_environment::DeleteEnvironmentError) -> Self {
126        match err {
127            crate::operation::delete_environment::DeleteEnvironmentError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
128            crate::operation::delete_environment::DeleteEnvironmentError::ValidationException(inner) => Error::ValidationException(inner),
129            crate::operation::delete_environment::DeleteEnvironmentError::Unhandled(inner) => Error::Unhandled(inner),
130        }
131    }
132}
133impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_environment_host::DeleteEnvironmentHostError, R>> for Error
134where
135    R: Send + Sync + std::fmt::Debug + 'static,
136{
137    fn from(
138        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_environment_host::DeleteEnvironmentHostError, R>,
139    ) -> Self {
140        match err {
141            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
142            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
143                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
144                source: err.into(),
145            }),
146        }
147    }
148}
149impl From<crate::operation::delete_environment_host::DeleteEnvironmentHostError> for Error {
150    fn from(err: crate::operation::delete_environment_host::DeleteEnvironmentHostError) -> Self {
151        match err {
152            crate::operation::delete_environment_host::DeleteEnvironmentHostError::ResourceNotFoundException(inner) => {
153                Error::ResourceNotFoundException(inner)
154            }
155            crate::operation::delete_environment_host::DeleteEnvironmentHostError::ValidationException(inner) => Error::ValidationException(inner),
156            crate::operation::delete_environment_host::DeleteEnvironmentHostError::Unhandled(inner) => Error::Unhandled(inner),
157        }
158    }
159}
160impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_environment::GetEnvironmentError, R>> for Error
161where
162    R: Send + Sync + std::fmt::Debug + 'static,
163{
164    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_environment::GetEnvironmentError, R>) -> Self {
165        match err {
166            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
167            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
168                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
169                source: err.into(),
170            }),
171        }
172    }
173}
174impl From<crate::operation::get_environment::GetEnvironmentError> for Error {
175    fn from(err: crate::operation::get_environment::GetEnvironmentError) -> Self {
176        match err {
177            crate::operation::get_environment::GetEnvironmentError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
178            crate::operation::get_environment::GetEnvironmentError::ValidationException(inner) => Error::ValidationException(inner),
179            crate::operation::get_environment::GetEnvironmentError::Unhandled(inner) => Error::Unhandled(inner),
180        }
181    }
182}
183impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_environment_hosts::ListEnvironmentHostsError, R>> for Error
184where
185    R: Send + Sync + std::fmt::Debug + 'static,
186{
187    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_environment_hosts::ListEnvironmentHostsError, R>) -> Self {
188        match err {
189            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
190            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
191                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
192                source: err.into(),
193            }),
194        }
195    }
196}
197impl From<crate::operation::list_environment_hosts::ListEnvironmentHostsError> for Error {
198    fn from(err: crate::operation::list_environment_hosts::ListEnvironmentHostsError) -> Self {
199        match err {
200            crate::operation::list_environment_hosts::ListEnvironmentHostsError::ResourceNotFoundException(inner) => {
201                Error::ResourceNotFoundException(inner)
202            }
203            crate::operation::list_environment_hosts::ListEnvironmentHostsError::ValidationException(inner) => Error::ValidationException(inner),
204            crate::operation::list_environment_hosts::ListEnvironmentHostsError::Unhandled(inner) => Error::Unhandled(inner),
205        }
206    }
207}
208impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_environments::ListEnvironmentsError, R>> for Error
209where
210    R: Send + Sync + std::fmt::Debug + 'static,
211{
212    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_environments::ListEnvironmentsError, R>) -> Self {
213        match err {
214            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
215            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
216                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
217                source: err.into(),
218            }),
219        }
220    }
221}
222impl From<crate::operation::list_environments::ListEnvironmentsError> for Error {
223    fn from(err: crate::operation::list_environments::ListEnvironmentsError) -> Self {
224        match err {
225            crate::operation::list_environments::ListEnvironmentsError::ValidationException(inner) => Error::ValidationException(inner),
226            crate::operation::list_environments::ListEnvironmentsError::Unhandled(inner) => Error::Unhandled(inner),
227        }
228    }
229}
230impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_environment_vlans::ListEnvironmentVlansError, 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::list_environment_vlans::ListEnvironmentVlansError, 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::list_environment_vlans::ListEnvironmentVlansError> for Error {
245    fn from(err: crate::operation::list_environment_vlans::ListEnvironmentVlansError) -> Self {
246        match err {
247            crate::operation::list_environment_vlans::ListEnvironmentVlansError::ResourceNotFoundException(inner) => {
248                Error::ResourceNotFoundException(inner)
249            }
250            crate::operation::list_environment_vlans::ListEnvironmentVlansError::ValidationException(inner) => Error::ValidationException(inner),
251            crate::operation::list_environment_vlans::ListEnvironmentVlansError::Unhandled(inner) => Error::Unhandled(inner),
252        }
253    }
254}
255impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
256where
257    R: Send + Sync + std::fmt::Debug + 'static,
258{
259    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
260        match err {
261            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
262            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
263                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
264                source: err.into(),
265            }),
266        }
267    }
268}
269impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
270    fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
271        match err {
272            crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
273                Error::ResourceNotFoundException(inner)
274            }
275            crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
276        }
277    }
278}
279impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, 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::tag_resource::TagResourceError, 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::tag_resource::TagResourceError> for Error {
294    fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
295        match err {
296            crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
297            crate::operation::tag_resource::TagResourceError::TagPolicyException(inner) => Error::TagPolicyException(inner),
298            crate::operation::tag_resource::TagResourceError::TooManyTagsException(inner) => Error::TooManyTagsException(inner),
299            crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
300        }
301    }
302}
303impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
304where
305    R: Send + Sync + std::fmt::Debug + 'static,
306{
307    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
308        match err {
309            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
310            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
311                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
312                source: err.into(),
313            }),
314        }
315    }
316}
317impl From<crate::operation::untag_resource::UntagResourceError> for Error {
318    fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
319        match err {
320            crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
321            crate::operation::untag_resource::UntagResourceError::TagPolicyException(inner) => Error::TagPolicyException(inner),
322            crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
323        }
324    }
325}
326impl ::std::error::Error for Error {
327    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
328        match self {
329            Error::ResourceNotFoundException(inner) => inner.source(),
330            Error::TagPolicyException(inner) => inner.source(),
331            Error::ThrottlingException(inner) => inner.source(),
332            Error::TooManyTagsException(inner) => inner.source(),
333            Error::ValidationException(inner) => inner.source(),
334            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
335        }
336    }
337}
338impl ::aws_types::request_id::RequestId for Error {
339    fn request_id(&self) -> Option<&str> {
340        match self {
341            Self::ResourceNotFoundException(e) => e.request_id(),
342            Self::TagPolicyException(e) => e.request_id(),
343            Self::ThrottlingException(e) => e.request_id(),
344            Self::TooManyTagsException(e) => e.request_id(),
345            Self::ValidationException(e) => e.request_id(),
346            Self::Unhandled(e) => e.meta.request_id(),
347        }
348    }
349}