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