Skip to main content

aws_sdk_ebs/operation/
start_snapshot.rs

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