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 GetSnapshotBlockTelemetryInputCaptureInterceptor,
129 ))
130 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
131 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
132 ))
133 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
134 GetSnapshotBlockEndpointParamsInterceptor,
135 ))
136 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
137 crate::operation::get_snapshot_block::GetSnapshotBlockError,
138 >::new())
139 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
140 crate::operation::get_snapshot_block::GetSnapshotBlockError,
141 >::new())
142 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
143 crate::operation::get_snapshot_block::GetSnapshotBlockError,
144 >::new())
145 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
146 crate::operation::get_snapshot_block::GetSnapshotBlockError,
147 >::new());
148
149 ::std::borrow::Cow::Owned(rcb)
150 }
151}
152
153#[derive(Debug)]
154struct GetSnapshotBlockTelemetryInputCaptureInterceptor;
155
156#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
157impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetSnapshotBlockTelemetryInputCaptureInterceptor {
158 fn name(&self) -> &'static str {
159 "GetSnapshotBlockTelemetryInputCaptureInterceptor"
160 }
161
162 fn read_before_execution(
163 &self,
164 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
165 '_,
166 ::aws_smithy_runtime_api::client::interceptors::context::Input,
167 ::aws_smithy_runtime_api::client::interceptors::context::Output,
168 ::aws_smithy_runtime_api::client::interceptors::context::Error,
169 >,
170 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
171 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
172 let ::std::option::Option::Some(requested) = cfg
174 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
175 .filter(|r| !r.is_empty())
176 else {
177 return ::std::result::Result::Ok(());
178 };
179
180 let ::std::option::Option::Some(input) = context.input().downcast_ref::<GetSnapshotBlockInput>() else {
181 return ::std::result::Result::Ok(());
183 };
184
185 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
186 if requested.should_capture("SnapshotId") {
187 if let ::std::option::Option::Some(value) = input.snapshot_id.as_deref() {
188 captured.insert("SnapshotId", value);
189 }
190 }
191 if requested.should_capture("BlockToken") {
192 if let ::std::option::Option::Some(value) = input.block_token.as_deref() {
193 captured.insert("BlockToken", value);
194 }
195 }
196
197 cfg.interceptor_state().store_put(captured);
198 ::std::result::Result::Ok(())
199 }
200}
201#[derive(Debug)]
202struct GetSnapshotBlockResponseDeserializer;
203impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetSnapshotBlockResponseDeserializer {
204 fn deserialize_streaming(
205 &self,
206 response: &mut ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
207 ) -> ::std::option::Option<::aws_smithy_runtime_api::client::interceptors::context::OutputOrError> {
208 #[allow(unused_mut)]
209 let mut force_error = false;
210 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
211
212 if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
214 return ::std::option::Option::None;
215 }
216 ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
217 crate::protocol_serde::shape_get_snapshot_block::de_get_snapshot_block_http_response(response),
218 ))
219 }
220
221 fn deserialize_nonstreaming_with_config(
222 &self,
223 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
224 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
225 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
226 let body = response.body().bytes().expect("body loaded");
228 crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_get_snapshot_block::de_get_snapshot_block_http_error(
229 response.status().as_u16(),
230 response.headers(),
231 body,
232 ))
233 }
234}
235#[derive(Debug)]
236struct GetSnapshotBlockRequestSerializer;
237impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetSnapshotBlockRequestSerializer {
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::get_snapshot_block::GetSnapshotBlockInput>()
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::get_snapshot_block::GetSnapshotBlockInput,
255 output: &mut ::std::string::String,
256 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
257 use ::std::fmt::Write as _;
258 let input_1 = &_input.snapshot_id;
259 let input_1 = input_1
260 .as_ref()
261 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("snapshot_id", "cannot be empty or unset"))?;
262 let snapshot_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
263 if snapshot_id.is_empty() {
264 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
265 "snapshot_id",
266 "cannot be empty or unset",
267 ));
268 }
269 let input_2 = &_input.block_index;
270 let input_2 = input_2
271 .as_ref()
272 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("block_index", "cannot be empty or unset"))?;
273 let mut block_index_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_2);
274 let block_index = block_index_encoder.encode();
275 if block_index.is_empty() {
276 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
277 "block_index",
278 "cannot be empty or unset",
279 ));
280 }
281 ::std::write!(
282 output,
283 "/snapshots/{SnapshotId}/blocks/{BlockIndex}",
284 SnapshotId = snapshot_id,
285 BlockIndex = block_index
286 )
287 .expect("formatting should succeed");
288 ::std::result::Result::Ok(())
289 }
290 fn uri_query(
291 _input: &crate::operation::get_snapshot_block::GetSnapshotBlockInput,
292 mut output: &mut ::std::string::String,
293 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
294 let mut query = ::aws_smithy_http::query::Writer::new(output);
295 let inner_3 = &_input.block_token;
296 let inner_3 = inner_3
297 .as_ref()
298 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("block_token", "cannot be empty or unset"))?;
299 if inner_3.is_empty() {
300 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
301 "block_token",
302 "cannot be empty or unset",
303 ));
304 }
305 query.push_kv("blockToken", &::aws_smithy_http::query::fmt_string(inner_3));
306 ::std::result::Result::Ok(())
307 }
308 #[allow(clippy::unnecessary_wraps)]
309 fn update_http_builder(
310 input: &crate::operation::get_snapshot_block::GetSnapshotBlockInput,
311 builder: ::http_1x::request::Builder,
312 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
313 let mut uri = ::std::string::String::new();
314 uri_base(input, &mut uri)?;
315 uri_query(input, &mut uri)?;
316 ::std::result::Result::Ok(builder.method("GET").uri(uri))
317 }
318 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
319 builder
320 };
321 let body = ::aws_smithy_types::body::SdkBody::from("");
322
323 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
324 }
325}
326#[derive(Debug)]
327struct GetSnapshotBlockEndpointParamsInterceptor;
328
329#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
330impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetSnapshotBlockEndpointParamsInterceptor {
331 fn name(&self) -> &'static str {
332 "GetSnapshotBlockEndpointParamsInterceptor"
333 }
334
335 fn read_before_execution(
336 &self,
337 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
338 '_,
339 ::aws_smithy_runtime_api::client::interceptors::context::Input,
340 ::aws_smithy_runtime_api::client::interceptors::context::Output,
341 ::aws_smithy_runtime_api::client::interceptors::context::Error,
342 >,
343 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
344 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
345 let _input = context
346 .input()
347 .downcast_ref::<GetSnapshotBlockInput>()
348 .ok_or("failed to downcast to GetSnapshotBlockInput")?;
349
350 let params = crate::config::endpoint::Params::builder()
351 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
352 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
353 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
354 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
355 .build()
356 .map_err(|err| {
357 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
358 })?;
359 cfg.interceptor_state()
360 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
361 ::std::result::Result::Ok(())
362 }
363}
364
365#[allow(unreachable_code, unused_variables)]
369#[cfg(test)]
370mod get_snapshot_block_test {
371
372 #[::tokio::test]
375 #[::tracing_test::traced_test]
376 async fn lowercase_message_response() {
377 let expected_output = crate::types::error::ValidationException::builder()
378 .set_message(::std::option::Option::Some("1 validation error detected".to_owned()))
379 .build();
380 let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
381 ::http_1x::response::Builder::new()
382 .header("content-length", "77")
383 .header("content-type", "application/json")
384 .header("date", "Wed, 30 Jun 2021 23:42:27 GMT")
385 .header(
386 "x-amzn-errortype",
387 "ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/",
388 )
389 .header("x-amzn-requestid", "2af8f013-250a-4f6e-88ae-6dd7f6e12807")
390 .status(400)
391 .body(::aws_smithy_types::body::SdkBody::from(
392 "{\n \"message\": \"1 validation error detected\"\n}\n",
393 ))
394 .unwrap(),
395 )
396 .unwrap();
397 use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
398 use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
399
400 let op = crate::operation::get_snapshot_block::GetSnapshotBlock::new();
401 let config = op.config().expect("the operation has config");
402 let de = config
403 .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
404 .expect("the config must have a deserializer");
405
406 #[allow(unused_mut)]
408 let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
409
410 let parsed = de.deserialize_streaming(&mut http_response);
411 let parsed = parsed.unwrap_or_else(|| {
412 let http_response = http_response.map(|body| {
413 ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
414 body.bytes().unwrap(),
415 ::aws_smithy_protocol_test::MediaType::from("application/json"),
416 )))
417 });
418 de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
419 });
420 let parsed = parsed.expect_err("should be error response");
421 let parsed: &crate::operation::get_snapshot_block::GetSnapshotBlockError =
422 parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
423 if let crate::operation::get_snapshot_block::GetSnapshotBlockError::ValidationException(parsed) = parsed {
424 ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
425 ::pretty_assertions::assert_eq!(parsed.reason, expected_output.reason, "Unexpected value for `reason`");
426 } else {
427 panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
428 }
429 }
430
431 #[::tokio::test]
434 #[::tracing_test::traced_test]
435 async fn uppercase_message_response() {
436 let expected_output = crate::types::error::ValidationException::builder()
437 .set_message(::std::option::Option::Some("Invalid volume size: 99999999999".to_owned()))
438 .set_reason(::std::option::Option::Some(
439 "INVALID_VOLUME_SIZE"
440 .parse::<crate::types::ValidationExceptionReason>()
441 .expect("static value validated to member"),
442 ))
443 .build();
444 let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
445 ::http_1x::response::Builder::new()
446 .header("content-length", "77")
447 .header("content-type", "application/json")
448 .header("date", "Wed, 30 Jun 2021 23:42:27 GMT")
449 .header(
450 "x-amzn-errortype",
451 "ValidationException:http://internal.amazon.com/coral/com.amazon.zeppelindataservice/",
452 )
453 .header("x-amzn-requestid", "2af8f013-250a-4f6e-88ae-6dd7f6e12807")
454 .status(400)
455 .body(::aws_smithy_types::body::SdkBody::from(
456 "{\"Message\":\"Invalid volume size: 99999999999\",\"Reason\":\"INVALID_VOLUME_SIZE\"}\n",
457 ))
458 .unwrap(),
459 )
460 .unwrap();
461 use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
462 use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
463
464 let op = crate::operation::get_snapshot_block::GetSnapshotBlock::new();
465 let config = op.config().expect("the operation has config");
466 let de = config
467 .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
468 .expect("the config must have a deserializer");
469
470 #[allow(unused_mut)]
472 let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
473
474 let parsed = de.deserialize_streaming(&mut http_response);
475 let parsed = parsed.unwrap_or_else(|| {
476 let http_response = http_response.map(|body| {
477 ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
478 body.bytes().unwrap(),
479 ::aws_smithy_protocol_test::MediaType::from("application/json"),
480 )))
481 });
482 de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
483 });
484 let parsed = parsed.expect_err("should be error response");
485 let parsed: &crate::operation::get_snapshot_block::GetSnapshotBlockError =
486 parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
487 if let crate::operation::get_snapshot_block::GetSnapshotBlockError::ValidationException(parsed) = parsed {
488 ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
489 ::pretty_assertions::assert_eq!(parsed.reason, expected_output.reason, "Unexpected value for `reason`");
490 } else {
491 panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
492 }
493 }
494}
495
496#[non_exhaustive]
498#[derive(::std::fmt::Debug)]
499pub enum GetSnapshotBlockError {
500 AccessDeniedException(crate::types::error::AccessDeniedException),
502 InternalServerException(crate::types::error::InternalServerException),
504 RequestThrottledException(crate::types::error::RequestThrottledException),
506 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
508 ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
510 ValidationException(crate::types::error::ValidationException),
512 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
514 variable wildcard pattern and check `.code()`:
515 \
516 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
517 \
518 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetSnapshotBlockError) for what information is available for the error.")]
519 Unhandled(crate::error::sealed_unhandled::Unhandled),
520}
521impl GetSnapshotBlockError {
522 pub fn unhandled(
524 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
525 ) -> Self {
526 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
527 source: err.into(),
528 meta: ::std::default::Default::default(),
529 })
530 }
531
532 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
534 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
535 source: err.clone().into(),
536 meta: err,
537 })
538 }
539 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
544 match self {
545 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
546 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
547 Self::RequestThrottledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
548 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
549 Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
550 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
551 Self::Unhandled(e) => &e.meta,
552 }
553 }
554 pub fn is_access_denied_exception(&self) -> bool {
556 matches!(self, Self::AccessDeniedException(_))
557 }
558 pub fn is_internal_server_exception(&self) -> bool {
560 matches!(self, Self::InternalServerException(_))
561 }
562 pub fn is_request_throttled_exception(&self) -> bool {
564 matches!(self, Self::RequestThrottledException(_))
565 }
566 pub fn is_resource_not_found_exception(&self) -> bool {
568 matches!(self, Self::ResourceNotFoundException(_))
569 }
570 pub fn is_service_quota_exceeded_exception(&self) -> bool {
572 matches!(self, Self::ServiceQuotaExceededException(_))
573 }
574 pub fn is_validation_exception(&self) -> bool {
576 matches!(self, Self::ValidationException(_))
577 }
578}
579impl ::std::error::Error for GetSnapshotBlockError {
580 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
581 match self {
582 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
583 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
584 Self::RequestThrottledException(_inner) => ::std::option::Option::Some(_inner),
585 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
586 Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
587 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
588 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
589 }
590 }
591}
592impl ::std::fmt::Display for GetSnapshotBlockError {
593 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
594 match self {
595 Self::AccessDeniedException(_inner) => _inner.fmt(f),
596 Self::InternalServerException(_inner) => _inner.fmt(f),
597 Self::RequestThrottledException(_inner) => _inner.fmt(f),
598 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
599 Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
600 Self::ValidationException(_inner) => _inner.fmt(f),
601 Self::Unhandled(_inner) => {
602 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
603 write!(f, "unhandled error ({code})")
604 } else {
605 f.write_str("unhandled error")
606 }
607 }
608 }
609 }
610}
611impl ::aws_smithy_types::retry::ProvideErrorKind for GetSnapshotBlockError {
612 fn code(&self) -> ::std::option::Option<&str> {
613 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
614 }
615 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
616 ::std::option::Option::None
617 }
618}
619impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetSnapshotBlockError {
620 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
621 match self {
622 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
623 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
624 Self::RequestThrottledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
625 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
626 Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
627 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
628 Self::Unhandled(_inner) => &_inner.meta,
629 }
630 }
631}
632impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetSnapshotBlockError {
633 fn create_unhandled_error(
634 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
635 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
636 ) -> Self {
637 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
638 source,
639 meta: meta.unwrap_or_default(),
640 })
641 }
642}
643impl ::aws_types::request_id::RequestId for crate::operation::get_snapshot_block::GetSnapshotBlockError {
644 fn request_id(&self) -> Option<&str> {
645 self.meta().request_id()
646 }
647}
648
649pub use crate::operation::get_snapshot_block::_get_snapshot_block_input::GetSnapshotBlockInput;
650
651pub use crate::operation::get_snapshot_block::_get_snapshot_block_output::GetSnapshotBlockOutput;
652
653mod _get_snapshot_block_input;
654
655mod _get_snapshot_block_output;
656
657pub mod builders;