aws_sdk_ebs/operation/
get_snapshot_block.rs

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