1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct VerifyMac;
6impl VerifyMac {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::verify_mac::VerifyMacInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::verify_mac::VerifyMacOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::verify_mac::VerifyMacInput,
18 ) -> ::std::result::Result<
19 crate::operation::verify_mac::VerifyMacOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::verify_mac::VerifyMacError,
22 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
23 >,
24 > {
25 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
26 ::aws_smithy_runtime_api::client::interceptors::context::Error,
27 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
28 >| {
29 err.map_service_error(|err| {
30 err.downcast::<crate::operation::verify_mac::VerifyMacError>()
31 .expect("correct error type")
32 })
33 };
34 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
35 .await
36 .map_err(map_err)?;
37 let output = context.finalize().map_err(map_err)?;
38 ::std::result::Result::Ok(
39 output
40 .downcast::<crate::operation::verify_mac::VerifyMacOutput>()
41 .expect("correct output type"),
42 )
43 }
44
45 pub(crate) async fn orchestrate_with_stop_point(
46 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
47 input: crate::operation::verify_mac::VerifyMacInput,
48 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
49 ) -> ::std::result::Result<
50 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
51 ::aws_smithy_runtime_api::client::result::SdkError<
52 ::aws_smithy_runtime_api::client::interceptors::context::Error,
53 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
54 >,
55 > {
56 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
57 use ::tracing::Instrument;
58 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("KMS", "VerifyMac", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "KMS.VerifyMac",
63 "rpc.service" = "KMS",
64 "rpc.method" = "VerifyMac",
65 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
66 "rpc.system" = "aws-api",
67 ))
68 .await
69 }
70
71 pub(crate) fn operation_runtime_plugins(
72 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
73 client_config: &crate::config::Config,
74 config_override: ::std::option::Option<crate::config::Builder>,
75 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
76 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
77
78 if let ::std::option::Option::Some(config_override) = config_override {
79 for plugin in config_override.runtime_plugins.iter().cloned() {
80 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
81 }
82 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
83 config_override,
84 client_config.config.clone(),
85 &client_config.runtime_components,
86 ));
87 }
88 runtime_plugins
89 }
90}
91pub(crate) mod error_registry {
100 pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
101 ::aws_smithy_schema::registry::TypeRegistry::builder()
102 .insert_error_shape(
103 crate::types::error::DisabledException::SCHEMA,
104 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
105 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DisabledException::deserialize(d)?))
106 },
107 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
108 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DisabledException::deserialize(d)?))
109 },
110 )
111.insert_error_shape(
112 crate::types::error::DryRunOperationException::SCHEMA,
113 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
114 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DryRunOperationException::deserialize(d)?))
115 },
116 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
117 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DryRunOperationException::deserialize(d)?))
118 },
119 )
120.insert_error_shape(
121 crate::types::error::InvalidGrantTokenException::SCHEMA,
122 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
123 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidGrantTokenException::deserialize(d)?))
124 },
125 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
126 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidGrantTokenException::deserialize(d)?))
127 },
128 )
129.insert_error_shape(
130 crate::types::error::InvalidKeyUsageException::SCHEMA,
131 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
132 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidKeyUsageException::deserialize(d)?))
133 },
134 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
135 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidKeyUsageException::deserialize(d)?))
136 },
137 )
138.insert_error_shape(
139 crate::types::error::KmsInternalException::SCHEMA,
140 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
141 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInternalException::deserialize(d)?))
142 },
143 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
144 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInternalException::deserialize(d)?))
145 },
146 )
147.insert_error_shape(
148 crate::types::error::KmsInvalidMacException::SCHEMA,
149 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
150 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInvalidMacException::deserialize(d)?))
151 },
152 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
153 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInvalidMacException::deserialize(d)?))
154 },
155 )
156.insert_error_shape(
157 crate::types::error::KmsInvalidStateException::SCHEMA,
158 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
159 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
160 },
161 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
162 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
163 },
164 )
165.insert_error_shape(
166 crate::types::error::KeyUnavailableException::SCHEMA,
167 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
168 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
169 },
170 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
171 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
172 },
173 )
174.insert_error_shape(
175 crate::types::error::NotFoundException::SCHEMA,
176 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
177 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::NotFoundException::deserialize(d)?))
178 },
179 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
180 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::NotFoundException::deserialize(d)?))
181 },
182 )
183 .build()
184 });
185}
186impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for VerifyMac {
187 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
188 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("VerifyMac");
189
190 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
191 VerifyMacRequestSerializer,
192 ));
193 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
194 VerifyMacResponseDeserializer,
195 ));
196
197 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
198 crate::config::auth::Params::builder()
199 .operation_name("VerifyMac")
200 .build()
201 .expect("required fields set"),
202 ));
203
204 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("VerifyMac", "KMS"));
205 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
206 signing_options.double_uri_encode = true;
207 signing_options.content_sha256_header = false;
208 signing_options.normalize_uri_path = true;
209 signing_options.payload_override = None;
210
211 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
212 signing_options,
213 ..::std::default::Default::default()
214 });
215
216 ::std::option::Option::Some(cfg.freeze())
217 }
218
219 fn runtime_components(
220 &self,
221 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
222 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
223 #[allow(unused_mut)]
224 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("VerifyMac")
225 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
226 VerifyMacTelemetryInputCaptureInterceptor,
227 ))
228 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
229 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
230 ))
231 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
232 VerifyMacEndpointParamsInterceptor,
233 ))
234 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
235 crate::operation::verify_mac::VerifyMacError,
236 >::new())
237 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
238 crate::operation::verify_mac::VerifyMacError,
239 >::new())
240 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
241 crate::operation::verify_mac::VerifyMacError,
242 >::new())
243 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
244 crate::operation::verify_mac::VerifyMacError,
245 >::new());
246
247 ::std::borrow::Cow::Owned(rcb)
248 }
249}
250
251#[derive(Debug)]
252struct VerifyMacTelemetryInputCaptureInterceptor;
253
254#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
255impl ::aws_smithy_runtime_api::client::interceptors::Intercept for VerifyMacTelemetryInputCaptureInterceptor {
256 fn name(&self) -> &'static str {
257 "VerifyMacTelemetryInputCaptureInterceptor"
258 }
259
260 fn read_before_execution(
261 &self,
262 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
263 '_,
264 ::aws_smithy_runtime_api::client::interceptors::context::Input,
265 ::aws_smithy_runtime_api::client::interceptors::context::Output,
266 ::aws_smithy_runtime_api::client::interceptors::context::Error,
267 >,
268 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
269 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
270 let ::std::option::Option::Some(requested) = cfg
272 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
273 .filter(|r| !r.is_empty())
274 else {
275 return ::std::result::Result::Ok(());
276 };
277
278 let ::std::option::Option::Some(input) = context.input().downcast_ref::<VerifyMacInput>() else {
279 return ::std::result::Result::Ok(());
281 };
282
283 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
284 if requested.should_capture("KeyId") {
285 if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
286 captured.insert("KeyId", value);
287 }
288 }
289
290 cfg.interceptor_state().store_put(captured);
291 ::std::result::Result::Ok(())
292 }
293}
294#[derive(Debug)]
295struct VerifyMacResponseDeserializer;
296impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for VerifyMacResponseDeserializer {
297 fn deserialize_nonstreaming_with_config(
298 &self,
299 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
300 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
301 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
302 let (success, status) = (response.status().is_success(), response.status().as_u16());
303 #[allow(unused_variables)]
308 let body = response.body().bytes().expect("body loaded");
309 let headers = response.headers();
310 #[allow(unused_mut)]
311 let mut force_error = false;
312 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
313 if !success && status != 200 || force_error {
314 let protocol = _cfg
315 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
316 .expect("a SharedClientProtocol is required");
317 #[allow(unused_mut)]
318 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
319 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
320 })?;
321 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
322 let generic = generic_builder.build();
323 let error_code = match generic.code() {
324 ::std::option::Option::Some(code) => code,
325 ::std::option::Option::None => {
326 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
327 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::verify_mac::VerifyMacError::unhandled(generic)),
328 ))
329 }
330 };
331 let _error_message = generic.message().map(|msg| msg.to_owned());
332 let err = match error_code {
333 "DisabledException" => crate::operation::verify_mac::VerifyMacError::DisabledException({
334 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
335 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
336 e,
337 ))
338 })?;
339 let mut tmp = <crate::types::error::builders::DisabledExceptionBuilder>::default();
340 tmp.deserialize_members(&mut *deser).map_err(|e| {
341 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
342 e,
343 ))
344 })?;
345 if tmp.message.is_none() {
346 tmp.message = _error_message;
347 }
348 let tmp = tmp.meta(generic);
349 tmp.build()
350 }),
351 "DryRunOperationException" => crate::operation::verify_mac::VerifyMacError::DryRunOperationException({
352 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
353 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
354 e,
355 ))
356 })?;
357 let mut tmp = <crate::types::error::builders::DryRunOperationExceptionBuilder>::default();
358 tmp.deserialize_members(&mut *deser).map_err(|e| {
359 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
360 e,
361 ))
362 })?;
363 if tmp.message.is_none() {
364 tmp.message = _error_message;
365 }
366 let tmp = tmp.meta(generic);
367 tmp.build()
368 }),
369 "InvalidGrantTokenException" => crate::operation::verify_mac::VerifyMacError::InvalidGrantTokenException({
370 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
371 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
372 e,
373 ))
374 })?;
375 let mut tmp = <crate::types::error::builders::InvalidGrantTokenExceptionBuilder>::default();
376 tmp.deserialize_members(&mut *deser).map_err(|e| {
377 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
378 e,
379 ))
380 })?;
381 if tmp.message.is_none() {
382 tmp.message = _error_message;
383 }
384 let tmp = tmp.meta(generic);
385 tmp.build()
386 }),
387 "InvalidKeyUsageException" => crate::operation::verify_mac::VerifyMacError::InvalidKeyUsageException({
388 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
389 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
390 e,
391 ))
392 })?;
393 let mut tmp = <crate::types::error::builders::InvalidKeyUsageExceptionBuilder>::default();
394 tmp.deserialize_members(&mut *deser).map_err(|e| {
395 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
396 e,
397 ))
398 })?;
399 if tmp.message.is_none() {
400 tmp.message = _error_message;
401 }
402 let tmp = tmp.meta(generic);
403 tmp.build()
404 }),
405 "KeyUnavailableException" => crate::operation::verify_mac::VerifyMacError::KeyUnavailableException({
406 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
407 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
408 e,
409 ))
410 })?;
411 let mut tmp = <crate::types::error::builders::KeyUnavailableExceptionBuilder>::default();
412 tmp.deserialize_members(&mut *deser).map_err(|e| {
413 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
414 e,
415 ))
416 })?;
417 if tmp.message.is_none() {
418 tmp.message = _error_message;
419 }
420 let tmp = tmp.meta(generic);
421 tmp.build()
422 }),
423 "KMSInternalException" => crate::operation::verify_mac::VerifyMacError::KmsInternalException({
424 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
425 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
426 e,
427 ))
428 })?;
429 let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
430 tmp.deserialize_members(&mut *deser).map_err(|e| {
431 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
432 e,
433 ))
434 })?;
435 if tmp.message.is_none() {
436 tmp.message = _error_message;
437 }
438 let tmp = tmp.meta(generic);
439 tmp.build()
440 }),
441 "KMSInvalidMacException" => crate::operation::verify_mac::VerifyMacError::KmsInvalidMacException({
442 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
443 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
444 e,
445 ))
446 })?;
447 let mut tmp = <crate::types::error::builders::KmsInvalidMacExceptionBuilder>::default();
448 tmp.deserialize_members(&mut *deser).map_err(|e| {
449 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
450 e,
451 ))
452 })?;
453 if tmp.message.is_none() {
454 tmp.message = _error_message;
455 }
456 let tmp = tmp.meta(generic);
457 tmp.build()
458 }),
459 "KMSInvalidStateException" => crate::operation::verify_mac::VerifyMacError::KmsInvalidStateException({
460 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
461 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
462 e,
463 ))
464 })?;
465 let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
466 tmp.deserialize_members(&mut *deser).map_err(|e| {
467 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
468 e,
469 ))
470 })?;
471 if tmp.message.is_none() {
472 tmp.message = _error_message;
473 }
474 let tmp = tmp.meta(generic);
475 tmp.build()
476 }),
477 "NotFoundException" => crate::operation::verify_mac::VerifyMacError::NotFoundException({
478 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
479 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
480 e,
481 ))
482 })?;
483 let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
484 tmp.deserialize_members(&mut *deser).map_err(|e| {
485 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
486 e,
487 ))
488 })?;
489 if tmp.message.is_none() {
490 tmp.message = _error_message;
491 }
492 let tmp = tmp.meta(generic);
493 tmp.build()
494 }),
495 _ => {
496 match protocol
504 .deserialize_error_response(response, _cfg)
505 .ok()
506 .and_then(|mut deser| {
507 ::aws_smithy_schema::registry::reify_error(
508 crate::operation::verify_mac::error_registry::REGISTRY
509 .or(&crate::error_type_registry::REGISTRY),
510 error_code,
511 &mut *deser,
512 )
513 }) {
514 ::std::option::Option::Some(source) => <crate::operation::verify_mac::VerifyMacError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
515 ::std::option::Option::None => crate::operation::verify_mac::VerifyMacError::generic(generic),
516 }
517 }
518 };
519 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
520 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
521 ))
522 } else {
523 let protocol = _cfg
524 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
525 .expect("a SharedClientProtocol is required");
526 let mut deser = protocol.deserialize_response(response, VerifyMac::OUTPUT_SCHEMA, _cfg).map_err(|e| {
527 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
528 })?;
529 let _response_headers = headers;
533 #[allow(unused_mut)]
537 let mut output = <crate::operation::verify_mac::builders::VerifyMacOutputBuilder>::default();
538 output.deserialize_members(&mut *deser).map_err(|e| {
539 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
540 })?;
541 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
542 let output = output.build();
543 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
544 }
545 }
546}
547#[derive(Debug)]
548struct VerifyMacRequestSerializer;
549impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for VerifyMacRequestSerializer {
550 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
551 fn serialize_input(
552 &self,
553 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
554 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
555 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
556 let input = input.downcast::<crate::operation::verify_mac::VerifyMacInput>().expect("correct type");
557
558 let protocol = _cfg
559 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
560 .expect("a SharedClientProtocol is required");
561 let mut request = protocol
562 .serialize_request(&input, VerifyMac::INPUT_SCHEMA, "/", _cfg)
563 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
564
565 return ::std::result::Result::Ok(request);
566 }
567}
568#[derive(Debug)]
569struct VerifyMacEndpointParamsInterceptor;
570
571#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
572impl ::aws_smithy_runtime_api::client::interceptors::Intercept for VerifyMacEndpointParamsInterceptor {
573 fn name(&self) -> &'static str {
574 "VerifyMacEndpointParamsInterceptor"
575 }
576
577 fn read_before_execution(
578 &self,
579 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
580 '_,
581 ::aws_smithy_runtime_api::client::interceptors::context::Input,
582 ::aws_smithy_runtime_api::client::interceptors::context::Output,
583 ::aws_smithy_runtime_api::client::interceptors::context::Error,
584 >,
585 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
586 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
587 let _input = context
588 .input()
589 .downcast_ref::<VerifyMacInput>()
590 .ok_or("failed to downcast to VerifyMacInput")?;
591
592 let params = crate::config::endpoint::Params::builder()
593 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
594 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
595 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
596 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
597 .build()
598 .map_err(|err| {
599 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
600 })?;
601 cfg.interceptor_state()
602 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
603 ::std::result::Result::Ok(())
604 }
605}
606
607#[non_exhaustive]
612#[derive(::std::fmt::Debug)]
613pub enum VerifyMacError {
614 DisabledException(crate::types::error::DisabledException),
616 DryRunOperationException(crate::types::error::DryRunOperationException),
618 InvalidGrantTokenException(crate::types::error::InvalidGrantTokenException),
620 InvalidKeyUsageException(crate::types::error::InvalidKeyUsageException),
630 KeyUnavailableException(crate::types::error::KeyUnavailableException),
632 KmsInternalException(crate::types::error::KmsInternalException),
634 KmsInvalidMacException(crate::types::error::KmsInvalidMacException),
636 KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
646 NotFoundException(crate::types::error::NotFoundException),
648 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
650 variable wildcard pattern and check `.code()`:
651 \
652 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
653 \
654 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-VerifyMacError) for what information is available for the error.")]
655 Unhandled(crate::error::sealed_unhandled::Unhandled),
656}
657impl VerifyMacError {
658 pub fn unhandled(
660 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
661 ) -> Self {
662 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
663 source: err.into(),
664 meta: ::std::default::Default::default(),
665 })
666 }
667
668 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
670 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
671 source: err.clone().into(),
672 meta: err,
673 })
674 }
675 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
680 match self {
681 Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
682 Self::DryRunOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
683 Self::InvalidGrantTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
684 Self::InvalidKeyUsageException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
685 Self::KeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
686 Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
687 Self::KmsInvalidMacException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
688 Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
689 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
690 Self::Unhandled(e) => &e.meta,
691 }
692 }
693 pub fn is_disabled_exception(&self) -> bool {
695 matches!(self, Self::DisabledException(_))
696 }
697 pub fn is_dry_run_operation_exception(&self) -> bool {
699 matches!(self, Self::DryRunOperationException(_))
700 }
701 pub fn is_invalid_grant_token_exception(&self) -> bool {
703 matches!(self, Self::InvalidGrantTokenException(_))
704 }
705 pub fn is_invalid_key_usage_exception(&self) -> bool {
707 matches!(self, Self::InvalidKeyUsageException(_))
708 }
709 pub fn is_key_unavailable_exception(&self) -> bool {
711 matches!(self, Self::KeyUnavailableException(_))
712 }
713 pub fn is_kms_internal_exception(&self) -> bool {
715 matches!(self, Self::KmsInternalException(_))
716 }
717 pub fn is_kms_invalid_mac_exception(&self) -> bool {
719 matches!(self, Self::KmsInvalidMacException(_))
720 }
721 pub fn is_kms_invalid_state_exception(&self) -> bool {
723 matches!(self, Self::KmsInvalidStateException(_))
724 }
725 pub fn is_not_found_exception(&self) -> bool {
727 matches!(self, Self::NotFoundException(_))
728 }
729}
730impl ::std::error::Error for VerifyMacError {
731 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
732 match self {
733 Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
734 Self::DryRunOperationException(_inner) => ::std::option::Option::Some(_inner),
735 Self::InvalidGrantTokenException(_inner) => ::std::option::Option::Some(_inner),
736 Self::InvalidKeyUsageException(_inner) => ::std::option::Option::Some(_inner),
737 Self::KeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
738 Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
739 Self::KmsInvalidMacException(_inner) => ::std::option::Option::Some(_inner),
740 Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
741 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
742 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
743 }
744 }
745}
746impl ::std::fmt::Display for VerifyMacError {
747 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
748 match self {
749 Self::DisabledException(_inner) => _inner.fmt(f),
750 Self::DryRunOperationException(_inner) => _inner.fmt(f),
751 Self::InvalidGrantTokenException(_inner) => _inner.fmt(f),
752 Self::InvalidKeyUsageException(_inner) => _inner.fmt(f),
753 Self::KeyUnavailableException(_inner) => _inner.fmt(f),
754 Self::KmsInternalException(_inner) => _inner.fmt(f),
755 Self::KmsInvalidMacException(_inner) => _inner.fmt(f),
756 Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
757 Self::NotFoundException(_inner) => _inner.fmt(f),
758 Self::Unhandled(_inner) => {
759 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
760 write!(f, "unhandled error ({code})")
761 } else {
762 f.write_str("unhandled error")
763 }
764 }
765 }
766 }
767}
768impl ::aws_smithy_types::retry::ProvideErrorKind for VerifyMacError {
769 fn code(&self) -> ::std::option::Option<&str> {
770 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
771 }
772 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
773 ::std::option::Option::None
774 }
775}
776impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for VerifyMacError {
777 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
778 match self {
779 Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
780 Self::DryRunOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
781 Self::InvalidGrantTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
782 Self::InvalidKeyUsageException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
783 Self::KeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
784 Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
785 Self::KmsInvalidMacException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
786 Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
787 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
788 Self::Unhandled(_inner) => &_inner.meta,
789 }
790 }
791}
792impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for VerifyMacError {
793 fn create_unhandled_error(
794 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
795 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
796 ) -> Self {
797 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
798 source,
799 meta: meta.unwrap_or_default(),
800 })
801 }
802}
803impl ::aws_types::request_id::RequestId for crate::operation::verify_mac::VerifyMacError {
804 fn request_id(&self) -> Option<&str> {
805 self.meta().request_id()
806 }
807}
808
809pub use crate::operation::verify_mac::_verify_mac_input::VerifyMacInput;
810
811pub use crate::operation::verify_mac::_verify_mac_output::VerifyMacOutput;
812
813mod _verify_mac_input;
814
815mod _verify_mac_output;
816
817pub mod builders;