1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 ConflictException(crate::types::error::ConflictException),
10 InternalServerException(crate::types::error::InternalServerException),
12 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
14 ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
16 ThrottlingException(crate::types::error::ThrottlingException),
18 ValidationException(crate::types::error::ValidationException),
20 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
22 variable wildcard pattern and check `.code()`:
23 \
24 `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::create_cluster::CreateClusterError, R>> for Error
72where
73 R: Send + Sync + std::fmt::Debug + 'static,
74{
75 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_cluster::CreateClusterError, R>) -> Self {
76 match err {
77 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
78 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
79 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
80 source: err.into(),
81 }),
82 }
83 }
84}
85impl From<crate::operation::create_cluster::CreateClusterError> for Error {
86 fn from(err: crate::operation::create_cluster::CreateClusterError) -> Self {
87 match err {
88 crate::operation::create_cluster::CreateClusterError::ConflictException(inner) => Error::ConflictException(inner),
89 crate::operation::create_cluster::CreateClusterError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
90 crate::operation::create_cluster::CreateClusterError::ValidationException(inner) => Error::ValidationException(inner),
91 crate::operation::create_cluster::CreateClusterError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
92 crate::operation::create_cluster::CreateClusterError::InternalServerException(inner) => Error::InternalServerException(inner),
93 crate::operation::create_cluster::CreateClusterError::ThrottlingException(inner) => Error::ThrottlingException(inner),
94 crate::operation::create_cluster::CreateClusterError::Unhandled(inner) => Error::Unhandled(inner),
95 }
96 }
97}
98impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_cluster::DeleteClusterError, R>> for Error
99where
100 R: Send + Sync + std::fmt::Debug + 'static,
101{
102 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_cluster::DeleteClusterError, R>) -> Self {
103 match err {
104 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
105 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
106 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
107 source: err.into(),
108 }),
109 }
110 }
111}
112impl From<crate::operation::delete_cluster::DeleteClusterError> for Error {
113 fn from(err: crate::operation::delete_cluster::DeleteClusterError) -> Self {
114 match err {
115 crate::operation::delete_cluster::DeleteClusterError::ConflictException(inner) => Error::ConflictException(inner),
116 crate::operation::delete_cluster::DeleteClusterError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
117 crate::operation::delete_cluster::DeleteClusterError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
118 crate::operation::delete_cluster::DeleteClusterError::InternalServerException(inner) => Error::InternalServerException(inner),
119 crate::operation::delete_cluster::DeleteClusterError::ThrottlingException(inner) => Error::ThrottlingException(inner),
120 crate::operation::delete_cluster::DeleteClusterError::ValidationException(inner) => Error::ValidationException(inner),
121 crate::operation::delete_cluster::DeleteClusterError::Unhandled(inner) => Error::Unhandled(inner),
122 }
123 }
124}
125impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_cluster::GetClusterError, R>> for Error
126where
127 R: Send + Sync + std::fmt::Debug + 'static,
128{
129 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_cluster::GetClusterError, R>) -> Self {
130 match err {
131 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
132 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
133 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
134 source: err.into(),
135 }),
136 }
137 }
138}
139impl From<crate::operation::get_cluster::GetClusterError> for Error {
140 fn from(err: crate::operation::get_cluster::GetClusterError) -> Self {
141 match err {
142 crate::operation::get_cluster::GetClusterError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
143 crate::operation::get_cluster::GetClusterError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
144 crate::operation::get_cluster::GetClusterError::InternalServerException(inner) => Error::InternalServerException(inner),
145 crate::operation::get_cluster::GetClusterError::ThrottlingException(inner) => Error::ThrottlingException(inner),
146 crate::operation::get_cluster::GetClusterError::ValidationException(inner) => Error::ValidationException(inner),
147 crate::operation::get_cluster::GetClusterError::Unhandled(inner) => Error::Unhandled(inner),
148 }
149 }
150}
151impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError, R>>
152 for Error
153where
154 R: Send + Sync + std::fmt::Debug + 'static,
155{
156 fn from(
157 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError, R>,
158 ) -> Self {
159 match err {
160 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
161 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
162 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
163 source: err.into(),
164 }),
165 }
166 }
167}
168impl From<crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError> for Error {
169 fn from(err: crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError) -> Self {
170 match err {
171 crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError::InternalServerException(inner) => {
172 Error::InternalServerException(inner)
173 }
174 crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError::ResourceNotFoundException(inner) => {
175 Error::ResourceNotFoundException(inner)
176 }
177 crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError::ThrottlingException(inner) => {
178 Error::ThrottlingException(inner)
179 }
180 crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError::ValidationException(inner) => {
181 Error::ValidationException(inner)
182 }
183 crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError::AccessDeniedException(inner) => {
184 Error::AccessDeniedException(inner)
185 }
186 crate::operation::get_vpc_endpoint_service_name::GetVpcEndpointServiceNameError::Unhandled(inner) => Error::Unhandled(inner),
187 }
188 }
189}
190impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_clusters::ListClustersError, R>> for Error
191where
192 R: Send + Sync + std::fmt::Debug + 'static,
193{
194 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_clusters::ListClustersError, R>) -> Self {
195 match err {
196 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
197 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
198 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
199 source: err.into(),
200 }),
201 }
202 }
203}
204impl From<crate::operation::list_clusters::ListClustersError> for Error {
205 fn from(err: crate::operation::list_clusters::ListClustersError) -> Self {
206 match err {
207 crate::operation::list_clusters::ListClustersError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
208 crate::operation::list_clusters::ListClustersError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
209 crate::operation::list_clusters::ListClustersError::InternalServerException(inner) => Error::InternalServerException(inner),
210 crate::operation::list_clusters::ListClustersError::ThrottlingException(inner) => Error::ThrottlingException(inner),
211 crate::operation::list_clusters::ListClustersError::ValidationException(inner) => Error::ValidationException(inner),
212 crate::operation::list_clusters::ListClustersError::Unhandled(inner) => Error::Unhandled(inner),
213 }
214 }
215}
216impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
217where
218 R: Send + Sync + std::fmt::Debug + 'static,
219{
220 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> 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_tags_for_resource::ListTagsForResourceError> for Error {
231 fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
232 match err {
233 crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
234 Error::ResourceNotFoundException(inner)
235 }
236 crate::operation::list_tags_for_resource::ListTagsForResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
237 crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
238 Error::InternalServerException(inner)
239 }
240 crate::operation::list_tags_for_resource::ListTagsForResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
241 crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
242 crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
243 }
244 }
245}
246impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
247where
248 R: Send + Sync + std::fmt::Debug + 'static,
249{
250 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
251 match err {
252 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
253 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
254 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
255 source: err.into(),
256 }),
257 }
258 }
259}
260impl From<crate::operation::tag_resource::TagResourceError> for Error {
261 fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
262 match err {
263 crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
264 crate::operation::tag_resource::TagResourceError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
265 crate::operation::tag_resource::TagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
266 crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
267 crate::operation::tag_resource::TagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
268 crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
269 crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
270 }
271 }
272}
273impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
274where
275 R: Send + Sync + std::fmt::Debug + 'static,
276{
277 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> 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::untag_resource::UntagResourceError> for Error {
288 fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
289 match err {
290 crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
291 crate::operation::untag_resource::UntagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
292 crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
293 crate::operation::untag_resource::UntagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
294 crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
295 crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
296 }
297 }
298}
299impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_cluster::UpdateClusterError, R>> for Error
300where
301 R: Send + Sync + std::fmt::Debug + 'static,
302{
303 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_cluster::UpdateClusterError, R>) -> Self {
304 match err {
305 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
306 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
307 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
308 source: err.into(),
309 }),
310 }
311 }
312}
313impl From<crate::operation::update_cluster::UpdateClusterError> for Error {
314 fn from(err: crate::operation::update_cluster::UpdateClusterError) -> Self {
315 match err {
316 crate::operation::update_cluster::UpdateClusterError::ConflictException(inner) => Error::ConflictException(inner),
317 crate::operation::update_cluster::UpdateClusterError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
318 crate::operation::update_cluster::UpdateClusterError::ValidationException(inner) => Error::ValidationException(inner),
319 crate::operation::update_cluster::UpdateClusterError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
320 crate::operation::update_cluster::UpdateClusterError::InternalServerException(inner) => Error::InternalServerException(inner),
321 crate::operation::update_cluster::UpdateClusterError::ThrottlingException(inner) => Error::ThrottlingException(inner),
322 crate::operation::update_cluster::UpdateClusterError::Unhandled(inner) => Error::Unhandled(inner),
323 }
324 }
325}
326impl<O, E> ::std::convert::From<::aws_smithy_runtime_api::client::waiters::error::WaiterError<O, E>> for Error
327where
328 O: ::std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
329 E: ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static,
330{
331 fn from(err: ::aws_smithy_runtime_api::client::waiters::error::WaiterError<O, E>) -> Self {
332 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
333 meta: ::std::default::Default::default(),
334 source: err.into(),
335 })
336 }
337}
338impl ::std::error::Error for Error {
339 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
340 match self {
341 Error::AccessDeniedException(inner) => inner.source(),
342 Error::ConflictException(inner) => inner.source(),
343 Error::InternalServerException(inner) => inner.source(),
344 Error::ResourceNotFoundException(inner) => inner.source(),
345 Error::ServiceQuotaExceededException(inner) => inner.source(),
346 Error::ThrottlingException(inner) => inner.source(),
347 Error::ValidationException(inner) => inner.source(),
348 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
349 }
350 }
351}
352impl ::aws_types::request_id::RequestId for Error {
353 fn request_id(&self) -> Option<&str> {
354 match self {
355 Self::AccessDeniedException(e) => e.request_id(),
356 Self::ConflictException(e) => e.request_id(),
357 Self::InternalServerException(e) => e.request_id(),
358 Self::ResourceNotFoundException(e) => e.request_id(),
359 Self::ServiceQuotaExceededException(e) => e.request_id(),
360 Self::ThrottlingException(e) => e.request_id(),
361 Self::ValidationException(e) => e.request_id(),
362 Self::Unhandled(e) => e.meta.request_id(),
363 }
364 }
365}