Skip to main content

aws_sdk_kms/operation/
get_parameters_for_import.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `GetParametersForImport`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetParametersForImport;
6impl GetParametersForImport {
7    /// Creates a new `GetParametersForImport`
8    pub fn new() -> Self {
9        Self
10    }
11    /// The schema for this operation's input shape.
12    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
13        crate::operation::get_parameters_for_import::GetParametersForImportInput::SCHEMA;
14    /// The schema for this operation's output shape.
15    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
16        crate::operation::get_parameters_for_import::GetParametersForImportOutput::SCHEMA;
17    pub(crate) async fn orchestrate(
18        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
19        input: crate::operation::get_parameters_for_import::GetParametersForImportInput,
20    ) -> ::std::result::Result<
21        crate::operation::get_parameters_for_import::GetParametersForImportOutput,
22        ::aws_smithy_runtime_api::client::result::SdkError<
23            crate::operation::get_parameters_for_import::GetParametersForImportError,
24            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
25        >,
26    > {
27        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
28            ::aws_smithy_runtime_api::client::interceptors::context::Error,
29            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
30        >| {
31            err.map_service_error(|err| {
32                err.downcast::<crate::operation::get_parameters_for_import::GetParametersForImportError>()
33                    .expect("correct error type")
34            })
35        };
36        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
37            .await
38            .map_err(map_err)?;
39        let output = context.finalize().map_err(map_err)?;
40        ::std::result::Result::Ok(
41            output
42                .downcast::<crate::operation::get_parameters_for_import::GetParametersForImportOutput>()
43                .expect("correct output type"),
44        )
45    }
46
47    pub(crate) async fn orchestrate_with_stop_point(
48        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
49        input: crate::operation::get_parameters_for_import::GetParametersForImportInput,
50        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
51    ) -> ::std::result::Result<
52        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
53        ::aws_smithy_runtime_api::client::result::SdkError<
54            ::aws_smithy_runtime_api::client::interceptors::context::Error,
55            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
56        >,
57    > {
58        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
59        use ::tracing::Instrument;
60        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("KMS", "GetParametersForImport", input, runtime_plugins, stop_point)
61            // Create a parent span for the entire operation. Includes a random, internal-only,
62            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
63            .instrument(::tracing::debug_span!(
64                "KMS.GetParametersForImport",
65                "rpc.service" = "KMS",
66                "rpc.method" = "GetParametersForImport",
67                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
68                "rpc.system" = "aws-api",
69            ))
70            .await
71    }
72
73    pub(crate) fn operation_runtime_plugins(
74        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
75        client_config: &crate::config::Config,
76        config_override: ::std::option::Option<crate::config::Builder>,
77    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
78        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
79
80        if let ::std::option::Option::Some(config_override) = config_override {
81            for plugin in config_override.runtime_plugins.iter().cloned() {
82                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
83            }
84            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
85                config_override,
86                client_config.config.clone(),
87                &client_config.runtime_components,
88            ));
89        }
90        runtime_plugins
91    }
92}
93/// Per-operation error registry. Contains an entry for every modeled
94/// error this operation can throw.
95///
96/// Used by the schema-serde error path as the operation-scoped lookup
97/// for registry-backed error reification: an error code that does not
98/// match one of the operation's modeled errors directly is resolved
99/// against this registry first, then widened to the service-wide error
100/// registry.
101pub(crate) mod error_registry {
102    pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
103        ::aws_smithy_schema::registry::TypeRegistry::builder()
104                            .insert_error_shape(
105                        crate::types::error::DependencyTimeoutException::SCHEMA,
106                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
107                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
108                        },
109                        |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> {
110                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
111                        },
112                    )
113.insert_error_shape(
114                        crate::types::error::InvalidArnException::SCHEMA,
115                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
116                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidArnException::deserialize(d)?))
117                        },
118                        |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> {
119                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidArnException::deserialize(d)?))
120                        },
121                    )
122.insert_error_shape(
123                        crate::types::error::KmsInternalException::SCHEMA,
124                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
125                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInternalException::deserialize(d)?))
126                        },
127                        |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> {
128                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInternalException::deserialize(d)?))
129                        },
130                    )
131.insert_error_shape(
132                        crate::types::error::KmsInvalidStateException::SCHEMA,
133                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
134                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
135                        },
136                        |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> {
137                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
138                        },
139                    )
140.insert_error_shape(
141                        crate::types::error::NotFoundException::SCHEMA,
142                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
143                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::NotFoundException::deserialize(d)?))
144                        },
145                        |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> {
146                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::NotFoundException::deserialize(d)?))
147                        },
148                    )
149.insert_error_shape(
150                        crate::types::error::UnsupportedOperationException::SCHEMA,
151                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
152                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
153                        },
154                        |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> {
155                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
156                        },
157                    )
158                            .build()
159    });
160}
161impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetParametersForImport {
162    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
163        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetParametersForImport");
164
165        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
166            GetParametersForImportRequestSerializer,
167        ));
168        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
169            GetParametersForImportResponseDeserializer,
170        ));
171
172        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
173            crate::config::auth::Params::builder()
174                .operation_name("GetParametersForImport")
175                .build()
176                .expect("required fields set"),
177        ));
178
179        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
180        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
181            "GetParametersForImport",
182            "KMS",
183        ));
184        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
185        signing_options.double_uri_encode = true;
186        signing_options.content_sha256_header = false;
187        signing_options.normalize_uri_path = true;
188        signing_options.payload_override = None;
189
190        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
191            signing_options,
192            ..::std::default::Default::default()
193        });
194
195        ::std::option::Option::Some(cfg.freeze())
196    }
197
198    fn runtime_components(
199        &self,
200        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
201    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
202        #[allow(unused_mut)]
203        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetParametersForImport")
204            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
205                GetParametersForImportTelemetryInputCaptureInterceptor,
206            ))
207            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
208                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
209            ))
210            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
211                GetParametersForImportEndpointParamsInterceptor,
212            ))
213            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
214                crate::operation::get_parameters_for_import::GetParametersForImportError,
215            >::new())
216            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
217                crate::operation::get_parameters_for_import::GetParametersForImportError,
218            >::new())
219            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
220                crate::operation::get_parameters_for_import::GetParametersForImportError,
221            >::new())
222            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
223                crate::operation::get_parameters_for_import::GetParametersForImportError,
224            >::new());
225
226        ::std::borrow::Cow::Owned(rcb)
227    }
228}
229
230#[derive(Debug)]
231struct GetParametersForImportTelemetryInputCaptureInterceptor;
232
233#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
234impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetParametersForImportTelemetryInputCaptureInterceptor {
235    fn name(&self) -> &'static str {
236        "GetParametersForImportTelemetryInputCaptureInterceptor"
237    }
238
239    fn read_before_execution(
240        &self,
241        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
242            '_,
243            ::aws_smithy_runtime_api::client::interceptors::context::Input,
244            ::aws_smithy_runtime_api::client::interceptors::context::Output,
245            ::aws_smithy_runtime_api::client::interceptors::context::Error,
246        >,
247        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
248    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
249        // Nothing to do unless the customer opted in by naming members to record.
250        let ::std::option::Option::Some(requested) = cfg
251            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
252            .filter(|r| !r.is_empty())
253        else {
254            return ::std::result::Result::Ok(());
255        };
256
257        let ::std::option::Option::Some(input) = context.input().downcast_ref::<GetParametersForImportInput>() else {
258            // A mismatched input is not this interceptor's concern; skip quietly.
259            return ::std::result::Result::Ok(());
260        };
261
262        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
263        if requested.should_capture("KeyId") {
264            if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
265                captured.insert("KeyId", value);
266            }
267        }
268
269        cfg.interceptor_state().store_put(captured);
270        ::std::result::Result::Ok(())
271    }
272}
273#[derive(Debug)]
274struct GetParametersForImportResponseDeserializer;
275impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetParametersForImportResponseDeserializer {
276    fn deserialize_nonstreaming_with_config(
277        &self,
278        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
279        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
280    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
281        let (success, status) = (response.status().is_success(), response.status().as_u16());
282        // Load body and headers BEFORE BeforeParseResponse so customizations
283        // (e.g., S3's `body_is_error` check that detects errors returned with
284        // HTTP 200) can inspect them. The legacy non-streaming path also
285        // loads `body` before firing this hook.
286        #[allow(unused_variables)]
287        let body = response.body().bytes().expect("body loaded");
288        let headers = response.headers();
289        #[allow(unused_mut)]
290        let mut force_error = false;
291        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
292        if !success && status != 200 || force_error {
293            let protocol = _cfg
294                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
295                .expect("a SharedClientProtocol is required");
296            #[allow(unused_mut)]
297            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
298                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
299            })?;
300            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
301            let generic = generic_builder.build();
302            let error_code = match generic.code() {
303                ::std::option::Option::Some(code) => code,
304                ::std::option::Option::None => {
305                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
306                        ::aws_smithy_runtime_api::box_error::BoxError::from(
307                            crate::operation::get_parameters_for_import::GetParametersForImportError::unhandled(generic),
308                        ),
309                    ))
310                }
311            };
312            let _error_message = generic.message().map(|msg| msg.to_owned());
313            let err = match error_code {
314                "DependencyTimeoutException" => {
315                    crate::operation::get_parameters_for_import::GetParametersForImportError::DependencyTimeoutException({
316                        let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
317                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
318                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
319                            )
320                        })?;
321                        let mut tmp = <crate::types::error::builders::DependencyTimeoutExceptionBuilder>::default();
322                        tmp.deserialize_members(&mut *deser).map_err(|e| {
323                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
324                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
325                            )
326                        })?;
327                        if tmp.message.is_none() {
328                            tmp.message = _error_message;
329                        }
330                        let tmp = tmp.meta(generic);
331                        tmp.build()
332                    })
333                }
334                "InvalidArnException" => crate::operation::get_parameters_for_import::GetParametersForImportError::InvalidArnException({
335                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
336                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
337                            e,
338                        ))
339                    })?;
340                    let mut tmp = <crate::types::error::builders::InvalidArnExceptionBuilder>::default();
341                    tmp.deserialize_members(&mut *deser).map_err(|e| {
342                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
343                            e,
344                        ))
345                    })?;
346                    if tmp.message.is_none() {
347                        tmp.message = _error_message;
348                    }
349                    let tmp = tmp.meta(generic);
350                    tmp.build()
351                }),
352                "KMSInternalException" => crate::operation::get_parameters_for_import::GetParametersForImportError::KmsInternalException({
353                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
354                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
355                            e,
356                        ))
357                    })?;
358                    let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
359                    tmp.deserialize_members(&mut *deser).map_err(|e| {
360                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
361                            e,
362                        ))
363                    })?;
364                    if tmp.message.is_none() {
365                        tmp.message = _error_message;
366                    }
367                    let tmp = tmp.meta(generic);
368                    tmp.build()
369                }),
370                "KMSInvalidStateException" => crate::operation::get_parameters_for_import::GetParametersForImportError::KmsInvalidStateException({
371                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
372                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
373                            e,
374                        ))
375                    })?;
376                    let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
377                    tmp.deserialize_members(&mut *deser).map_err(|e| {
378                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
379                            e,
380                        ))
381                    })?;
382                    if tmp.message.is_none() {
383                        tmp.message = _error_message;
384                    }
385                    let tmp = tmp.meta(generic);
386                    tmp.build()
387                }),
388                "NotFoundException" => crate::operation::get_parameters_for_import::GetParametersForImportError::NotFoundException({
389                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
390                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
391                            e,
392                        ))
393                    })?;
394                    let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
395                    tmp.deserialize_members(&mut *deser).map_err(|e| {
396                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
397                            e,
398                        ))
399                    })?;
400                    if tmp.message.is_none() {
401                        tmp.message = _error_message;
402                    }
403                    let tmp = tmp.meta(generic);
404                    tmp.build()
405                }),
406                "UnsupportedOperationException" => {
407                    crate::operation::get_parameters_for_import::GetParametersForImportError::UnsupportedOperationException({
408                        let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
409                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
410                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
411                            )
412                        })?;
413                        let mut tmp = <crate::types::error::builders::UnsupportedOperationExceptionBuilder>::default();
414                        tmp.deserialize_members(&mut *deser).map_err(|e| {
415                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
416                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
417                            )
418                        })?;
419                        if tmp.message.is_none() {
420                            tmp.message = _error_message;
421                        }
422                        let tmp = tmp.meta(generic);
423                        tmp.build()
424                    })
425                }
426                _ => {
427                    // Registry-backed, operation-scoped reification of an error whose
428                    // code this operation does not model directly: the operation's own
429                    // error registry is consulted first, then the lookup widens to the
430                    // service-wide error registry. On a hit, the reified error is attached
431                    // as the source of the returned unhandled error while its metadata
432                    // (code, message, request id) is preserved; on a miss the generic
433                    // error is returned unchanged.
434                    match protocol
435                        .deserialize_error_response(response, _cfg)
436                        .ok()
437                        .and_then(|mut deser| {
438                            ::aws_smithy_schema::registry::reify_error(
439                                crate::operation::get_parameters_for_import::error_registry::REGISTRY
440                                    .or(&crate::error_type_registry::REGISTRY),
441                                error_code,
442                                &mut *deser,
443                            )
444                        }) {
445                        ::std::option::Option::Some(source) => <crate::operation::get_parameters_for_import::GetParametersForImportError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
446                        ::std::option::Option::None => crate::operation::get_parameters_for_import::GetParametersForImportError::generic(generic),
447                    }
448                }
449            };
450            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
451                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
452            ))
453        } else {
454            let protocol = _cfg
455                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
456                .expect("a SharedClientProtocol is required");
457            let mut deser = protocol
458                .deserialize_response(response, GetParametersForImport::OUTPUT_SCHEMA, _cfg)
459                .map_err(|e| {
460                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
461                })?;
462            // `headers` is already in scope from the top of the function; alias it as
463            // `_response_headers` so MutateOutput customizations have a stable name to
464            // read from.
465            let _response_headers = headers;
466            // `mut` is required because `deserialize_members` and the `MutateOutput`
467            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
468            // empty output has no members and no customizations to run.
469            #[allow(unused_mut)]
470            let mut output = <crate::operation::get_parameters_for_import::builders::GetParametersForImportOutputBuilder>::default();
471            output.deserialize_members(&mut *deser).map_err(|e| {
472                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
473            })?;
474            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
475            let output = output.build();
476            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
477        }
478    }
479}
480#[derive(Debug)]
481struct GetParametersForImportRequestSerializer;
482impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetParametersForImportRequestSerializer {
483    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
484    fn serialize_input(
485        &self,
486        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
487        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
488    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
489        let input = input
490            .downcast::<crate::operation::get_parameters_for_import::GetParametersForImportInput>()
491            .expect("correct type");
492
493        let protocol = _cfg
494            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
495            .expect("a SharedClientProtocol is required");
496        let mut request = protocol
497            .serialize_request(&input, GetParametersForImport::INPUT_SCHEMA, "/", _cfg)
498            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
499
500        return ::std::result::Result::Ok(request);
501    }
502}
503#[derive(Debug)]
504struct GetParametersForImportEndpointParamsInterceptor;
505
506#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
507impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetParametersForImportEndpointParamsInterceptor {
508    fn name(&self) -> &'static str {
509        "GetParametersForImportEndpointParamsInterceptor"
510    }
511
512    fn read_before_execution(
513        &self,
514        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
515            '_,
516            ::aws_smithy_runtime_api::client::interceptors::context::Input,
517            ::aws_smithy_runtime_api::client::interceptors::context::Output,
518            ::aws_smithy_runtime_api::client::interceptors::context::Error,
519        >,
520        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
521    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
522        let _input = context
523            .input()
524            .downcast_ref::<GetParametersForImportInput>()
525            .ok_or("failed to downcast to GetParametersForImportInput")?;
526
527        let params = crate::config::endpoint::Params::builder()
528            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
529            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
530            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
531            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
532            .build()
533            .map_err(|err| {
534                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
535            })?;
536        cfg.interceptor_state()
537            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
538        ::std::result::Result::Ok(())
539    }
540}
541
542// The get_* functions below are generated from JMESPath expressions in the
543// operationContextParams trait. They target the operation's input shape.
544
545/// Error type for the `GetParametersForImportError` operation.
546#[non_exhaustive]
547#[derive(::std::fmt::Debug)]
548pub enum GetParametersForImportError {
549    /// <p>The system timed out while trying to fulfill the request. You can retry the request.</p>
550    DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
551    /// <p>The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.</p>
552    InvalidArnException(crate::types::error::InvalidArnException),
553    /// <p>The request was rejected because an internal exception occurred. The request can be retried.</p>
554    KmsInternalException(crate::types::error::KmsInternalException),
555    /// <p>The request was rejected because the state of the specified resource is not valid for this request.</p>
556    /// <p>This exceptions means one of the following:</p>
557    /// <ul>
558    /// <li>
559    /// <p>The key state of the KMS key is not compatible with the operation.</p>
560    /// <p>To find the key state, use the <code>DescribeKey</code> operation. For more information about which key states are compatible with each KMS operation, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of KMS keys</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p></li>
561    /// <li>
562    /// <p>For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.</p></li>
563    /// </ul>
564    KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
565    /// <p>The request was rejected because the specified entity or resource could not be found.</p>
566    NotFoundException(crate::types::error::NotFoundException),
567    /// <p>The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.</p>
568    UnsupportedOperationException(crate::types::error::UnsupportedOperationException),
569    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
570    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
571    variable wildcard pattern and check `.code()`:
572     \
573    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
574     \
575    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetParametersForImportError) for what information is available for the error.")]
576    Unhandled(crate::error::sealed_unhandled::Unhandled),
577}
578impl GetParametersForImportError {
579    /// Creates the `GetParametersForImportError::Unhandled` variant from any error type.
580    pub fn unhandled(
581        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
582    ) -> Self {
583        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
584            source: err.into(),
585            meta: ::std::default::Default::default(),
586        })
587    }
588
589    /// Creates the `GetParametersForImportError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
590    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
591        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
592            source: err.clone().into(),
593            meta: err,
594        })
595    }
596    ///
597    /// Returns error metadata, which includes the error code, message,
598    /// request ID, and potentially additional information.
599    ///
600    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
601        match self {
602            Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
603            Self::InvalidArnException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
604            Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
605            Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
606            Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
607            Self::UnsupportedOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
608            Self::Unhandled(e) => &e.meta,
609        }
610    }
611    /// Returns `true` if the error kind is `GetParametersForImportError::DependencyTimeoutException`.
612    pub fn is_dependency_timeout_exception(&self) -> bool {
613        matches!(self, Self::DependencyTimeoutException(_))
614    }
615    /// Returns `true` if the error kind is `GetParametersForImportError::InvalidArnException`.
616    pub fn is_invalid_arn_exception(&self) -> bool {
617        matches!(self, Self::InvalidArnException(_))
618    }
619    /// Returns `true` if the error kind is `GetParametersForImportError::KmsInternalException`.
620    pub fn is_kms_internal_exception(&self) -> bool {
621        matches!(self, Self::KmsInternalException(_))
622    }
623    /// Returns `true` if the error kind is `GetParametersForImportError::KmsInvalidStateException`.
624    pub fn is_kms_invalid_state_exception(&self) -> bool {
625        matches!(self, Self::KmsInvalidStateException(_))
626    }
627    /// Returns `true` if the error kind is `GetParametersForImportError::NotFoundException`.
628    pub fn is_not_found_exception(&self) -> bool {
629        matches!(self, Self::NotFoundException(_))
630    }
631    /// Returns `true` if the error kind is `GetParametersForImportError::UnsupportedOperationException`.
632    pub fn is_unsupported_operation_exception(&self) -> bool {
633        matches!(self, Self::UnsupportedOperationException(_))
634    }
635}
636impl ::std::error::Error for GetParametersForImportError {
637    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
638        match self {
639            Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
640            Self::InvalidArnException(_inner) => ::std::option::Option::Some(_inner),
641            Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
642            Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
643            Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
644            Self::UnsupportedOperationException(_inner) => ::std::option::Option::Some(_inner),
645            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
646        }
647    }
648}
649impl ::std::fmt::Display for GetParametersForImportError {
650    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
651        match self {
652            Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
653            Self::InvalidArnException(_inner) => _inner.fmt(f),
654            Self::KmsInternalException(_inner) => _inner.fmt(f),
655            Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
656            Self::NotFoundException(_inner) => _inner.fmt(f),
657            Self::UnsupportedOperationException(_inner) => _inner.fmt(f),
658            Self::Unhandled(_inner) => {
659                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
660                    write!(f, "unhandled error ({code})")
661                } else {
662                    f.write_str("unhandled error")
663                }
664            }
665        }
666    }
667}
668impl ::aws_smithy_types::retry::ProvideErrorKind for GetParametersForImportError {
669    fn code(&self) -> ::std::option::Option<&str> {
670        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
671    }
672    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
673        ::std::option::Option::None
674    }
675}
676impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetParametersForImportError {
677    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
678        match self {
679            Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
680            Self::InvalidArnException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
681            Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
682            Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
683            Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
684            Self::UnsupportedOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
685            Self::Unhandled(_inner) => &_inner.meta,
686        }
687    }
688}
689impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetParametersForImportError {
690    fn create_unhandled_error(
691        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
692        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
693    ) -> Self {
694        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
695            source,
696            meta: meta.unwrap_or_default(),
697        })
698    }
699}
700impl ::aws_types::request_id::RequestId for crate::operation::get_parameters_for_import::GetParametersForImportError {
701    fn request_id(&self) -> Option<&str> {
702        self.meta().request_id()
703    }
704}
705
706pub use crate::operation::get_parameters_for_import::_get_parameters_for_import_input::GetParametersForImportInput;
707
708pub use crate::operation::get_parameters_for_import::_get_parameters_for_import_output::GetParametersForImportOutput;
709
710mod _get_parameters_for_import_input;
711
712mod _get_parameters_for_import_output;
713
714/// Builders
715pub mod builders;