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::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
91 crate::operation::create_cluster::CreateClusterError::InternalServerException(inner) => Error::InternalServerException(inner),
92 crate::operation::create_cluster::CreateClusterError::ThrottlingException(inner) => Error::ThrottlingException(inner),
93 crate::operation::create_cluster::CreateClusterError::ValidationException(inner) => Error::ValidationException(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::create_multi_region_clusters::CreateMultiRegionClustersError, R>>
99 for Error
100where
101 R: Send + Sync + std::fmt::Debug + 'static,
102{
103 fn from(
104 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError, R>,
105 ) -> Self {
106 match err {
107 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
108 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
109 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
110 source: err.into(),
111 }),
112 }
113 }
114}
115impl From<crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError> for Error {
116 fn from(err: crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError) -> Self {
117 match err {
118 crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError::ConflictException(inner) => {
119 Error::ConflictException(inner)
120 }
121 crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError::ServiceQuotaExceededException(inner) => {
122 Error::ServiceQuotaExceededException(inner)
123 }
124 crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError::AccessDeniedException(inner) => {
125 Error::AccessDeniedException(inner)
126 }
127 crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError::InternalServerException(inner) => {
128 Error::InternalServerException(inner)
129 }
130 crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError::ThrottlingException(inner) => {
131 Error::ThrottlingException(inner)
132 }
133 crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError::ValidationException(inner) => {
134 Error::ValidationException(inner)
135 }
136 crate::operation::create_multi_region_clusters::CreateMultiRegionClustersError::Unhandled(inner) => Error::Unhandled(inner),
137 }
138 }
139}
140impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_cluster::DeleteClusterError, R>> for Error
141where
142 R: Send + Sync + std::fmt::Debug + 'static,
143{
144 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_cluster::DeleteClusterError, R>) -> Self {
145 match err {
146 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
147 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
148 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
149 source: err.into(),
150 }),
151 }
152 }
153}
154impl From<crate::operation::delete_cluster::DeleteClusterError> for Error {
155 fn from(err: crate::operation::delete_cluster::DeleteClusterError) -> Self {
156 match err {
157 crate::operation::delete_cluster::DeleteClusterError::ConflictException(inner) => Error::ConflictException(inner),
158 crate::operation::delete_cluster::DeleteClusterError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
159 crate::operation::delete_cluster::DeleteClusterError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
160 crate::operation::delete_cluster::DeleteClusterError::InternalServerException(inner) => Error::InternalServerException(inner),
161 crate::operation::delete_cluster::DeleteClusterError::ThrottlingException(inner) => Error::ThrottlingException(inner),
162 crate::operation::delete_cluster::DeleteClusterError::ValidationException(inner) => Error::ValidationException(inner),
163 crate::operation::delete_cluster::DeleteClusterError::Unhandled(inner) => Error::Unhandled(inner),
164 }
165 }
166}
167impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError, R>>
168 for Error
169where
170 R: Send + Sync + std::fmt::Debug + 'static,
171{
172 fn from(
173 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError, R>,
174 ) -> Self {
175 match err {
176 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
177 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
178 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
179 source: err.into(),
180 }),
181 }
182 }
183}
184impl From<crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError> for Error {
185 fn from(err: crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError) -> Self {
186 match err {
187 crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError::ConflictException(inner) => {
188 Error::ConflictException(inner)
189 }
190 crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError::ResourceNotFoundException(inner) => {
191 Error::ResourceNotFoundException(inner)
192 }
193 crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError::AccessDeniedException(inner) => {
194 Error::AccessDeniedException(inner)
195 }
196 crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError::InternalServerException(inner) => {
197 Error::InternalServerException(inner)
198 }
199 crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError::ThrottlingException(inner) => {
200 Error::ThrottlingException(inner)
201 }
202 crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError::ValidationException(inner) => {
203 Error::ValidationException(inner)
204 }
205 crate::operation::delete_multi_region_clusters::DeleteMultiRegionClustersError::Unhandled(inner) => Error::Unhandled(inner),
206 }
207 }
208}
209impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_cluster::GetClusterError, R>> for Error
210where
211 R: Send + Sync + std::fmt::Debug + 'static,
212{
213 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_cluster::GetClusterError, R>) -> Self {
214 match err {
215 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
216 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
217 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
218 source: err.into(),
219 }),
220 }
221 }
222}
223impl From<crate::operation::get_cluster::GetClusterError> for Error {
224 fn from(err: crate::operation::get_cluster::GetClusterError) -> Self {
225 match err {
226 crate::operation::get_cluster::GetClusterError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
227 crate::operation::get_cluster::GetClusterError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
228 crate::operation::get_cluster::GetClusterError::InternalServerException(inner) => Error::InternalServerException(inner),
229 crate::operation::get_cluster::GetClusterError::ThrottlingException(inner) => Error::ThrottlingException(inner),
230 crate::operation::get_cluster::GetClusterError::ValidationException(inner) => Error::ValidationException(inner),
231 crate::operation::get_cluster::GetClusterError::Unhandled(inner) => Error::Unhandled(inner),
232 }
233 }
234}
235impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_clusters::ListClustersError, R>> for Error
236where
237 R: Send + Sync + std::fmt::Debug + 'static,
238{
239 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_clusters::ListClustersError, R>) -> Self {
240 match err {
241 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
242 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
243 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
244 source: err.into(),
245 }),
246 }
247 }
248}
249impl From<crate::operation::list_clusters::ListClustersError> for Error {
250 fn from(err: crate::operation::list_clusters::ListClustersError) -> Self {
251 match err {
252 crate::operation::list_clusters::ListClustersError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
253 crate::operation::list_clusters::ListClustersError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
254 crate::operation::list_clusters::ListClustersError::InternalServerException(inner) => Error::InternalServerException(inner),
255 crate::operation::list_clusters::ListClustersError::ThrottlingException(inner) => Error::ThrottlingException(inner),
256 crate::operation::list_clusters::ListClustersError::ValidationException(inner) => Error::ValidationException(inner),
257 crate::operation::list_clusters::ListClustersError::Unhandled(inner) => Error::Unhandled(inner),
258 }
259 }
260}
261impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
262where
263 R: Send + Sync + std::fmt::Debug + 'static,
264{
265 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
266 match err {
267 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
268 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
269 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
270 source: err.into(),
271 }),
272 }
273 }
274}
275impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
276 fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
277 match err {
278 crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
279 Error::ResourceNotFoundException(inner)
280 }
281 crate::operation::list_tags_for_resource::ListTagsForResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
282 crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
283 Error::InternalServerException(inner)
284 }
285 crate::operation::list_tags_for_resource::ListTagsForResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
286 crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
287 crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
288 }
289 }
290}
291impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
292where
293 R: Send + Sync + std::fmt::Debug + 'static,
294{
295 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
296 match err {
297 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
298 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
299 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
300 source: err.into(),
301 }),
302 }
303 }
304}
305impl From<crate::operation::tag_resource::TagResourceError> for Error {
306 fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
307 match err {
308 crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
309 crate::operation::tag_resource::TagResourceError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
310 crate::operation::tag_resource::TagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
311 crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
312 crate::operation::tag_resource::TagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
313 crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
314 crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
315 }
316 }
317}
318impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
319where
320 R: Send + Sync + std::fmt::Debug + 'static,
321{
322 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
323 match err {
324 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
325 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
326 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
327 source: err.into(),
328 }),
329 }
330 }
331}
332impl From<crate::operation::untag_resource::UntagResourceError> for Error {
333 fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
334 match err {
335 crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
336 crate::operation::untag_resource::UntagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
337 crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
338 crate::operation::untag_resource::UntagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
339 crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
340 crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
341 }
342 }
343}
344impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_cluster::UpdateClusterError, R>> for Error
345where
346 R: Send + Sync + std::fmt::Debug + 'static,
347{
348 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_cluster::UpdateClusterError, R>) -> Self {
349 match err {
350 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
351 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
352 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
353 source: err.into(),
354 }),
355 }
356 }
357}
358impl From<crate::operation::update_cluster::UpdateClusterError> for Error {
359 fn from(err: crate::operation::update_cluster::UpdateClusterError) -> Self {
360 match err {
361 crate::operation::update_cluster::UpdateClusterError::ConflictException(inner) => Error::ConflictException(inner),
362 crate::operation::update_cluster::UpdateClusterError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
363 crate::operation::update_cluster::UpdateClusterError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
364 crate::operation::update_cluster::UpdateClusterError::InternalServerException(inner) => Error::InternalServerException(inner),
365 crate::operation::update_cluster::UpdateClusterError::ThrottlingException(inner) => Error::ThrottlingException(inner),
366 crate::operation::update_cluster::UpdateClusterError::ValidationException(inner) => Error::ValidationException(inner),
367 crate::operation::update_cluster::UpdateClusterError::Unhandled(inner) => Error::Unhandled(inner),
368 }
369 }
370}
371impl<O, E> ::std::convert::From<::aws_smithy_runtime_api::client::waiters::error::WaiterError<O, E>> for Error
372where
373 O: ::std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
374 E: ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static,
375{
376 fn from(err: ::aws_smithy_runtime_api::client::waiters::error::WaiterError<O, E>) -> Self {
377 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
378 meta: ::std::default::Default::default(),
379 source: err.into(),
380 })
381 }
382}
383impl ::std::error::Error for Error {
384 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
385 match self {
386 Error::AccessDeniedException(inner) => inner.source(),
387 Error::ConflictException(inner) => inner.source(),
388 Error::InternalServerException(inner) => inner.source(),
389 Error::ResourceNotFoundException(inner) => inner.source(),
390 Error::ServiceQuotaExceededException(inner) => inner.source(),
391 Error::ThrottlingException(inner) => inner.source(),
392 Error::ValidationException(inner) => inner.source(),
393 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
394 }
395 }
396}
397impl ::aws_types::request_id::RequestId for Error {
398 fn request_id(&self) -> Option<&str> {
399 match self {
400 Self::AccessDeniedException(e) => e.request_id(),
401 Self::ConflictException(e) => e.request_id(),
402 Self::InternalServerException(e) => e.request_id(),
403 Self::ResourceNotFoundException(e) => e.request_id(),
404 Self::ServiceQuotaExceededException(e) => e.request_id(),
405 Self::ThrottlingException(e) => e.request_id(),
406 Self::ValidationException(e) => e.request_id(),
407 Self::Unhandled(e) => e.meta.request_id(),
408 }
409 }
410}