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