aws_sdk_ebs/operation/
list_snapshot_blocks.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `ListSnapshotBlocks`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct ListSnapshotBlocks;
6impl ListSnapshotBlocks {
7    /// Creates a new `ListSnapshotBlocks`
8    pub fn new() -> Self {
9        Self
10    }
11    pub(crate) async fn orchestrate(
12        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13        input: crate::operation::list_snapshot_blocks::ListSnapshotBlocksInput,
14    ) -> ::std::result::Result<
15        crate::operation::list_snapshot_blocks::ListSnapshotBlocksOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::list_snapshot_blocks::ListSnapshotBlocksError,
18            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19        >,
20    > {
21        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22            ::aws_smithy_runtime_api::client::interceptors::context::Error,
23            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24        >| {
25            err.map_service_error(|err| {
26                err.downcast::<crate::operation::list_snapshot_blocks::ListSnapshotBlocksError>()
27                    .expect("correct error type")
28            })
29        };
30        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31            .await
32            .map_err(map_err)?;
33        let output = context.finalize().map_err(map_err)?;
34        ::std::result::Result::Ok(
35            output
36                .downcast::<crate::operation::list_snapshot_blocks::ListSnapshotBlocksOutput>()
37                .expect("correct output type"),
38        )
39    }
40
41    pub(crate) async fn orchestrate_with_stop_point(
42        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43        input: crate::operation::list_snapshot_blocks::ListSnapshotBlocksInput,
44        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45    ) -> ::std::result::Result<
46        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47        ::aws_smithy_runtime_api::client::result::SdkError<
48            ::aws_smithy_runtime_api::client::interceptors::context::Error,
49            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50        >,
51    > {
52        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53        use ::tracing::Instrument;
54        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("EBS", "ListSnapshotBlocks", input, runtime_plugins, stop_point)
55            // Create a parent span for the entire operation. Includes a random, internal-only,
56            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
57            .instrument(::tracing::debug_span!(
58                "EBS.ListSnapshotBlocks",
59                "rpc.service" = "EBS",
60                "rpc.method" = "ListSnapshotBlocks",
61                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62                "rpc.system" = "aws-api",
63            ))
64            .await
65    }
66
67    pub(crate) fn operation_runtime_plugins(
68        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69        client_config: &crate::config::Config,
70        config_override: ::std::option::Option<crate::config::Builder>,
71    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73        runtime_plugins = runtime_plugins.with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
74            ::aws_runtime::auth::sigv4::SCHEME_ID,
75        ]));
76        if let ::std::option::Option::Some(config_override) = config_override {
77            for plugin in config_override.runtime_plugins.iter().cloned() {
78                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
79            }
80            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
81                config_override,
82                client_config.config.clone(),
83                &client_config.runtime_components,
84            ));
85        }
86        runtime_plugins
87    }
88}
89impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ListSnapshotBlocks {
90    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
91        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListSnapshotBlocks");
92
93        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
94            ListSnapshotBlocksRequestSerializer,
95        ));
96        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
97            ListSnapshotBlocksResponseDeserializer,
98        ));
99
100        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
101            ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
102        ));
103
104        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
105        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("ListSnapshotBlocks", "EBS"));
106        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
107        signing_options.double_uri_encode = true;
108        signing_options.content_sha256_header = false;
109        signing_options.normalize_uri_path = true;
110        signing_options.payload_override = None;
111
112        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
113            signing_options,
114            ..::std::default::Default::default()
115        });
116
117        ::std::option::Option::Some(cfg.freeze())
118    }
119
120    fn runtime_components(
121        &self,
122        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
123    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
124        #[allow(unused_mut)]
125        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListSnapshotBlocks")
126            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
127            .with_interceptor(ListSnapshotBlocksEndpointParamsInterceptor)
128            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
129                crate::operation::list_snapshot_blocks::ListSnapshotBlocksError,
130            >::new())
131            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
132                crate::operation::list_snapshot_blocks::ListSnapshotBlocksError,
133            >::new())
134            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
135                crate::operation::list_snapshot_blocks::ListSnapshotBlocksError,
136            >::new());
137
138        ::std::borrow::Cow::Owned(rcb)
139    }
140}
141
142#[derive(Debug)]
143struct ListSnapshotBlocksResponseDeserializer;
144impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListSnapshotBlocksResponseDeserializer {
145    fn deserialize_nonstreaming(
146        &self,
147        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
148    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
149        let (success, status) = (response.status().is_success(), response.status().as_u16());
150        let headers = response.headers();
151        let body = response.body().bytes().expect("body loaded");
152        #[allow(unused_mut)]
153        let mut force_error = false;
154        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
155        let parse_result = if !success && status != 200 || force_error {
156            crate::protocol_serde::shape_list_snapshot_blocks::de_list_snapshot_blocks_http_error(status, headers, body)
157        } else {
158            crate::protocol_serde::shape_list_snapshot_blocks::de_list_snapshot_blocks_http_response(status, headers, body)
159        };
160        crate::protocol_serde::type_erase_result(parse_result)
161    }
162}
163#[derive(Debug)]
164struct ListSnapshotBlocksRequestSerializer;
165impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListSnapshotBlocksRequestSerializer {
166    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
167    fn serialize_input(
168        &self,
169        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
170        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
171    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
172        let input = input
173            .downcast::<crate::operation::list_snapshot_blocks::ListSnapshotBlocksInput>()
174            .expect("correct type");
175        let _header_serialization_settings = _cfg
176            .load::<crate::serialization_settings::HeaderSerializationSettings>()
177            .cloned()
178            .unwrap_or_default();
179        let mut request_builder = {
180            fn uri_base(
181                _input: &crate::operation::list_snapshot_blocks::ListSnapshotBlocksInput,
182                output: &mut ::std::string::String,
183            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
184                use ::std::fmt::Write as _;
185                let input_1 = &_input.snapshot_id;
186                let input_1 = input_1
187                    .as_ref()
188                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("snapshot_id", "cannot be empty or unset"))?;
189                let snapshot_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
190                if snapshot_id.is_empty() {
191                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
192                        "snapshot_id",
193                        "cannot be empty or unset",
194                    ));
195                }
196                ::std::write!(output, "/snapshots/{SnapshotId}/blocks", SnapshotId = snapshot_id).expect("formatting should succeed");
197                ::std::result::Result::Ok(())
198            }
199            fn uri_query(
200                _input: &crate::operation::list_snapshot_blocks::ListSnapshotBlocksInput,
201                mut output: &mut ::std::string::String,
202            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
203                let mut query = ::aws_smithy_http::query::Writer::new(output);
204                if let ::std::option::Option::Some(inner_2) = &_input.next_token {
205                    {
206                        query.push_kv("pageToken", &::aws_smithy_http::query::fmt_string(inner_2));
207                    }
208                }
209                if let ::std::option::Option::Some(inner_3) = &_input.max_results {
210                    {
211                        query.push_kv("maxResults", ::aws_smithy_types::primitive::Encoder::from(*inner_3).encode());
212                    }
213                }
214                if let ::std::option::Option::Some(inner_4) = &_input.starting_block_index {
215                    {
216                        query.push_kv("startingBlockIndex", ::aws_smithy_types::primitive::Encoder::from(*inner_4).encode());
217                    }
218                }
219                ::std::result::Result::Ok(())
220            }
221            #[allow(clippy::unnecessary_wraps)]
222            fn update_http_builder(
223                input: &crate::operation::list_snapshot_blocks::ListSnapshotBlocksInput,
224                builder: ::http::request::Builder,
225            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
226                let mut uri = ::std::string::String::new();
227                uri_base(input, &mut uri)?;
228                uri_query(input, &mut uri)?;
229                ::std::result::Result::Ok(builder.method("GET").uri(uri))
230            }
231            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
232            builder
233        };
234        let body = ::aws_smithy_types::body::SdkBody::from("");
235
236        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
237    }
238}
239#[derive(Debug)]
240struct ListSnapshotBlocksEndpointParamsInterceptor;
241
242impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListSnapshotBlocksEndpointParamsInterceptor {
243    fn name(&self) -> &'static str {
244        "ListSnapshotBlocksEndpointParamsInterceptor"
245    }
246
247    fn read_before_execution(
248        &self,
249        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
250            '_,
251            ::aws_smithy_runtime_api::client::interceptors::context::Input,
252            ::aws_smithy_runtime_api::client::interceptors::context::Output,
253            ::aws_smithy_runtime_api::client::interceptors::context::Error,
254        >,
255        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
256    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
257        let _input = context
258            .input()
259            .downcast_ref::<ListSnapshotBlocksInput>()
260            .ok_or("failed to downcast to ListSnapshotBlocksInput")?;
261
262        let params = crate::config::endpoint::Params::builder()
263            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
264            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
265            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
266            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
267            .build()
268            .map_err(|err| {
269                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
270            })?;
271        cfg.interceptor_state()
272            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
273        ::std::result::Result::Ok(())
274    }
275}
276
277// The get_* functions below are generated from JMESPath expressions in the
278// operationContextParams trait. They target the operation's input shape.
279
280#[allow(unreachable_code, unused_variables)]
281#[cfg(test)]
282mod list_snapshot_blocks_test {
283
284    /// This test case validates case insensitive parsing of `message`
285    /// Test ID: LowercaseMessage
286    #[::tokio::test]
287    #[::tracing_test::traced_test]
288    async fn lowercase_message_response() {
289        let expected_output = crate::types::error::ValidationException::builder()
290            .set_message(::std::option::Option::Some("1 validation error detected".to_owned()))
291            .build();
292        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
293            ::http::response::Builder::new()
294                .header("content-length", "77")
295                .header("content-type", "application/json")
296                .header("date", "Wed, 30 Jun 2021 23:42:27 GMT")
297                .header(
298                    "x-amzn-errortype",
299                    "ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/",
300                )
301                .header("x-amzn-requestid", "2af8f013-250a-4f6e-88ae-6dd7f6e12807")
302                .status(400)
303                .body(::aws_smithy_types::body::SdkBody::from(
304                    "{\n  \"message\": \"1 validation error detected\"\n}\n",
305                ))
306                .unwrap(),
307        )
308        .unwrap();
309        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
310        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
311
312        let op = crate::operation::list_snapshot_blocks::ListSnapshotBlocks::new();
313        let config = op.config().expect("the operation has config");
314        let de = config
315            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
316            .expect("the config must have a deserializer");
317
318        let parsed = de.deserialize_streaming(&mut http_response);
319        let parsed = parsed.unwrap_or_else(|| {
320            let http_response = http_response.map(|body| {
321                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
322                    body.bytes().unwrap(),
323                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
324                )))
325            });
326            de.deserialize_nonstreaming(&http_response)
327        });
328        let parsed = parsed.expect_err("should be error response");
329        let parsed: &crate::operation::list_snapshot_blocks::ListSnapshotBlocksError =
330            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
331        if let crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::ValidationException(parsed) = parsed {
332            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
333            ::pretty_assertions::assert_eq!(parsed.reason, expected_output.reason, "Unexpected value for `reason`");
334        } else {
335            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
336        }
337    }
338
339    /// This test case validates case insensitive parsing of `message`
340    /// Test ID: UppercaseMessage
341    #[::tokio::test]
342    #[::tracing_test::traced_test]
343    async fn uppercase_message_response() {
344        let expected_output = crate::types::error::ValidationException::builder()
345            .set_message(::std::option::Option::Some("Invalid volume size: 99999999999".to_owned()))
346            .set_reason(::std::option::Option::Some(
347                "INVALID_VOLUME_SIZE"
348                    .parse::<crate::types::ValidationExceptionReason>()
349                    .expect("static value validated to member"),
350            ))
351            .build();
352        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
353            ::http::response::Builder::new()
354                .header("content-length", "77")
355                .header("content-type", "application/json")
356                .header("date", "Wed, 30 Jun 2021 23:42:27 GMT")
357                .header(
358                    "x-amzn-errortype",
359                    "ValidationException:http://internal.amazon.com/coral/com.amazon.zeppelindataservice/",
360                )
361                .header("x-amzn-requestid", "2af8f013-250a-4f6e-88ae-6dd7f6e12807")
362                .status(400)
363                .body(::aws_smithy_types::body::SdkBody::from(
364                    "{\"Message\":\"Invalid volume size: 99999999999\",\"Reason\":\"INVALID_VOLUME_SIZE\"}\n",
365                ))
366                .unwrap(),
367        )
368        .unwrap();
369        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
370        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
371
372        let op = crate::operation::list_snapshot_blocks::ListSnapshotBlocks::new();
373        let config = op.config().expect("the operation has config");
374        let de = config
375            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
376            .expect("the config must have a deserializer");
377
378        let parsed = de.deserialize_streaming(&mut http_response);
379        let parsed = parsed.unwrap_or_else(|| {
380            let http_response = http_response.map(|body| {
381                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
382                    body.bytes().unwrap(),
383                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
384                )))
385            });
386            de.deserialize_nonstreaming(&http_response)
387        });
388        let parsed = parsed.expect_err("should be error response");
389        let parsed: &crate::operation::list_snapshot_blocks::ListSnapshotBlocksError =
390            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
391        if let crate::operation::list_snapshot_blocks::ListSnapshotBlocksError::ValidationException(parsed) = parsed {
392            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
393            ::pretty_assertions::assert_eq!(parsed.reason, expected_output.reason, "Unexpected value for `reason`");
394        } else {
395            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
396        }
397    }
398}
399
400/// Error type for the `ListSnapshotBlocksError` operation.
401#[non_exhaustive]
402#[derive(::std::fmt::Debug)]
403pub enum ListSnapshotBlocksError {
404    /// <p>You do not have sufficient access to perform this action.</p>
405    AccessDeniedException(crate::types::error::AccessDeniedException),
406    /// <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>
407    InternalServerException(crate::types::error::InternalServerException),
408    /// <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>
409    RequestThrottledException(crate::types::error::RequestThrottledException),
410    /// <p>The specified resource does not exist.</p>
411    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
412    /// <p>Your current service quotas do not allow you to perform this action.</p>
413    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
414    /// <p>The input fails to satisfy the constraints of the EBS direct APIs.</p>
415    ValidationException(crate::types::error::ValidationException),
416    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
417    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
418    variable wildcard pattern and check `.code()`:
419     \
420    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
421     \
422    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListSnapshotBlocksError) for what information is available for the error.")]
423    Unhandled(crate::error::sealed_unhandled::Unhandled),
424}
425impl ListSnapshotBlocksError {
426    /// Creates the `ListSnapshotBlocksError::Unhandled` variant from any error type.
427    pub fn unhandled(
428        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
429    ) -> Self {
430        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
431            source: err.into(),
432            meta: ::std::default::Default::default(),
433        })
434    }
435
436    /// Creates the `ListSnapshotBlocksError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
437    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
438        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
439            source: err.clone().into(),
440            meta: err,
441        })
442    }
443    ///
444    /// Returns error metadata, which includes the error code, message,
445    /// request ID, and potentially additional information.
446    ///
447    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
448        match self {
449            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
450            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
451            Self::RequestThrottledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
452            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
453            Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
454            Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
455            Self::Unhandled(e) => &e.meta,
456        }
457    }
458    /// Returns `true` if the error kind is `ListSnapshotBlocksError::AccessDeniedException`.
459    pub fn is_access_denied_exception(&self) -> bool {
460        matches!(self, Self::AccessDeniedException(_))
461    }
462    /// Returns `true` if the error kind is `ListSnapshotBlocksError::InternalServerException`.
463    pub fn is_internal_server_exception(&self) -> bool {
464        matches!(self, Self::InternalServerException(_))
465    }
466    /// Returns `true` if the error kind is `ListSnapshotBlocksError::RequestThrottledException`.
467    pub fn is_request_throttled_exception(&self) -> bool {
468        matches!(self, Self::RequestThrottledException(_))
469    }
470    /// Returns `true` if the error kind is `ListSnapshotBlocksError::ResourceNotFoundException`.
471    pub fn is_resource_not_found_exception(&self) -> bool {
472        matches!(self, Self::ResourceNotFoundException(_))
473    }
474    /// Returns `true` if the error kind is `ListSnapshotBlocksError::ServiceQuotaExceededException`.
475    pub fn is_service_quota_exceeded_exception(&self) -> bool {
476        matches!(self, Self::ServiceQuotaExceededException(_))
477    }
478    /// Returns `true` if the error kind is `ListSnapshotBlocksError::ValidationException`.
479    pub fn is_validation_exception(&self) -> bool {
480        matches!(self, Self::ValidationException(_))
481    }
482}
483impl ::std::error::Error for ListSnapshotBlocksError {
484    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
485        match self {
486            Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
487            Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
488            Self::RequestThrottledException(_inner) => ::std::option::Option::Some(_inner),
489            Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
490            Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
491            Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
492            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
493        }
494    }
495}
496impl ::std::fmt::Display for ListSnapshotBlocksError {
497    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
498        match self {
499            Self::AccessDeniedException(_inner) => _inner.fmt(f),
500            Self::InternalServerException(_inner) => _inner.fmt(f),
501            Self::RequestThrottledException(_inner) => _inner.fmt(f),
502            Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
503            Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
504            Self::ValidationException(_inner) => _inner.fmt(f),
505            Self::Unhandled(_inner) => {
506                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
507                    write!(f, "unhandled error ({code})")
508                } else {
509                    f.write_str("unhandled error")
510                }
511            }
512        }
513    }
514}
515impl ::aws_smithy_types::retry::ProvideErrorKind for ListSnapshotBlocksError {
516    fn code(&self) -> ::std::option::Option<&str> {
517        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
518    }
519    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
520        ::std::option::Option::None
521    }
522}
523impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListSnapshotBlocksError {
524    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
525        match self {
526            Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
527            Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
528            Self::RequestThrottledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
529            Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
530            Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
531            Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
532            Self::Unhandled(_inner) => &_inner.meta,
533        }
534    }
535}
536impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListSnapshotBlocksError {
537    fn create_unhandled_error(
538        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
539        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
540    ) -> Self {
541        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
542            source,
543            meta: meta.unwrap_or_default(),
544        })
545    }
546}
547impl ::aws_types::request_id::RequestId for crate::operation::list_snapshot_blocks::ListSnapshotBlocksError {
548    fn request_id(&self) -> Option<&str> {
549        self.meta().request_id()
550    }
551}
552
553pub use crate::operation::list_snapshot_blocks::_list_snapshot_blocks_output::ListSnapshotBlocksOutput;
554
555pub use crate::operation::list_snapshot_blocks::_list_snapshot_blocks_input::ListSnapshotBlocksInput;
556
557mod _list_snapshot_blocks_input;
558
559mod _list_snapshot_blocks_output;
560
561/// Builders
562pub mod builders;
563
564/// Paginator for this operation
565pub mod paginator;