1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetPublicKey;
6impl GetPublicKey {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::get_public_key::GetPublicKeyInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::get_public_key::GetPublicKeyOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::get_public_key::GetPublicKeyInput,
18 ) -> ::std::result::Result<
19 crate::operation::get_public_key::GetPublicKeyOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::get_public_key::GetPublicKeyError,
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::get_public_key::GetPublicKeyError>()
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::get_public_key::GetPublicKeyOutput>()
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::get_public_key::GetPublicKeyInput,
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", "GetPublicKey", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "KMS.GetPublicKey",
63 "rpc.service" = "KMS",
64 "rpc.method" = "GetPublicKey",
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::DependencyTimeoutException::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::DependencyTimeoutException::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::DependencyTimeoutException::deserialize(d)?))
109 },
110 )
111.insert_error_shape(
112 crate::types::error::DisabledException::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::DisabledException::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::DisabledException::deserialize(d)?))
118 },
119 )
120.insert_error_shape(
121 crate::types::error::InvalidArnException::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::InvalidArnException::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::InvalidArnException::deserialize(d)?))
127 },
128 )
129.insert_error_shape(
130 crate::types::error::InvalidGrantTokenException::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::InvalidGrantTokenException::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::InvalidGrantTokenException::deserialize(d)?))
136 },
137 )
138.insert_error_shape(
139 crate::types::error::InvalidKeyUsageException::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::InvalidKeyUsageException::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::InvalidKeyUsageException::deserialize(d)?))
145 },
146 )
147.insert_error_shape(
148 crate::types::error::KmsInternalException::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::KmsInternalException::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::KmsInternalException::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.insert_error_shape(
184 crate::types::error::UnsupportedOperationException::SCHEMA,
185 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
186 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
187 },
188 |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> {
189 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
190 },
191 )
192 .build()
193 });
194}
195impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetPublicKey {
196 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
197 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetPublicKey");
198
199 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
200 GetPublicKeyRequestSerializer,
201 ));
202 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
203 GetPublicKeyResponseDeserializer,
204 ));
205
206 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
207 crate::config::auth::Params::builder()
208 .operation_name("GetPublicKey")
209 .build()
210 .expect("required fields set"),
211 ));
212
213 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("GetPublicKey", "KMS"));
214 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
215 signing_options.double_uri_encode = true;
216 signing_options.content_sha256_header = false;
217 signing_options.normalize_uri_path = true;
218 signing_options.payload_override = None;
219
220 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
221 signing_options,
222 ..::std::default::Default::default()
223 });
224
225 ::std::option::Option::Some(cfg.freeze())
226 }
227
228 fn runtime_components(
229 &self,
230 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
231 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
232 #[allow(unused_mut)]
233 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetPublicKey")
234 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
235 GetPublicKeyTelemetryInputCaptureInterceptor,
236 ))
237 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
238 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
239 ))
240 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
241 GetPublicKeyEndpointParamsInterceptor,
242 ))
243 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
244 crate::operation::get_public_key::GetPublicKeyError,
245 >::new())
246 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
247 crate::operation::get_public_key::GetPublicKeyError,
248 >::new())
249 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
250 crate::operation::get_public_key::GetPublicKeyError,
251 >::new())
252 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
253 crate::operation::get_public_key::GetPublicKeyError,
254 >::new());
255
256 ::std::borrow::Cow::Owned(rcb)
257 }
258}
259
260#[derive(Debug)]
261struct GetPublicKeyTelemetryInputCaptureInterceptor;
262
263#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
264impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetPublicKeyTelemetryInputCaptureInterceptor {
265 fn name(&self) -> &'static str {
266 "GetPublicKeyTelemetryInputCaptureInterceptor"
267 }
268
269 fn read_before_execution(
270 &self,
271 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
272 '_,
273 ::aws_smithy_runtime_api::client::interceptors::context::Input,
274 ::aws_smithy_runtime_api::client::interceptors::context::Output,
275 ::aws_smithy_runtime_api::client::interceptors::context::Error,
276 >,
277 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
278 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
279 let ::std::option::Option::Some(requested) = cfg
281 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
282 .filter(|r| !r.is_empty())
283 else {
284 return ::std::result::Result::Ok(());
285 };
286
287 let ::std::option::Option::Some(input) = context.input().downcast_ref::<GetPublicKeyInput>() else {
288 return ::std::result::Result::Ok(());
290 };
291
292 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
293 if requested.should_capture("KeyId") {
294 if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
295 captured.insert("KeyId", value);
296 }
297 }
298
299 cfg.interceptor_state().store_put(captured);
300 ::std::result::Result::Ok(())
301 }
302}
303#[derive(Debug)]
304struct GetPublicKeyResponseDeserializer;
305impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetPublicKeyResponseDeserializer {
306 fn deserialize_nonstreaming_with_config(
307 &self,
308 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
309 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
310 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
311 let (success, status) = (response.status().is_success(), response.status().as_u16());
312 #[allow(unused_variables)]
317 let body = response.body().bytes().expect("body loaded");
318 let headers = response.headers();
319 #[allow(unused_mut)]
320 let mut force_error = false;
321 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
322 if !success && status != 200 || force_error {
323 let protocol = _cfg
324 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
325 .expect("a SharedClientProtocol is required");
326 #[allow(unused_mut)]
327 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
328 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
329 })?;
330 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
331 let generic = generic_builder.build();
332 let error_code = match generic.code() {
333 ::std::option::Option::Some(code) => code,
334 ::std::option::Option::None => {
335 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
336 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::get_public_key::GetPublicKeyError::unhandled(generic)),
337 ))
338 }
339 };
340 let _error_message = generic.message().map(|msg| msg.to_owned());
341 let err = match error_code {
342 "DependencyTimeoutException" => crate::operation::get_public_key::GetPublicKeyError::DependencyTimeoutException({
343 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
344 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
345 e,
346 ))
347 })?;
348 let mut tmp = <crate::types::error::builders::DependencyTimeoutExceptionBuilder>::default();
349 tmp.deserialize_members(&mut *deser).map_err(|e| {
350 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
351 e,
352 ))
353 })?;
354 if tmp.message.is_none() {
355 tmp.message = _error_message;
356 }
357 let tmp = tmp.meta(generic);
358 tmp.build()
359 }),
360 "DisabledException" => crate::operation::get_public_key::GetPublicKeyError::DisabledException({
361 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
362 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
363 e,
364 ))
365 })?;
366 let mut tmp = <crate::types::error::builders::DisabledExceptionBuilder>::default();
367 tmp.deserialize_members(&mut *deser).map_err(|e| {
368 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
369 e,
370 ))
371 })?;
372 if tmp.message.is_none() {
373 tmp.message = _error_message;
374 }
375 let tmp = tmp.meta(generic);
376 tmp.build()
377 }),
378 "InvalidArnException" => crate::operation::get_public_key::GetPublicKeyError::InvalidArnException({
379 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
380 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
381 e,
382 ))
383 })?;
384 let mut tmp = <crate::types::error::builders::InvalidArnExceptionBuilder>::default();
385 tmp.deserialize_members(&mut *deser).map_err(|e| {
386 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
387 e,
388 ))
389 })?;
390 if tmp.message.is_none() {
391 tmp.message = _error_message;
392 }
393 let tmp = tmp.meta(generic);
394 tmp.build()
395 }),
396 "InvalidGrantTokenException" => crate::operation::get_public_key::GetPublicKeyError::InvalidGrantTokenException({
397 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
398 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
399 e,
400 ))
401 })?;
402 let mut tmp = <crate::types::error::builders::InvalidGrantTokenExceptionBuilder>::default();
403 tmp.deserialize_members(&mut *deser).map_err(|e| {
404 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
405 e,
406 ))
407 })?;
408 if tmp.message.is_none() {
409 tmp.message = _error_message;
410 }
411 let tmp = tmp.meta(generic);
412 tmp.build()
413 }),
414 "InvalidKeyUsageException" => crate::operation::get_public_key::GetPublicKeyError::InvalidKeyUsageException({
415 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
416 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
417 e,
418 ))
419 })?;
420 let mut tmp = <crate::types::error::builders::InvalidKeyUsageExceptionBuilder>::default();
421 tmp.deserialize_members(&mut *deser).map_err(|e| {
422 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
423 e,
424 ))
425 })?;
426 if tmp.message.is_none() {
427 tmp.message = _error_message;
428 }
429 let tmp = tmp.meta(generic);
430 tmp.build()
431 }),
432 "KeyUnavailableException" => crate::operation::get_public_key::GetPublicKeyError::KeyUnavailableException({
433 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
434 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
435 e,
436 ))
437 })?;
438 let mut tmp = <crate::types::error::builders::KeyUnavailableExceptionBuilder>::default();
439 tmp.deserialize_members(&mut *deser).map_err(|e| {
440 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
441 e,
442 ))
443 })?;
444 if tmp.message.is_none() {
445 tmp.message = _error_message;
446 }
447 let tmp = tmp.meta(generic);
448 tmp.build()
449 }),
450 "KMSInternalException" => crate::operation::get_public_key::GetPublicKeyError::KmsInternalException({
451 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
452 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
453 e,
454 ))
455 })?;
456 let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
457 tmp.deserialize_members(&mut *deser).map_err(|e| {
458 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
459 e,
460 ))
461 })?;
462 if tmp.message.is_none() {
463 tmp.message = _error_message;
464 }
465 let tmp = tmp.meta(generic);
466 tmp.build()
467 }),
468 "KMSInvalidStateException" => crate::operation::get_public_key::GetPublicKeyError::KmsInvalidStateException({
469 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
470 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
471 e,
472 ))
473 })?;
474 let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
475 tmp.deserialize_members(&mut *deser).map_err(|e| {
476 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
477 e,
478 ))
479 })?;
480 if tmp.message.is_none() {
481 tmp.message = _error_message;
482 }
483 let tmp = tmp.meta(generic);
484 tmp.build()
485 }),
486 "NotFoundException" => crate::operation::get_public_key::GetPublicKeyError::NotFoundException({
487 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
488 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
489 e,
490 ))
491 })?;
492 let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
493 tmp.deserialize_members(&mut *deser).map_err(|e| {
494 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
495 e,
496 ))
497 })?;
498 if tmp.message.is_none() {
499 tmp.message = _error_message;
500 }
501 let tmp = tmp.meta(generic);
502 tmp.build()
503 }),
504 "UnsupportedOperationException" => crate::operation::get_public_key::GetPublicKeyError::UnsupportedOperationException({
505 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
506 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
507 e,
508 ))
509 })?;
510 let mut tmp = <crate::types::error::builders::UnsupportedOperationExceptionBuilder>::default();
511 tmp.deserialize_members(&mut *deser).map_err(|e| {
512 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
513 e,
514 ))
515 })?;
516 if tmp.message.is_none() {
517 tmp.message = _error_message;
518 }
519 let tmp = tmp.meta(generic);
520 tmp.build()
521 }),
522 _ => {
523 match protocol
531 .deserialize_error_response(response, _cfg)
532 .ok()
533 .and_then(|mut deser| {
534 ::aws_smithy_schema::registry::reify_error(
535 crate::operation::get_public_key::error_registry::REGISTRY
536 .or(&crate::error_type_registry::REGISTRY),
537 error_code,
538 &mut *deser,
539 )
540 }) {
541 ::std::option::Option::Some(source) => <crate::operation::get_public_key::GetPublicKeyError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
542 ::std::option::Option::None => crate::operation::get_public_key::GetPublicKeyError::generic(generic),
543 }
544 }
545 };
546 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
547 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
548 ))
549 } else {
550 let protocol = _cfg
551 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
552 .expect("a SharedClientProtocol is required");
553 let mut deser = protocol.deserialize_response(response, GetPublicKey::OUTPUT_SCHEMA, _cfg).map_err(|e| {
554 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
555 })?;
556 let _response_headers = headers;
560 #[allow(unused_mut)]
564 let mut output = <crate::operation::get_public_key::builders::GetPublicKeyOutputBuilder>::default();
565 output.deserialize_members(&mut *deser).map_err(|e| {
566 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
567 })?;
568 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
569 let output = output.build();
570 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
571 }
572 }
573}
574#[derive(Debug)]
575struct GetPublicKeyRequestSerializer;
576impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetPublicKeyRequestSerializer {
577 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
578 fn serialize_input(
579 &self,
580 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
581 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
582 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
583 let input = input
584 .downcast::<crate::operation::get_public_key::GetPublicKeyInput>()
585 .expect("correct type");
586
587 let protocol = _cfg
588 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
589 .expect("a SharedClientProtocol is required");
590 let mut request = protocol
591 .serialize_request(&input, GetPublicKey::INPUT_SCHEMA, "/", _cfg)
592 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
593
594 return ::std::result::Result::Ok(request);
595 }
596}
597#[derive(Debug)]
598struct GetPublicKeyEndpointParamsInterceptor;
599
600#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
601impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetPublicKeyEndpointParamsInterceptor {
602 fn name(&self) -> &'static str {
603 "GetPublicKeyEndpointParamsInterceptor"
604 }
605
606 fn read_before_execution(
607 &self,
608 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
609 '_,
610 ::aws_smithy_runtime_api::client::interceptors::context::Input,
611 ::aws_smithy_runtime_api::client::interceptors::context::Output,
612 ::aws_smithy_runtime_api::client::interceptors::context::Error,
613 >,
614 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
615 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
616 let _input = context
617 .input()
618 .downcast_ref::<GetPublicKeyInput>()
619 .ok_or("failed to downcast to GetPublicKeyInput")?;
620
621 let params = crate::config::endpoint::Params::builder()
622 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
623 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
624 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
625 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
626 .build()
627 .map_err(|err| {
628 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
629 })?;
630 cfg.interceptor_state()
631 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
632 ::std::result::Result::Ok(())
633 }
634}
635
636#[non_exhaustive]
641#[derive(::std::fmt::Debug)]
642pub enum GetPublicKeyError {
643 DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
645 DisabledException(crate::types::error::DisabledException),
647 InvalidArnException(crate::types::error::InvalidArnException),
649 InvalidGrantTokenException(crate::types::error::InvalidGrantTokenException),
651 InvalidKeyUsageException(crate::types::error::InvalidKeyUsageException),
661 KeyUnavailableException(crate::types::error::KeyUnavailableException),
663 KmsInternalException(crate::types::error::KmsInternalException),
665 KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
675 NotFoundException(crate::types::error::NotFoundException),
677 UnsupportedOperationException(crate::types::error::UnsupportedOperationException),
679 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
681 variable wildcard pattern and check `.code()`:
682 \
683 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
684 \
685 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetPublicKeyError) for what information is available for the error.")]
686 Unhandled(crate::error::sealed_unhandled::Unhandled),
687}
688impl GetPublicKeyError {
689 pub fn unhandled(
691 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
692 ) -> Self {
693 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
694 source: err.into(),
695 meta: ::std::default::Default::default(),
696 })
697 }
698
699 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
701 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
702 source: err.clone().into(),
703 meta: err,
704 })
705 }
706 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
711 match self {
712 Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
713 Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
714 Self::InvalidArnException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
715 Self::InvalidGrantTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
716 Self::InvalidKeyUsageException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
717 Self::KeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
718 Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
719 Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
720 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
721 Self::UnsupportedOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
722 Self::Unhandled(e) => &e.meta,
723 }
724 }
725 pub fn is_dependency_timeout_exception(&self) -> bool {
727 matches!(self, Self::DependencyTimeoutException(_))
728 }
729 pub fn is_disabled_exception(&self) -> bool {
731 matches!(self, Self::DisabledException(_))
732 }
733 pub fn is_invalid_arn_exception(&self) -> bool {
735 matches!(self, Self::InvalidArnException(_))
736 }
737 pub fn is_invalid_grant_token_exception(&self) -> bool {
739 matches!(self, Self::InvalidGrantTokenException(_))
740 }
741 pub fn is_invalid_key_usage_exception(&self) -> bool {
743 matches!(self, Self::InvalidKeyUsageException(_))
744 }
745 pub fn is_key_unavailable_exception(&self) -> bool {
747 matches!(self, Self::KeyUnavailableException(_))
748 }
749 pub fn is_kms_internal_exception(&self) -> bool {
751 matches!(self, Self::KmsInternalException(_))
752 }
753 pub fn is_kms_invalid_state_exception(&self) -> bool {
755 matches!(self, Self::KmsInvalidStateException(_))
756 }
757 pub fn is_not_found_exception(&self) -> bool {
759 matches!(self, Self::NotFoundException(_))
760 }
761 pub fn is_unsupported_operation_exception(&self) -> bool {
763 matches!(self, Self::UnsupportedOperationException(_))
764 }
765}
766impl ::std::error::Error for GetPublicKeyError {
767 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
768 match self {
769 Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
770 Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
771 Self::InvalidArnException(_inner) => ::std::option::Option::Some(_inner),
772 Self::InvalidGrantTokenException(_inner) => ::std::option::Option::Some(_inner),
773 Self::InvalidKeyUsageException(_inner) => ::std::option::Option::Some(_inner),
774 Self::KeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
775 Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
776 Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
777 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
778 Self::UnsupportedOperationException(_inner) => ::std::option::Option::Some(_inner),
779 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
780 }
781 }
782}
783impl ::std::fmt::Display for GetPublicKeyError {
784 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
785 match self {
786 Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
787 Self::DisabledException(_inner) => _inner.fmt(f),
788 Self::InvalidArnException(_inner) => _inner.fmt(f),
789 Self::InvalidGrantTokenException(_inner) => _inner.fmt(f),
790 Self::InvalidKeyUsageException(_inner) => _inner.fmt(f),
791 Self::KeyUnavailableException(_inner) => _inner.fmt(f),
792 Self::KmsInternalException(_inner) => _inner.fmt(f),
793 Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
794 Self::NotFoundException(_inner) => _inner.fmt(f),
795 Self::UnsupportedOperationException(_inner) => _inner.fmt(f),
796 Self::Unhandled(_inner) => {
797 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
798 write!(f, "unhandled error ({code})")
799 } else {
800 f.write_str("unhandled error")
801 }
802 }
803 }
804 }
805}
806impl ::aws_smithy_types::retry::ProvideErrorKind for GetPublicKeyError {
807 fn code(&self) -> ::std::option::Option<&str> {
808 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
809 }
810 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
811 ::std::option::Option::None
812 }
813}
814impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetPublicKeyError {
815 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
816 match self {
817 Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
818 Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
819 Self::InvalidArnException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
820 Self::InvalidGrantTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
821 Self::InvalidKeyUsageException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
822 Self::KeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
823 Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
824 Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
825 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
826 Self::UnsupportedOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
827 Self::Unhandled(_inner) => &_inner.meta,
828 }
829 }
830}
831impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetPublicKeyError {
832 fn create_unhandled_error(
833 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
834 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
835 ) -> Self {
836 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
837 source,
838 meta: meta.unwrap_or_default(),
839 })
840 }
841}
842impl ::aws_types::request_id::RequestId for crate::operation::get_public_key::GetPublicKeyError {
843 fn request_id(&self) -> Option<&str> {
844 self.meta().request_id()
845 }
846}
847
848pub use crate::operation::get_public_key::_get_public_key_input::GetPublicKeyInput;
849
850pub use crate::operation::get_public_key::_get_public_key_output::GetPublicKeyOutput;
851
852mod _get_public_key_input;
853
854mod _get_public_key_output;
855
856pub mod builders;