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            fn uri_base(
194                _input: &crate::operation::get_snapshot_block::GetSnapshotBlockInput,
195                output: &mut ::std::string::String,
196            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
197                use ::std::fmt::Write as _;
198                let input_1 = &_input.snapshot_id;
199                let input_1 = input_1
200                    .as_ref()
201                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("snapshot_id", "cannot be empty or unset"))?;
202                let snapshot_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
203                if snapshot_id.is_empty() {
204                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
205                        "snapshot_id",
206                        "cannot be empty or unset",
207                    ));
208                }
209                let input_2 = &_input.block_index;
210                let input_2 = input_2
211                    .as_ref()
212                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("block_index", "cannot be empty or unset"))?;
213                let mut block_index_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_2);
214                let block_index = block_index_encoder.encode();
215                if block_index.is_empty() {
216                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
217                        "block_index",
218                        "cannot be empty or unset",
219                    ));
220                }
221                ::std::write!(
222                    output,
223                    "/snapshots/{SnapshotId}/blocks/{BlockIndex}",
224                    SnapshotId = snapshot_id,
225                    BlockIndex = block_index
226                )
227                .expect("formatting should succeed");
228                ::std::result::Result::Ok(())
229            }
230            fn uri_query(
231                _input: &crate::operation::get_snapshot_block::GetSnapshotBlockInput,
232                mut output: &mut ::std::string::String,
233            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
234                let mut query = ::aws_smithy_http::query::Writer::new(output);
235                let inner_3 = &_input.block_token;
236                let inner_3 = inner_3
237                    .as_ref()
238                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("block_token", "cannot be empty or unset"))?;
239                if inner_3.is_empty() {
240                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
241                        "block_token",
242                        "cannot be empty or unset",
243                    ));
244                }
245                query.push_kv("blockToken", &::aws_smithy_http::query::fmt_string(inner_3));
246                ::std::result::Result::Ok(())
247            }
248            #[allow(clippy::unnecessary_wraps)]
249            fn update_http_builder(
250                input: &crate::operation::get_snapshot_block::GetSnapshotBlockInput,
251                builder: ::http::request::Builder,
252            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
253                let mut uri = ::std::string::String::new();
254                uri_base(input, &mut uri)?;
255                uri_query(input, &mut uri)?;
256                ::std::result::Result::Ok(builder.method("GET").uri(uri))
257            }
258            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
259            builder
260        };
261        let body = ::aws_smithy_types::body::SdkBody::from("");
262
263        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
264    }
265}
266#[derive(Debug)]
267struct GetSnapshotBlockEndpointParamsInterceptor;
268
269impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetSnapshotBlockEndpointParamsInterceptor {
270    fn name(&self) -> &'static str {
271        "GetSnapshotBlockEndpointParamsInterceptor"
272    }
273
274    fn read_before_execution(
275        &self,
276        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
277            '_,
278            ::aws_smithy_runtime_api::client::interceptors::context::Input,
279            ::aws_smithy_runtime_api::client::interceptors::context::Output,
280            ::aws_smithy_runtime_api::client::interceptors::context::Error,
281        >,
282        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
283    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
284        let _input = context
285            .input()
286            .downcast_ref::<GetSnapshotBlockInput>()
287            .ok_or("failed to downcast to GetSnapshotBlockInput")?;
288
289        let params = crate::config::endpoint::Params::builder()
290            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
291            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
292            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
293            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
294            .build()
295            .map_err(|err| {
296                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
297            })?;
298        cfg.interceptor_state()
299            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
300        ::std::result::Result::Ok(())
301    }
302}
303
304// The get_* functions below are generated from JMESPath expressions in the
305// operationContextParams trait. They target the operation's input shape.
306
307#[allow(unreachable_code, unused_variables)]
308#[cfg(test)]
309mod get_snapshot_block_test {
310
311    /// This test case validates case insensitive parsing of `message`
312    /// Test ID: LowercaseMessage
313    #[::tokio::test]
314    #[::tracing_test::traced_test]
315    async fn lowercase_message_response() {
316        let expected_output = crate::types::error::ValidationException::builder()
317            .set_message(::std::option::Option::Some("1 validation error detected".to_owned()))
318            .build();
319        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
320            ::http::response::Builder::new()
321                .header("content-length", "77")
322                .header("content-type", "application/json")
323                .header("date", "Wed, 30 Jun 2021 23:42:27 GMT")
324                .header(
325                    "x-amzn-errortype",
326                    "ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/",
327                )
328                .header("x-amzn-requestid", "2af8f013-250a-4f6e-88ae-6dd7f6e12807")
329                .status(400)
330                .body(::aws_smithy_types::body::SdkBody::from(
331                    "{\n  \"message\": \"1 validation error detected\"\n}\n",
332                ))
333                .unwrap(),
334        )
335        .unwrap();
336        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
337        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
338
339        let op = crate::operation::get_snapshot_block::GetSnapshotBlock::new();
340        let config = op.config().expect("the operation has config");
341        let de = config
342            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
343            .expect("the config must have a deserializer");
344
345        let parsed = de.deserialize_streaming(&mut http_response);
346        let parsed = parsed.unwrap_or_else(|| {
347            let http_response = http_response.map(|body| {
348                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
349                    body.bytes().unwrap(),
350                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
351                )))
352            });
353            de.deserialize_nonstreaming(&http_response)
354        });
355        let parsed = parsed.expect_err("should be error response");
356        let parsed: &crate::operation::get_snapshot_block::GetSnapshotBlockError =
357            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
358        if let crate::operation::get_snapshot_block::GetSnapshotBlockError::ValidationException(parsed) = parsed {
359            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
360            ::pretty_assertions::assert_eq!(parsed.reason, expected_output.reason, "Unexpected value for `reason`");
361        } else {
362            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
363        }
364    }
365
366    /// This test case validates case insensitive parsing of `message`
367    /// Test ID: UppercaseMessage
368    #[::tokio::test]
369    #[::tracing_test::traced_test]
370    async fn uppercase_message_response() {
371        let expected_output = crate::types::error::ValidationException::builder()
372            .set_message(::std::option::Option::Some("Invalid volume size: 99999999999".to_owned()))
373            .set_reason(::std::option::Option::Some(
374                "INVALID_VOLUME_SIZE"
375                    .parse::<crate::types::ValidationExceptionReason>()
376                    .expect("static value validated to member"),
377            ))
378            .build();
379        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
380            ::http::response::Builder::new()
381                .header("content-length", "77")
382                .header("content-type", "application/json")
383                .header("date", "Wed, 30 Jun 2021 23:42:27 GMT")
384                .header(
385                    "x-amzn-errortype",
386                    "ValidationException:http://internal.amazon.com/coral/com.amazon.zeppelindataservice/",
387                )
388                .header("x-amzn-requestid", "2af8f013-250a-4f6e-88ae-6dd7f6e12807")
389                .status(400)
390                .body(::aws_smithy_types::body::SdkBody::from(
391                    "{\"Message\":\"Invalid volume size: 99999999999\",\"Reason\":\"INVALID_VOLUME_SIZE\"}\n",
392                ))
393                .unwrap(),
394        )
395        .unwrap();
396        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
397        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
398
399        let op = crate::operation::get_snapshot_block::GetSnapshotBlock::new();
400        let config = op.config().expect("the operation has config");
401        let de = config
402            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
403            .expect("the config must have a deserializer");
404
405        let parsed = de.deserialize_streaming(&mut http_response);
406        let parsed = parsed.unwrap_or_else(|| {
407            let http_response = http_response.map(|body| {
408                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
409                    body.bytes().unwrap(),
410                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
411                )))
412            });
413            de.deserialize_nonstreaming(&http_response)
414        });
415        let parsed = parsed.expect_err("should be error response");
416        let parsed: &crate::operation::get_snapshot_block::GetSnapshotBlockError =
417            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
418        if let crate::operation::get_snapshot_block::GetSnapshotBlockError::ValidationException(parsed) = parsed {
419            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
420            ::pretty_assertions::assert_eq!(parsed.reason, expected_output.reason, "Unexpected value for `reason`");
421        } else {
422            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
423        }
424    }
425}
426
427/// Error type for the `GetSnapshotBlockError` operation.
428#[non_exhaustive]
429#[derive(::std::fmt::Debug)]
430pub enum GetSnapshotBlockError {
431    /// <p>You do not have sufficient access to perform this action.</p>
432    AccessDeniedException(crate::types::error::AccessDeniedException),
433    /// <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>
434    InternalServerException(crate::types::error::InternalServerException),
435    /// <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>
436    RequestThrottledException(crate::types::error::RequestThrottledException),
437    /// <p>The specified resource does not exist.</p>
438    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
439    /// <p>Your current service quotas do not allow you to perform this action.</p>
440    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
441    /// <p>The input fails to satisfy the constraints of the EBS direct APIs.</p>
442    ValidationException(crate::types::error::ValidationException),
443    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
444    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
445    variable wildcard pattern and check `.code()`:
446     \
447    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
448     \
449    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetSnapshotBlockError) for what information is available for the error.")]
450    Unhandled(crate::error::sealed_unhandled::Unhandled),
451}
452impl GetSnapshotBlockError {
453    /// Creates the `GetSnapshotBlockError::Unhandled` variant from any error type.
454    pub fn unhandled(
455        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
456    ) -> Self {
457        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
458            source: err.into(),
459            meta: ::std::default::Default::default(),
460        })
461    }
462
463    /// Creates the `GetSnapshotBlockError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
464    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
465        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
466            source: err.clone().into(),
467            meta: err,
468        })
469    }
470    ///
471    /// Returns error metadata, which includes the error code, message,
472    /// request ID, and potentially additional information.
473    ///
474    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
475        match self {
476            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
477            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
478            Self::RequestThrottledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
479            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
480            Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
481            Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
482            Self::Unhandled(e) => &e.meta,
483        }
484    }
485    /// Returns `true` if the error kind is `GetSnapshotBlockError::AccessDeniedException`.
486    pub fn is_access_denied_exception(&self) -> bool {
487        matches!(self, Self::AccessDeniedException(_))
488    }
489    /// Returns `true` if the error kind is `GetSnapshotBlockError::InternalServerException`.
490    pub fn is_internal_server_exception(&self) -> bool {
491        matches!(self, Self::InternalServerException(_))
492    }
493    /// Returns `true` if the error kind is `GetSnapshotBlockError::RequestThrottledException`.
494    pub fn is_request_throttled_exception(&self) -> bool {
495        matches!(self, Self::RequestThrottledException(_))
496    }
497    /// Returns `true` if the error kind is `GetSnapshotBlockError::ResourceNotFoundException`.
498    pub fn is_resource_not_found_exception(&self) -> bool {
499        matches!(self, Self::ResourceNotFoundException(_))
500    }
501    /// Returns `true` if the error kind is `GetSnapshotBlockError::ServiceQuotaExceededException`.
502    pub fn is_service_quota_exceeded_exception(&self) -> bool {
503        matches!(self, Self::ServiceQuotaExceededException(_))
504    }
505    /// Returns `true` if the error kind is `GetSnapshotBlockError::ValidationException`.
506    pub fn is_validation_exception(&self) -> bool {
507        matches!(self, Self::ValidationException(_))
508    }
509}
510impl ::std::error::Error for GetSnapshotBlockError {
511    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
512        match self {
513            Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
514            Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
515            Self::RequestThrottledException(_inner) => ::std::option::Option::Some(_inner),
516            Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
517            Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
518            Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
519            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
520        }
521    }
522}
523impl ::std::fmt::Display for GetSnapshotBlockError {
524    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
525        match self {
526            Self::AccessDeniedException(_inner) => _inner.fmt(f),
527            Self::InternalServerException(_inner) => _inner.fmt(f),
528            Self::RequestThrottledException(_inner) => _inner.fmt(f),
529            Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
530            Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
531            Self::ValidationException(_inner) => _inner.fmt(f),
532            Self::Unhandled(_inner) => {
533                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
534                    write!(f, "unhandled error ({code})")
535                } else {
536                    f.write_str("unhandled error")
537                }
538            }
539        }
540    }
541}
542impl ::aws_smithy_types::retry::ProvideErrorKind for GetSnapshotBlockError {
543    fn code(&self) -> ::std::option::Option<&str> {
544        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
545    }
546    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
547        ::std::option::Option::None
548    }
549}
550impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetSnapshotBlockError {
551    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
552        match self {
553            Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
554            Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
555            Self::RequestThrottledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
556            Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
557            Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
558            Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
559            Self::Unhandled(_inner) => &_inner.meta,
560        }
561    }
562}
563impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetSnapshotBlockError {
564    fn create_unhandled_error(
565        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
566        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
567    ) -> Self {
568        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
569            source,
570            meta: meta.unwrap_or_default(),
571        })
572    }
573}
574impl ::aws_types::request_id::RequestId for crate::operation::get_snapshot_block::GetSnapshotBlockError {
575    fn request_id(&self) -> Option<&str> {
576        self.meta().request_id()
577    }
578}
579
580pub use crate::operation::get_snapshot_block::_get_snapshot_block_output::GetSnapshotBlockOutput;
581
582pub use crate::operation::get_snapshot_block::_get_snapshot_block_input::GetSnapshotBlockInput;
583
584mod _get_snapshot_block_input;
585
586mod _get_snapshot_block_output;
587
588/// Builders
589pub mod builders;