Skip to main content

aws_sdk_workspaces/operation/
list_account_links.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `ListAccountLinks`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct ListAccountLinks;
6impl ListAccountLinks {
7    /// Creates a new `ListAccountLinks`
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_account_links::ListAccountLinksInput::SCHEMA;
13    /// The schema for this operation's output shape.
14    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::list_account_links::ListAccountLinksOutput::SCHEMA;
15    pub(crate) async fn orchestrate(
16        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17        input: crate::operation::list_account_links::ListAccountLinksInput,
18    ) -> ::std::result::Result<
19        crate::operation::list_account_links::ListAccountLinksOutput,
20        ::aws_smithy_runtime_api::client::result::SdkError<
21            crate::operation::list_account_links::ListAccountLinksError,
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::list_account_links::ListAccountLinksError>()
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::list_account_links::ListAccountLinksOutput>()
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::list_account_links::ListAccountLinksInput,
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("WorkSpaces", "ListAccountLinks", input, runtime_plugins, stop_point)
59            // Create a parent span for the entire operation. Includes a random, internal-only,
60            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
61            .instrument(::tracing::debug_span!(
62                "WorkSpaces.ListAccountLinks",
63                "rpc.service" = "WorkSpaces",
64                "rpc.method" = "ListAccountLinks",
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}
91/// Per-operation error registry. Contains an entry for every modeled
92/// error this operation can throw.
93///
94/// Used by the schema-serde error path as the operation-scoped lookup
95/// for registry-backed error reification: an error code that does not
96/// match one of the operation's modeled errors directly is resolved
97/// against this registry first, then widened to the service-wide error
98/// registry.
99pub(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::AccessDeniedException::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::AccessDeniedException::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::AccessDeniedException::deserialize(d)?))
109                        },
110                    )
111.insert_error_shape(
112                        crate::types::error::InternalServerException::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::InternalServerException::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::InternalServerException::deserialize(d)?))
118                        },
119                    )
120.insert_error_shape(
121                        crate::types::error::ValidationException::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::ValidationException::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::ValidationException::deserialize(d)?))
127                        },
128                    )
129                            .build()
130    });
131}
132impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ListAccountLinks {
133    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
134        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListAccountLinks");
135
136        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
137            ListAccountLinksRequestSerializer,
138        ));
139        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
140            ListAccountLinksResponseDeserializer,
141        ));
142
143        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
144            crate::config::auth::Params::builder()
145                .operation_name("ListAccountLinks")
146                .build()
147                .expect("required fields set"),
148        ));
149
150        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
151            "ListAccountLinks",
152            "WorkSpaces",
153        ));
154        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
155        signing_options.double_uri_encode = true;
156        signing_options.content_sha256_header = false;
157        signing_options.normalize_uri_path = true;
158        signing_options.payload_override = None;
159
160        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
161            signing_options,
162            ..::std::default::Default::default()
163        });
164
165        ::std::option::Option::Some(cfg.freeze())
166    }
167
168    fn runtime_components(
169        &self,
170        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
171    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
172        #[allow(unused_mut)]
173        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListAccountLinks")
174            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
175                ListAccountLinksTelemetryInputCaptureInterceptor,
176            ))
177            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
178                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
179            ))
180            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
181                ListAccountLinksEndpointParamsInterceptor,
182            ))
183            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
184                crate::operation::list_account_links::ListAccountLinksError,
185            >::new())
186            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
187                crate::operation::list_account_links::ListAccountLinksError,
188            >::new())
189            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
190                crate::operation::list_account_links::ListAccountLinksError,
191            >::new())
192            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
193                crate::operation::list_account_links::ListAccountLinksError,
194            >::new());
195
196        ::std::borrow::Cow::Owned(rcb)
197    }
198}
199
200#[derive(Debug)]
201struct ListAccountLinksTelemetryInputCaptureInterceptor;
202
203#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
204impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListAccountLinksTelemetryInputCaptureInterceptor {
205    fn name(&self) -> &'static str {
206        "ListAccountLinksTelemetryInputCaptureInterceptor"
207    }
208
209    fn read_before_execution(
210        &self,
211        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
212            '_,
213            ::aws_smithy_runtime_api::client::interceptors::context::Input,
214            ::aws_smithy_runtime_api::client::interceptors::context::Output,
215            ::aws_smithy_runtime_api::client::interceptors::context::Error,
216        >,
217        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
218    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
219        // Nothing to do unless the customer opted in by naming members to record.
220        let ::std::option::Option::Some(requested) = cfg
221            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
222            .filter(|r| !r.is_empty())
223        else {
224            return ::std::result::Result::Ok(());
225        };
226
227        let ::std::option::Option::Some(input) = context.input().downcast_ref::<ListAccountLinksInput>() else {
228            // A mismatched input is not this interceptor's concern; skip quietly.
229            return ::std::result::Result::Ok(());
230        };
231
232        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
233        if requested.should_capture("NextToken") {
234            if let ::std::option::Option::Some(value) = input.next_token.as_deref() {
235                captured.insert("NextToken", value);
236            }
237        }
238
239        cfg.interceptor_state().store_put(captured);
240        ::std::result::Result::Ok(())
241    }
242}
243#[derive(Debug)]
244struct ListAccountLinksResponseDeserializer;
245impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListAccountLinksResponseDeserializer {
246    fn deserialize_nonstreaming_with_config(
247        &self,
248        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
249        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
250    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
251        let (success, status) = (response.status().is_success(), response.status().as_u16());
252        // Load body and headers BEFORE BeforeParseResponse so customizations
253        // (e.g., S3's `body_is_error` check that detects errors returned with
254        // HTTP 200) can inspect them. The legacy non-streaming path also
255        // loads `body` before firing this hook.
256        #[allow(unused_variables)]
257        let body = response.body().bytes().expect("body loaded");
258        let headers = response.headers();
259        #[allow(unused_mut)]
260        let mut force_error = false;
261        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
262        if !success && status != 200 || force_error {
263            let protocol = _cfg
264                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
265                .expect("a SharedClientProtocol is required");
266            #[allow(unused_mut)]
267            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
268                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
269            })?;
270            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
271            let generic = generic_builder.build();
272            let error_code = match generic.code() {
273                ::std::option::Option::Some(code) => code,
274                ::std::option::Option::None => {
275                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
276                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::list_account_links::ListAccountLinksError::unhandled(
277                            generic,
278                        )),
279                    ))
280                }
281            };
282            let _error_message = generic.message().map(|msg| msg.to_owned());
283            let err = match error_code {
284                "AccessDeniedException" => crate::operation::list_account_links::ListAccountLinksError::AccessDeniedException({
285                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
286                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
287                            e,
288                        ))
289                    })?;
290                    let mut tmp = <crate::types::error::builders::AccessDeniedExceptionBuilder>::default();
291                    tmp.deserialize_members(&mut *deser).map_err(|e| {
292                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
293                            e,
294                        ))
295                    })?;
296                    if tmp.message.is_none() {
297                        tmp.message = _error_message;
298                    }
299                    let tmp = tmp.meta(generic);
300                    tmp.build()
301                }),
302                "InternalServerException" => crate::operation::list_account_links::ListAccountLinksError::InternalServerException({
303                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
304                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
305                            e,
306                        ))
307                    })?;
308                    let mut tmp = <crate::types::error::builders::InternalServerExceptionBuilder>::default();
309                    tmp.deserialize_members(&mut *deser).map_err(|e| {
310                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
311                            e,
312                        ))
313                    })?;
314                    if tmp.message.is_none() {
315                        tmp.message = _error_message;
316                    }
317                    let tmp = tmp.meta(generic);
318                    tmp.build()
319                }),
320                "ValidationException" => crate::operation::list_account_links::ListAccountLinksError::ValidationException({
321                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
322                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
323                            e,
324                        ))
325                    })?;
326                    let mut tmp = <crate::types::error::builders::ValidationExceptionBuilder>::default();
327                    tmp.deserialize_members(&mut *deser).map_err(|e| {
328                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
329                            e,
330                        ))
331                    })?;
332                    if tmp.message.is_none() {
333                        tmp.message = _error_message;
334                    }
335                    let tmp = tmp.meta(generic);
336                    tmp.build()
337                }),
338                _ => {
339                    // Registry-backed, operation-scoped reification of an error whose
340                    // code this operation does not model directly: the operation's own
341                    // error registry is consulted first, then the lookup widens to the
342                    // service-wide error registry. On a hit, the reified error is attached
343                    // as the source of the returned unhandled error while its metadata
344                    // (code, message, request id) is preserved; on a miss the generic
345                    // error is returned unchanged.
346                    match protocol
347                        .deserialize_error_response(response, _cfg)
348                        .ok()
349                        .and_then(|mut deser| {
350                            ::aws_smithy_schema::registry::reify_error(
351                                crate::operation::list_account_links::error_registry::REGISTRY
352                                    .or(&crate::error_type_registry::REGISTRY),
353                                error_code,
354                                &mut *deser,
355                            )
356                        }) {
357                        ::std::option::Option::Some(source) => <crate::operation::list_account_links::ListAccountLinksError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
358                        ::std::option::Option::None => crate::operation::list_account_links::ListAccountLinksError::generic(generic),
359                    }
360                }
361            };
362            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
363                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
364            ))
365        } else {
366            let protocol = _cfg
367                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
368                .expect("a SharedClientProtocol is required");
369            let mut deser = protocol
370                .deserialize_response(response, ListAccountLinks::OUTPUT_SCHEMA, _cfg)
371                .map_err(|e| {
372                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
373                })?;
374            // `headers` is already in scope from the top of the function; alias it as
375            // `_response_headers` so MutateOutput customizations have a stable name to
376            // read from.
377            let _response_headers = headers;
378            // `mut` is required because `deserialize_members` and the `MutateOutput`
379            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
380            // empty output has no members and no customizations to run.
381            #[allow(unused_mut)]
382            let mut output = <crate::operation::list_account_links::builders::ListAccountLinksOutputBuilder>::default();
383            output.deserialize_members(&mut *deser).map_err(|e| {
384                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
385            })?;
386            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
387            let output = output.build();
388            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
389        }
390    }
391}
392#[derive(Debug)]
393struct ListAccountLinksRequestSerializer;
394impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListAccountLinksRequestSerializer {
395    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
396    fn serialize_input(
397        &self,
398        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
399        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
400    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
401        let input = input
402            .downcast::<crate::operation::list_account_links::ListAccountLinksInput>()
403            .expect("correct type");
404
405        let protocol = _cfg
406            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
407            .expect("a SharedClientProtocol is required");
408        let mut request = protocol
409            .serialize_request(
410                &input,
411                ListAccountLinks::INPUT_SCHEMA,
412                "/service/WorkspacesService/operation/ListAccountLinks",
413                _cfg,
414            )
415            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
416
417        return ::std::result::Result::Ok(request);
418    }
419}
420#[derive(Debug)]
421struct ListAccountLinksEndpointParamsInterceptor;
422
423#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
424impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListAccountLinksEndpointParamsInterceptor {
425    fn name(&self) -> &'static str {
426        "ListAccountLinksEndpointParamsInterceptor"
427    }
428
429    fn read_before_execution(
430        &self,
431        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
432            '_,
433            ::aws_smithy_runtime_api::client::interceptors::context::Input,
434            ::aws_smithy_runtime_api::client::interceptors::context::Output,
435            ::aws_smithy_runtime_api::client::interceptors::context::Error,
436        >,
437        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
438    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
439        let _input = context
440            .input()
441            .downcast_ref::<ListAccountLinksInput>()
442            .ok_or("failed to downcast to ListAccountLinksInput")?;
443
444        let params = crate::config::endpoint::Params::builder()
445            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
446            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
447            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
448            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
449            .build()
450            .map_err(|err| {
451                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
452            })?;
453        cfg.interceptor_state()
454            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
455        ::std::result::Result::Ok(())
456    }
457}
458
459// The get_* functions below are generated from JMESPath expressions in the
460// operationContextParams trait. They target the operation's input shape.
461
462/// Error type for the `ListAccountLinksError` operation.
463#[non_exhaustive]
464#[derive(::std::fmt::Debug)]
465pub enum ListAccountLinksError {
466    /// <p>The user is not authorized to access a resource.</p>
467    AccessDeniedException(crate::types::error::AccessDeniedException),
468    /// <p>Unexpected server error occured.</p>
469    InternalServerException(crate::types::error::InternalServerException),
470    /// <p>You either haven't provided a <code>TargetAccountId</code> or are using the same value for <code>TargetAccountId</code> and <code>SourceAccountId</code>.</p>
471    ValidationException(crate::types::error::ValidationException),
472    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
473    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
474    variable wildcard pattern and check `.code()`:
475     \
476    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
477     \
478    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListAccountLinksError) for what information is available for the error.")]
479    Unhandled(crate::error::sealed_unhandled::Unhandled),
480}
481impl ListAccountLinksError {
482    /// Creates the `ListAccountLinksError::Unhandled` variant from any error type.
483    pub fn unhandled(
484        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
485    ) -> Self {
486        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
487            source: err.into(),
488            meta: ::std::default::Default::default(),
489        })
490    }
491
492    /// Creates the `ListAccountLinksError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
493    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
494        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
495            source: err.clone().into(),
496            meta: err,
497        })
498    }
499    ///
500    /// Returns error metadata, which includes the error code, message,
501    /// request ID, and potentially additional information.
502    ///
503    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
504        match self {
505            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
506            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
507            Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
508            Self::Unhandled(e) => &e.meta,
509        }
510    }
511    /// Returns `true` if the error kind is `ListAccountLinksError::AccessDeniedException`.
512    pub fn is_access_denied_exception(&self) -> bool {
513        matches!(self, Self::AccessDeniedException(_))
514    }
515    /// Returns `true` if the error kind is `ListAccountLinksError::InternalServerException`.
516    pub fn is_internal_server_exception(&self) -> bool {
517        matches!(self, Self::InternalServerException(_))
518    }
519    /// Returns `true` if the error kind is `ListAccountLinksError::ValidationException`.
520    pub fn is_validation_exception(&self) -> bool {
521        matches!(self, Self::ValidationException(_))
522    }
523}
524impl ::std::error::Error for ListAccountLinksError {
525    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
526        match self {
527            Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
528            Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
529            Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
530            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
531        }
532    }
533}
534impl ::std::fmt::Display for ListAccountLinksError {
535    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
536        match self {
537            Self::AccessDeniedException(_inner) => _inner.fmt(f),
538            Self::InternalServerException(_inner) => _inner.fmt(f),
539            Self::ValidationException(_inner) => _inner.fmt(f),
540            Self::Unhandled(_inner) => {
541                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
542                    write!(f, "unhandled error ({code})")
543                } else {
544                    f.write_str("unhandled error")
545                }
546            }
547        }
548    }
549}
550impl ::aws_smithy_types::retry::ProvideErrorKind for ListAccountLinksError {
551    fn code(&self) -> ::std::option::Option<&str> {
552        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
553    }
554    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
555        ::std::option::Option::None
556    }
557}
558impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListAccountLinksError {
559    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
560        match self {
561            Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
562            Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
563            Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
564            Self::Unhandled(_inner) => &_inner.meta,
565        }
566    }
567}
568impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListAccountLinksError {
569    fn create_unhandled_error(
570        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
571        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
572    ) -> Self {
573        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
574            source,
575            meta: meta.unwrap_or_default(),
576        })
577    }
578}
579impl ::aws_types::request_id::RequestId for crate::operation::list_account_links::ListAccountLinksError {
580    fn request_id(&self) -> Option<&str> {
581        self.meta().request_id()
582    }
583}
584
585pub use crate::operation::list_account_links::_list_account_links_input::ListAccountLinksInput;
586
587pub use crate::operation::list_account_links::_list_account_links_output::ListAccountLinksOutput;
588
589mod _list_account_links_input;
590
591mod _list_account_links_output;
592
593/// Builders
594pub mod builders;
595
596/// Paginator for this operation
597pub mod paginator;