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