Skip to main content

aws_sdk_kms/operation/
list_retirable_grants.rs

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