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_with_config(
168 &self,
169 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
170 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
171 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
172 let body = response.body().bytes().expect("body loaded");
174 crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_get_snapshot_block::de_get_snapshot_block_http_error(
175 response.status().as_u16(),
176 response.headers(),
177 body,
178 ))
179 }
180}
181#[derive(Debug)]
182struct GetSnapshotBlockRequestSerializer;
183impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetSnapshotBlockRequestSerializer {
184 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
185 fn serialize_input(
186 &self,
187 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
188 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
189 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
190 let input = input
191 .downcast::<crate::operation::get_snapshot_block::GetSnapshotBlockInput>()
192 .expect("correct type");
193 let _header_serialization_settings = _cfg
194 .load::<crate::serialization_settings::HeaderSerializationSettings>()
195 .cloned()
196 .unwrap_or_default();
197 let mut request_builder = {
198 #[allow(clippy::uninlined_format_args)]
199 fn uri_base(
200 _input: &crate::operation::get_snapshot_block::GetSnapshotBlockInput,
201 output: &mut ::std::string::String,
202 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
203 use ::std::fmt::Write as _;
204 let input_1 = &_input.snapshot_id;
205 let input_1 = input_1
206 .as_ref()
207 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("snapshot_id", "cannot be empty or unset"))?;
208 let snapshot_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
209 if snapshot_id.is_empty() {
210 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
211 "snapshot_id",
212 "cannot be empty or unset",
213 ));
214 }
215 let input_2 = &_input.block_index;
216 let input_2 = input_2
217 .as_ref()
218 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("block_index", "cannot be empty or unset"))?;
219 let mut block_index_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_2);
220 let block_index = block_index_encoder.encode();
221 if block_index.is_empty() {
222 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
223 "block_index",
224 "cannot be empty or unset",
225 ));
226 }
227 ::std::write!(
228 output,
229 "/snapshots/{SnapshotId}/blocks/{BlockIndex}",
230 SnapshotId = snapshot_id,
231 BlockIndex = block_index
232 )
233 .expect("formatting should succeed");
234 ::std::result::Result::Ok(())
235 }
236 fn uri_query(
237 _input: &crate::operation::get_snapshot_block::GetSnapshotBlockInput,
238 mut output: &mut ::std::string::String,
239 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
240 let mut query = ::aws_smithy_http::query::Writer::new(output);
241 let inner_3 = &_input.block_token;
242 let inner_3 = inner_3
243 .as_ref()
244 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("block_token", "cannot be empty or unset"))?;
245 if inner_3.is_empty() {
246 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
247 "block_token",
248 "cannot be empty or unset",
249 ));
250 }
251 query.push_kv("blockToken", &::aws_smithy_http::query::fmt_string(inner_3));
252 ::std::result::Result::Ok(())
253 }
254 #[allow(clippy::unnecessary_wraps)]
255 fn update_http_builder(
256 input: &crate::operation::get_snapshot_block::GetSnapshotBlockInput,
257 builder: ::http_1x::request::Builder,
258 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
259 let mut uri = ::std::string::String::new();
260 uri_base(input, &mut uri)?;
261 uri_query(input, &mut uri)?;
262 ::std::result::Result::Ok(builder.method("GET").uri(uri))
263 }
264 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
265 builder
266 };
267 let body = ::aws_smithy_types::body::SdkBody::from("");
268
269 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
270 }
271}
272#[derive(Debug)]
273struct GetSnapshotBlockEndpointParamsInterceptor;
274
275#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
276impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetSnapshotBlockEndpointParamsInterceptor {
277 fn name(&self) -> &'static str {
278 "GetSnapshotBlockEndpointParamsInterceptor"
279 }
280
281 fn read_before_execution(
282 &self,
283 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
284 '_,
285 ::aws_smithy_runtime_api::client::interceptors::context::Input,
286 ::aws_smithy_runtime_api::client::interceptors::context::Output,
287 ::aws_smithy_runtime_api::client::interceptors::context::Error,
288 >,
289 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
290 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
291 let _input = context
292 .input()
293 .downcast_ref::<GetSnapshotBlockInput>()
294 .ok_or("failed to downcast to GetSnapshotBlockInput")?;
295
296 let params = crate::config::endpoint::Params::builder()
297 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
298 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
299 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
300 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
301 .build()
302 .map_err(|err| {
303 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
304 })?;
305 cfg.interceptor_state()
306 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
307 ::std::result::Result::Ok(())
308 }
309}
310
311#[allow(unreachable_code, unused_variables)]
315#[cfg(test)]
316mod get_snapshot_block_test {
317
318 #[::tokio::test]
321 #[::tracing_test::traced_test]
322 async fn lowercase_message_response() {
323 let expected_output = crate::types::error::ValidationException::builder()
324 .set_message(::std::option::Option::Some("1 validation error detected".to_owned()))
325 .build();
326 let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
327 ::http_1x::response::Builder::new()
328 .header("content-length", "77")
329 .header("content-type", "application/json")
330 .header("date", "Wed, 30 Jun 2021 23:42:27 GMT")
331 .header(
332 "x-amzn-errortype",
333 "ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/",
334 )
335 .header("x-amzn-requestid", "2af8f013-250a-4f6e-88ae-6dd7f6e12807")
336 .status(400)
337 .body(::aws_smithy_types::body::SdkBody::from(
338 "{\n \"message\": \"1 validation error detected\"\n}\n",
339 ))
340 .unwrap(),
341 )
342 .unwrap();
343 use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
344 use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
345
346 let op = crate::operation::get_snapshot_block::GetSnapshotBlock::new();
347 let config = op.config().expect("the operation has config");
348 let de = config
349 .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
350 .expect("the config must have a deserializer");
351
352 #[allow(unused_mut)]
354 let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
355
356 let parsed = de.deserialize_streaming(&mut http_response);
357 let parsed = parsed.unwrap_or_else(|| {
358 let http_response = http_response.map(|body| {
359 ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
360 body.bytes().unwrap(),
361 ::aws_smithy_protocol_test::MediaType::from("application/json"),
362 )))
363 });
364 de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
365 });
366 let parsed = parsed.expect_err("should be error response");
367 let parsed: &crate::operation::get_snapshot_block::GetSnapshotBlockError =
368 parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
369 if let crate::operation::get_snapshot_block::GetSnapshotBlockError::ValidationException(parsed) = parsed {
370 ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
371 ::pretty_assertions::assert_eq!(parsed.reason, expected_output.reason, "Unexpected value for `reason`");
372 } else {
373 panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
374 }
375 }
376
377 #[::tokio::test]
380 #[::tracing_test::traced_test]
381 async fn uppercase_message_response() {
382 let expected_output = crate::types::error::ValidationException::builder()
383 .set_message(::std::option::Option::Some("Invalid volume size: 99999999999".to_owned()))
384 .set_reason(::std::option::Option::Some(
385 "INVALID_VOLUME_SIZE"
386 .parse::<crate::types::ValidationExceptionReason>()
387 .expect("static value validated to member"),
388 ))
389 .build();
390 let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
391 ::http_1x::response::Builder::new()
392 .header("content-length", "77")
393 .header("content-type", "application/json")
394 .header("date", "Wed, 30 Jun 2021 23:42:27 GMT")
395 .header(
396 "x-amzn-errortype",
397 "ValidationException:http://internal.amazon.com/coral/com.amazon.zeppelindataservice/",
398 )
399 .header("x-amzn-requestid", "2af8f013-250a-4f6e-88ae-6dd7f6e12807")
400 .status(400)
401 .body(::aws_smithy_types::body::SdkBody::from(
402 "{\"Message\":\"Invalid volume size: 99999999999\",\"Reason\":\"INVALID_VOLUME_SIZE\"}\n",
403 ))
404 .unwrap(),
405 )
406 .unwrap();
407 use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
408 use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
409
410 let op = crate::operation::get_snapshot_block::GetSnapshotBlock::new();
411 let config = op.config().expect("the operation has config");
412 let de = config
413 .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
414 .expect("the config must have a deserializer");
415
416 #[allow(unused_mut)]
418 let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
419
420 let parsed = de.deserialize_streaming(&mut http_response);
421 let parsed = parsed.unwrap_or_else(|| {
422 let http_response = http_response.map(|body| {
423 ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
424 body.bytes().unwrap(),
425 ::aws_smithy_protocol_test::MediaType::from("application/json"),
426 )))
427 });
428 de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
429 });
430 let parsed = parsed.expect_err("should be error response");
431 let parsed: &crate::operation::get_snapshot_block::GetSnapshotBlockError =
432 parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
433 if let crate::operation::get_snapshot_block::GetSnapshotBlockError::ValidationException(parsed) = parsed {
434 ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
435 ::pretty_assertions::assert_eq!(parsed.reason, expected_output.reason, "Unexpected value for `reason`");
436 } else {
437 panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
438 }
439 }
440}
441
442#[non_exhaustive]
444#[derive(::std::fmt::Debug)]
445pub enum GetSnapshotBlockError {
446 AccessDeniedException(crate::types::error::AccessDeniedException),
448 InternalServerException(crate::types::error::InternalServerException),
450 RequestThrottledException(crate::types::error::RequestThrottledException),
452 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
454 ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
456 ValidationException(crate::types::error::ValidationException),
458 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
460 variable wildcard pattern and check `.code()`:
461 \
462 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
463 \
464 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetSnapshotBlockError) for what information is available for the error.")]
465 Unhandled(crate::error::sealed_unhandled::Unhandled),
466}
467impl GetSnapshotBlockError {
468 pub fn unhandled(
470 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
471 ) -> Self {
472 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
473 source: err.into(),
474 meta: ::std::default::Default::default(),
475 })
476 }
477
478 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
480 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
481 source: err.clone().into(),
482 meta: err,
483 })
484 }
485 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
490 match self {
491 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
492 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
493 Self::RequestThrottledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
494 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
495 Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
496 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
497 Self::Unhandled(e) => &e.meta,
498 }
499 }
500 pub fn is_access_denied_exception(&self) -> bool {
502 matches!(self, Self::AccessDeniedException(_))
503 }
504 pub fn is_internal_server_exception(&self) -> bool {
506 matches!(self, Self::InternalServerException(_))
507 }
508 pub fn is_request_throttled_exception(&self) -> bool {
510 matches!(self, Self::RequestThrottledException(_))
511 }
512 pub fn is_resource_not_found_exception(&self) -> bool {
514 matches!(self, Self::ResourceNotFoundException(_))
515 }
516 pub fn is_service_quota_exceeded_exception(&self) -> bool {
518 matches!(self, Self::ServiceQuotaExceededException(_))
519 }
520 pub fn is_validation_exception(&self) -> bool {
522 matches!(self, Self::ValidationException(_))
523 }
524}
525impl ::std::error::Error for GetSnapshotBlockError {
526 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
527 match self {
528 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
529 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
530 Self::RequestThrottledException(_inner) => ::std::option::Option::Some(_inner),
531 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
532 Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
533 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
534 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
535 }
536 }
537}
538impl ::std::fmt::Display for GetSnapshotBlockError {
539 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
540 match self {
541 Self::AccessDeniedException(_inner) => _inner.fmt(f),
542 Self::InternalServerException(_inner) => _inner.fmt(f),
543 Self::RequestThrottledException(_inner) => _inner.fmt(f),
544 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
545 Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
546 Self::ValidationException(_inner) => _inner.fmt(f),
547 Self::Unhandled(_inner) => {
548 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
549 write!(f, "unhandled error ({code})")
550 } else {
551 f.write_str("unhandled error")
552 }
553 }
554 }
555 }
556}
557impl ::aws_smithy_types::retry::ProvideErrorKind for GetSnapshotBlockError {
558 fn code(&self) -> ::std::option::Option<&str> {
559 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
560 }
561 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
562 ::std::option::Option::None
563 }
564}
565impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetSnapshotBlockError {
566 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
567 match self {
568 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
569 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
570 Self::RequestThrottledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
571 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
572 Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
573 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
574 Self::Unhandled(_inner) => &_inner.meta,
575 }
576 }
577}
578impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetSnapshotBlockError {
579 fn create_unhandled_error(
580 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
581 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
582 ) -> Self {
583 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
584 source,
585 meta: meta.unwrap_or_default(),
586 })
587 }
588}
589impl ::aws_types::request_id::RequestId for crate::operation::get_snapshot_block::GetSnapshotBlockError {
590 fn request_id(&self) -> Option<&str> {
591 self.meta().request_id()
592 }
593}
594
595pub use crate::operation::get_snapshot_block::_get_snapshot_block_input::GetSnapshotBlockInput;
596
597pub use crate::operation::get_snapshot_block::_get_snapshot_block_output::GetSnapshotBlockOutput;
598
599mod _get_snapshot_block_input;
600
601mod _get_snapshot_block_output;
602
603pub mod builders;