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