aws_sdk_ebs/operation/
put_snapshot_block.rs

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