1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct Verify;
6impl Verify {
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::verify::VerifyInput,
14 ) -> ::std::result::Result<
15 crate::operation::verify::VerifyOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::verify::VerifyError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err =
22 |err: ::aws_smithy_runtime_api::client::result::SdkError<
23 ::aws_smithy_runtime_api::client::interceptors::context::Error,
24 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
25 >| { err.map_service_error(|err| err.downcast::<crate::operation::verify::VerifyError>().expect("correct error type")) };
26 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
27 .await
28 .map_err(map_err)?;
29 let output = context.finalize().map_err(map_err)?;
30 ::std::result::Result::Ok(output.downcast::<crate::operation::verify::VerifyOutput>().expect("correct output type"))
31 }
32
33 pub(crate) async fn orchestrate_with_stop_point(
34 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
35 input: crate::operation::verify::VerifyInput,
36 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
37 ) -> ::std::result::Result<
38 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
39 ::aws_smithy_runtime_api::client::result::SdkError<
40 ::aws_smithy_runtime_api::client::interceptors::context::Error,
41 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
42 >,
43 > {
44 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
45 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("kms", "Verify", input, runtime_plugins, stop_point).await
46 }
47
48 pub(crate) fn operation_runtime_plugins(
49 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
50 client_config: &crate::config::Config,
51 config_override: ::std::option::Option<crate::config::Builder>,
52 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
53 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
54 runtime_plugins = runtime_plugins.with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
55 ::aws_runtime::auth::sigv4::SCHEME_ID,
56 ]));
57 if let ::std::option::Option::Some(config_override) = config_override {
58 for plugin in config_override.runtime_plugins.iter().cloned() {
59 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
60 }
61 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
62 config_override,
63 client_config.config.clone(),
64 &client_config.runtime_components,
65 ));
66 }
67 runtime_plugins
68 }
69}
70impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for Verify {
71 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
72 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Verify");
73
74 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
75 VerifyRequestSerializer,
76 ));
77 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
78 VerifyResponseDeserializer,
79 ));
80
81 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
82 ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
83 ));
84
85 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("Verify", "kms"));
86 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
87 signing_options.double_uri_encode = true;
88 signing_options.content_sha256_header = false;
89 signing_options.normalize_uri_path = true;
90 signing_options.payload_override = None;
91
92 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
93 signing_options,
94 ..::std::default::Default::default()
95 });
96
97 ::std::option::Option::Some(cfg.freeze())
98 }
99
100 fn runtime_components(
101 &self,
102 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
103 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
104 #[allow(unused_mut)]
105 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("Verify")
106 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
107 .with_interceptor(VerifyEndpointParamsInterceptor)
108 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
109 crate::operation::verify::VerifyError,
110 >::new())
111 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
112 crate::operation::verify::VerifyError,
113 >::new())
114 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
115 crate::operation::verify::VerifyError,
116 >::new());
117
118 ::std::borrow::Cow::Owned(rcb)
119 }
120}
121
122#[derive(Debug)]
123struct VerifyResponseDeserializer;
124impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for VerifyResponseDeserializer {
125 fn deserialize_nonstreaming(
126 &self,
127 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
128 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
129 let (success, status) = (response.status().is_success(), response.status().as_u16());
130 let headers = response.headers();
131 let body = response.body().bytes().expect("body loaded");
132 #[allow(unused_mut)]
133 let mut force_error = false;
134 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
135 let parse_result = if !success && status != 200 || force_error {
136 crate::protocol_serde::shape_verify::de_verify_http_error(status, headers, body)
137 } else {
138 crate::protocol_serde::shape_verify::de_verify_http_response(status, headers, body)
139 };
140 crate::protocol_serde::type_erase_result(parse_result)
141 }
142}
143#[derive(Debug)]
144struct VerifyRequestSerializer;
145impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for VerifyRequestSerializer {
146 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
147 fn serialize_input(
148 &self,
149 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
150 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
151 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
152 let input = input.downcast::<crate::operation::verify::VerifyInput>().expect("correct type");
153 let _header_serialization_settings = _cfg
154 .load::<crate::serialization_settings::HeaderSerializationSettings>()
155 .cloned()
156 .unwrap_or_default();
157 let mut request_builder = {
158 fn uri_base(
159 _input: &crate::operation::verify::VerifyInput,
160 output: &mut ::std::string::String,
161 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
162 use ::std::fmt::Write as _;
163 ::std::write!(output, "/").expect("formatting should succeed");
164 ::std::result::Result::Ok(())
165 }
166 #[allow(clippy::unnecessary_wraps)]
167 fn update_http_builder(
168 input: &crate::operation::verify::VerifyInput,
169 builder: ::http::request::Builder,
170 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
171 let mut uri = ::std::string::String::new();
172 uri_base(input, &mut uri)?;
173 ::std::result::Result::Ok(builder.method("POST").uri(uri))
174 }
175 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
176 builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.1");
177 builder = _header_serialization_settings.set_default_header(
178 builder,
179 ::http::header::HeaderName::from_static("x-amz-target"),
180 "TrentService.Verify",
181 );
182 builder
183 };
184 let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_verify::ser_verify_input(&input)?);
185 if let Some(content_length) = body.content_length() {
186 let content_length = content_length.to_string();
187 request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
188 }
189 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
190 }
191}
192#[derive(Debug)]
193struct VerifyEndpointParamsInterceptor;
194
195impl ::aws_smithy_runtime_api::client::interceptors::Intercept for VerifyEndpointParamsInterceptor {
196 fn name(&self) -> &'static str {
197 "VerifyEndpointParamsInterceptor"
198 }
199
200 fn read_before_execution(
201 &self,
202 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
203 '_,
204 ::aws_smithy_runtime_api::client::interceptors::context::Input,
205 ::aws_smithy_runtime_api::client::interceptors::context::Output,
206 ::aws_smithy_runtime_api::client::interceptors::context::Error,
207 >,
208 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
209 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
210 let _input = context.input().downcast_ref::<VerifyInput>().ok_or("failed to downcast to VerifyInput")?;
211
212 let params = crate::config::endpoint::Params::builder()
213 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
214 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
215 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
216 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
217 .build()
218 .map_err(|err| {
219 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
220 })?;
221 cfg.interceptor_state()
222 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
223 ::std::result::Result::Ok(())
224 }
225}
226
227#[non_exhaustive]
232#[derive(::std::fmt::Debug)]
233pub enum VerifyError {
234 DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
236 DisabledException(crate::types::error::DisabledException),
238 DryRunOperationException(crate::types::error::DryRunOperationException),
240 InvalidGrantTokenException(crate::types::error::InvalidGrantTokenException),
242 InvalidKeyUsageException(crate::types::error::InvalidKeyUsageException),
252 KeyUnavailableException(crate::types::error::KeyUnavailableException),
254 KmsInternalException(crate::types::error::KmsInternalException),
256 KmsInvalidSignatureException(crate::types::error::KmsInvalidSignatureException),
258 KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
268 NotFoundException(crate::types::error::NotFoundException),
270 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
272 variable wildcard pattern and check `.code()`:
273 \
274 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
275 \
276 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-VerifyError) for what information is available for the error.")]
277 Unhandled(crate::error::sealed_unhandled::Unhandled),
278}
279impl VerifyError {
280 pub fn unhandled(
282 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
283 ) -> Self {
284 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
285 source: err.into(),
286 meta: ::std::default::Default::default(),
287 })
288 }
289
290 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
292 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
293 source: err.clone().into(),
294 meta: err,
295 })
296 }
297 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
302 match self {
303 Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
304 Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
305 Self::DryRunOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
306 Self::InvalidGrantTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
307 Self::InvalidKeyUsageException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
308 Self::KeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
309 Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
310 Self::KmsInvalidSignatureException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
311 Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
312 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
313 Self::Unhandled(e) => &e.meta,
314 }
315 }
316 pub fn is_dependency_timeout_exception(&self) -> bool {
318 matches!(self, Self::DependencyTimeoutException(_))
319 }
320 pub fn is_disabled_exception(&self) -> bool {
322 matches!(self, Self::DisabledException(_))
323 }
324 pub fn is_dry_run_operation_exception(&self) -> bool {
326 matches!(self, Self::DryRunOperationException(_))
327 }
328 pub fn is_invalid_grant_token_exception(&self) -> bool {
330 matches!(self, Self::InvalidGrantTokenException(_))
331 }
332 pub fn is_invalid_key_usage_exception(&self) -> bool {
334 matches!(self, Self::InvalidKeyUsageException(_))
335 }
336 pub fn is_key_unavailable_exception(&self) -> bool {
338 matches!(self, Self::KeyUnavailableException(_))
339 }
340 pub fn is_kms_internal_exception(&self) -> bool {
342 matches!(self, Self::KmsInternalException(_))
343 }
344 pub fn is_kms_invalid_signature_exception(&self) -> bool {
346 matches!(self, Self::KmsInvalidSignatureException(_))
347 }
348 pub fn is_kms_invalid_state_exception(&self) -> bool {
350 matches!(self, Self::KmsInvalidStateException(_))
351 }
352 pub fn is_not_found_exception(&self) -> bool {
354 matches!(self, Self::NotFoundException(_))
355 }
356}
357impl ::std::error::Error for VerifyError {
358 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
359 match self {
360 Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
361 Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
362 Self::DryRunOperationException(_inner) => ::std::option::Option::Some(_inner),
363 Self::InvalidGrantTokenException(_inner) => ::std::option::Option::Some(_inner),
364 Self::InvalidKeyUsageException(_inner) => ::std::option::Option::Some(_inner),
365 Self::KeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
366 Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
367 Self::KmsInvalidSignatureException(_inner) => ::std::option::Option::Some(_inner),
368 Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
369 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
370 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
371 }
372 }
373}
374impl ::std::fmt::Display for VerifyError {
375 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
376 match self {
377 Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
378 Self::DisabledException(_inner) => _inner.fmt(f),
379 Self::DryRunOperationException(_inner) => _inner.fmt(f),
380 Self::InvalidGrantTokenException(_inner) => _inner.fmt(f),
381 Self::InvalidKeyUsageException(_inner) => _inner.fmt(f),
382 Self::KeyUnavailableException(_inner) => _inner.fmt(f),
383 Self::KmsInternalException(_inner) => _inner.fmt(f),
384 Self::KmsInvalidSignatureException(_inner) => _inner.fmt(f),
385 Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
386 Self::NotFoundException(_inner) => _inner.fmt(f),
387 Self::Unhandled(_inner) => {
388 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
389 write!(f, "unhandled error ({code})")
390 } else {
391 f.write_str("unhandled error")
392 }
393 }
394 }
395 }
396}
397impl ::aws_smithy_types::retry::ProvideErrorKind for VerifyError {
398 fn code(&self) -> ::std::option::Option<&str> {
399 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
400 }
401 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
402 ::std::option::Option::None
403 }
404}
405impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for VerifyError {
406 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
407 match self {
408 Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
409 Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
410 Self::DryRunOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
411 Self::InvalidGrantTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
412 Self::InvalidKeyUsageException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
413 Self::KeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
414 Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
415 Self::KmsInvalidSignatureException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
416 Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
417 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
418 Self::Unhandled(_inner) => &_inner.meta,
419 }
420 }
421}
422impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for VerifyError {
423 fn create_unhandled_error(
424 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
425 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
426 ) -> Self {
427 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
428 source,
429 meta: meta.unwrap_or_default(),
430 })
431 }
432}
433impl ::aws_types::request_id::RequestId for crate::operation::verify::VerifyError {
434 fn request_id(&self) -> Option<&str> {
435 self.meta().request_id()
436 }
437}
438
439pub use crate::operation::verify::_verify_output::VerifyOutput;
440
441pub use crate::operation::verify::_verify_input::VerifyInput;
442
443mod _verify_input;
444
445mod _verify_output;
446
447pub mod builders;