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