aws_sdk_ebs/
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 sufficient access to perform this action.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>You have reached the limit for concurrent API requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapi-performance">Optimizing performance of the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
9    ConcurrentLimitExceededException(crate::types::error::ConcurrentLimitExceededException),
10    /// <p>The request uses the same client token as a previous, but non-identical request.</p>
11    ConflictException(crate::types::error::ConflictException),
12    /// <p>An internal error has occurred. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a>.</p>
13    InternalServerException(crate::types::error::InternalServerException),
14    /// <p>The number of API requests has exceeded the maximum allowed API request throttling limit for the snapshot. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a>.</p>
15    RequestThrottledException(crate::types::error::RequestThrottledException),
16    /// <p>The specified resource does not exist.</p>
17    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
18    /// <p>Your current service quotas do not allow you to perform this action.</p>
19    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
20    /// <p>The input fails to satisfy the constraints of the EBS direct APIs.</p>
21    ValidationException(crate::types::error::ValidationException),
22    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
23    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
24    variable wildcard pattern and check `.code()`:
25     \
26    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
27     \
28    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
29    Unhandled(crate::error::sealed_unhandled::Unhandled),
30}
31impl ::std::fmt::Display for Error {
32    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33        match self {
34            Error::AccessDeniedException(inner) => inner.fmt(f),
35            Error::ConcurrentLimitExceededException(inner) => inner.fmt(f),
36            Error::ConflictException(inner) => inner.fmt(f),
37            Error::InternalServerException(inner) => inner.fmt(f),
38            Error::RequestThrottledException(inner) => inner.fmt(f),
39            Error::ResourceNotFoundException(inner) => inner.fmt(f),
40            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
41            Error::ValidationException(inner) => inner.fmt(f),
42            Error::Unhandled(_) => {
43                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
44                    write!(f, "unhandled error ({code})")
45                } else {
46                    f.write_str("unhandled error")
47                }
48            }
49        }
50    }
51}
52impl From<::aws_smithy_types::error::operation::BuildError> for Error {
53    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
54        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
55            source: value.into(),
56            meta: ::std::default::Default::default(),
57        })
58    }
59}
60impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
61    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
62        match self {
63            Self::AccessDeniedException(inner) => inner.meta(),
64            Self::ConcurrentLimitExceededException(inner) => inner.meta(),
65            Self::ConflictException(inner) => inner.meta(),
66            Self::InternalServerException(inner) => inner.meta(),
67            Self::RequestThrottledException(inner) => inner.meta(),
68            Self::ResourceNotFoundException(inner) => inner.meta(),
69            Self::ServiceQuotaExceededException(inner) => inner.meta(),
70            Self::ValidationException(inner) => inner.meta(),
71            Self::Unhandled(inner) => &inner.meta,
72        }
73    }
74}
75impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::complete_snapshot::CompleteSnapshotError, R>> for Error
76where
77    R: Send + Sync + std::fmt::Debug + 'static,
78{
79    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::complete_snapshot::CompleteSnapshotError, R>) -> Self {
80        match err {
81            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
82            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
83                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
84                source: err.into(),
85            }),
86        }
87    }
88}
89impl From<crate::operation::complete_snapshot::CompleteSnapshotError> for Error {
90    fn from(err: crate::operation::complete_snapshot::CompleteSnapshotError) -> Self {
91        match err {
92            crate::operation::complete_snapshot::CompleteSnapshotError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
93            crate::operation::complete_snapshot::CompleteSnapshotError::InternalServerException(inner) => Error::InternalServerException(inner),
94            crate::operation::complete_snapshot::CompleteSnapshotError::RequestThrottledException(inner) => Error::RequestThrottledException(inner),
95            crate::operation::complete_snapshot::CompleteSnapshotError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
96            crate::operation::complete_snapshot::CompleteSnapshotError::ServiceQuotaExceededException(inner) => {
97                Error::ServiceQuotaExceededException(inner)
98            }
99            crate::operation::complete_snapshot::CompleteSnapshotError::ValidationException(inner) => Error::ValidationException(inner),
100            crate::operation::complete_snapshot::CompleteSnapshotError::Unhandled(inner) => Error::Unhandled(inner),
101        }
102    }
103}
104impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_snapshot_block::GetSnapshotBlockError, R>> for Error
105where
106    R: Send + Sync + std::fmt::Debug + 'static,
107{
108    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_snapshot_block::GetSnapshotBlockError, R>) -> Self {
109        match err {
110            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
111            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
112                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
113                source: err.into(),
114            }),
115        }
116    }
117}
118impl From<crate::operation::get_snapshot_block::GetSnapshotBlockError> for Error {
119    fn from(err: crate::operation::get_snapshot_block::GetSnapshotBlockError) -> Self {
120        match err {
121            crate::operation::get_snapshot_block::GetSnapshotBlockError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
122            crate::operation::get_snapshot_block::GetSnapshotBlockError::InternalServerException(inner) => Error::InternalServerException(inner),
123            crate::operation::get_snapshot_block::GetSnapshotBlockError::RequestThrottledException(inner) => Error::RequestThrottledException(inner),
124            crate::operation::get_snapshot_block::GetSnapshotBlockError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
125            crate::operation::get_snapshot_block::GetSnapshotBlockError::ServiceQuotaExceededException(inner) => {
126                Error::ServiceQuotaExceededException(inner)
127            }
128            crate::operation::get_snapshot_block::GetSnapshotBlockError::ValidationException(inner) => Error::ValidationException(inner),
129            crate::operation::get_snapshot_block::GetSnapshotBlockError::Unhandled(inner) => Error::Unhandled(inner),
130        }
131    }
132}
133impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_changed_blocks::ListChangedBlocksError, R>> for Error
134where
135    R: Send + Sync + std::fmt::Debug + 'static,
136{
137    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_changed_blocks::ListChangedBlocksError, R>) -> Self {
138        match err {
139            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
140            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
141                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
142                source: err.into(),
143            }),
144        }
145    }
146}
147impl From<crate::operation::list_changed_blocks::ListChangedBlocksError> for Error {
148    fn from(err: crate::operation::list_changed_blocks::ListChangedBlocksError) -> Self {
149        match err {
150            crate::operation::list_changed_blocks::ListChangedBlocksError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
151            crate::operation::list_changed_blocks::ListChangedBlocksError::InternalServerException(inner) => Error::InternalServerException(inner),
152            crate::operation::list_changed_blocks::ListChangedBlocksError::RequestThrottledException(inner) => {
153                Error::RequestThrottledException(inner)
154            }
155            crate::operation::list_changed_blocks::ListChangedBlocksError::ResourceNotFoundException(inner) => {
156                Error::ResourceNotFoundException(inner)
157            }
158            crate::operation::list_changed_blocks::ListChangedBlocksError::ServiceQuotaExceededException(inner) => {
159                Error::ServiceQuotaExceededException(inner)
160            }
161            crate::operation::list_changed_blocks::ListChangedBlocksError::ValidationException(inner) => Error::ValidationException(inner),
162            crate::operation::list_changed_blocks::ListChangedBlocksError::Unhandled(inner) => Error::Unhandled(inner),
163        }
164    }
165}
166impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_snapshot_blocks::ListSnapshotBlocksError, R>> for Error
167where
168    R: Send + Sync + std::fmt::Debug + 'static,
169{
170    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_snapshot_blocks::ListSnapshotBlocksError, R>) -> Self {
171        match err {
172            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
173            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
174                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
175                source: err.into(),
176            }),
177        }
178    }
179}
180impl From<crate::operation::list_snapshot_blocks::ListSnapshotBlocksError> for Error {
181    fn from(err: crate::operation::list_snapshot_blocks::ListSnapshotBlocksError) -> Self {
182        match err {
183            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
184            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::InternalServerException(inner) => Error::InternalServerException(inner),
185            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::RequestThrottledException(inner) => {
186                Error::RequestThrottledException(inner)
187            }
188            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::ResourceNotFoundException(inner) => {
189                Error::ResourceNotFoundException(inner)
190            }
191            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::ServiceQuotaExceededException(inner) => {
192                Error::ServiceQuotaExceededException(inner)
193            }
194            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::ValidationException(inner) => Error::ValidationException(inner),
195            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::Unhandled(inner) => Error::Unhandled(inner),
196        }
197    }
198}
199impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_snapshot_block::PutSnapshotBlockError, R>> for Error
200where
201    R: Send + Sync + std::fmt::Debug + 'static,
202{
203    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_snapshot_block::PutSnapshotBlockError, R>) -> Self {
204        match err {
205            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
206            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
207                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
208                source: err.into(),
209            }),
210        }
211    }
212}
213impl From<crate::operation::put_snapshot_block::PutSnapshotBlockError> for Error {
214    fn from(err: crate::operation::put_snapshot_block::PutSnapshotBlockError) -> Self {
215        match err {
216            crate::operation::put_snapshot_block::PutSnapshotBlockError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
217            crate::operation::put_snapshot_block::PutSnapshotBlockError::InternalServerException(inner) => Error::InternalServerException(inner),
218            crate::operation::put_snapshot_block::PutSnapshotBlockError::RequestThrottledException(inner) => Error::RequestThrottledException(inner),
219            crate::operation::put_snapshot_block::PutSnapshotBlockError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
220            crate::operation::put_snapshot_block::PutSnapshotBlockError::ServiceQuotaExceededException(inner) => {
221                Error::ServiceQuotaExceededException(inner)
222            }
223            crate::operation::put_snapshot_block::PutSnapshotBlockError::ValidationException(inner) => Error::ValidationException(inner),
224            crate::operation::put_snapshot_block::PutSnapshotBlockError::Unhandled(inner) => Error::Unhandled(inner),
225        }
226    }
227}
228impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_snapshot::StartSnapshotError, R>> for Error
229where
230    R: Send + Sync + std::fmt::Debug + 'static,
231{
232    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_snapshot::StartSnapshotError, R>) -> Self {
233        match err {
234            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
235            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
236                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
237                source: err.into(),
238            }),
239        }
240    }
241}
242impl From<crate::operation::start_snapshot::StartSnapshotError> for Error {
243    fn from(err: crate::operation::start_snapshot::StartSnapshotError) -> Self {
244        match err {
245            crate::operation::start_snapshot::StartSnapshotError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
246            crate::operation::start_snapshot::StartSnapshotError::ConcurrentLimitExceededException(inner) => {
247                Error::ConcurrentLimitExceededException(inner)
248            }
249            crate::operation::start_snapshot::StartSnapshotError::ConflictException(inner) => Error::ConflictException(inner),
250            crate::operation::start_snapshot::StartSnapshotError::InternalServerException(inner) => Error::InternalServerException(inner),
251            crate::operation::start_snapshot::StartSnapshotError::RequestThrottledException(inner) => Error::RequestThrottledException(inner),
252            crate::operation::start_snapshot::StartSnapshotError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
253            crate::operation::start_snapshot::StartSnapshotError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
254            crate::operation::start_snapshot::StartSnapshotError::ValidationException(inner) => Error::ValidationException(inner),
255            crate::operation::start_snapshot::StartSnapshotError::Unhandled(inner) => Error::Unhandled(inner),
256        }
257    }
258}
259impl ::std::error::Error for Error {
260    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
261        match self {
262            Error::AccessDeniedException(inner) => inner.source(),
263            Error::ConcurrentLimitExceededException(inner) => inner.source(),
264            Error::ConflictException(inner) => inner.source(),
265            Error::InternalServerException(inner) => inner.source(),
266            Error::RequestThrottledException(inner) => inner.source(),
267            Error::ResourceNotFoundException(inner) => inner.source(),
268            Error::ServiceQuotaExceededException(inner) => inner.source(),
269            Error::ValidationException(inner) => inner.source(),
270            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
271        }
272    }
273}
274impl ::aws_types::request_id::RequestId for Error {
275    fn request_id(&self) -> Option<&str> {
276        match self {
277            Self::AccessDeniedException(e) => e.request_id(),
278            Self::ConcurrentLimitExceededException(e) => e.request_id(),
279            Self::ConflictException(e) => e.request_id(),
280            Self::InternalServerException(e) => e.request_id(),
281            Self::RequestThrottledException(e) => e.request_id(),
282            Self::ResourceNotFoundException(e) => e.request_id(),
283            Self::ServiceQuotaExceededException(e) => e.request_id(),
284            Self::ValidationException(e) => e.request_id(),
285            Self::Unhandled(e) => e.meta.request_id(),
286        }
287    }
288}