Skip to main content

aws_sdk_ssooidc/operation/
start_device_authorization.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `StartDeviceAuthorization`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct StartDeviceAuthorization;
6impl StartDeviceAuthorization {
7    /// Creates a new `StartDeviceAuthorization`
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::start_device_authorization::StartDeviceAuthorizationInput::SCHEMA;
14    /// The schema for this operation's output shape.
15    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
16        crate::operation::start_device_authorization::StartDeviceAuthorizationOutput::SCHEMA;
17    pub(crate) async fn orchestrate(
18        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
19        input: crate::operation::start_device_authorization::StartDeviceAuthorizationInput,
20    ) -> ::std::result::Result<
21        crate::operation::start_device_authorization::StartDeviceAuthorizationOutput,
22        ::aws_smithy_runtime_api::client::result::SdkError<
23            crate::operation::start_device_authorization::StartDeviceAuthorizationError,
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::start_device_authorization::StartDeviceAuthorizationError>()
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::start_device_authorization::StartDeviceAuthorizationOutput>()
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::start_device_authorization::StartDeviceAuthorizationInput,
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("SSO OIDC", "StartDeviceAuthorization", 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                "SSO OIDC.StartDeviceAuthorization",
65                "rpc.service" = "SSO OIDC",
66                "rpc.method" = "StartDeviceAuthorization",
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::InternalServerException::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::InternalServerException::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::InternalServerException::deserialize(d)?))
111                        },
112                    )
113.insert_error_shape(
114                        crate::types::error::InvalidClientException::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::InvalidClientException::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::InvalidClientException::deserialize(d)?))
120                        },
121                    )
122.insert_error_shape(
123                        crate::types::error::InvalidRequestException::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::InvalidRequestException::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::InvalidRequestException::deserialize(d)?))
129                        },
130                    )
131.insert_error_shape(
132                        crate::types::error::SlowDownException::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::SlowDownException::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::SlowDownException::deserialize(d)?))
138                        },
139                    )
140.insert_error_shape(
141                        crate::types::error::UnauthorizedClientException::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::UnauthorizedClientException::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::UnauthorizedClientException::deserialize(d)?))
147                        },
148                    )
149                            .build()
150    });
151}
152impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for StartDeviceAuthorization {
153    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
154        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("StartDeviceAuthorization");
155
156        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
157            StartDeviceAuthorizationRequestSerializer,
158        ));
159        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
160            StartDeviceAuthorizationResponseDeserializer,
161        ));
162
163        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
164            crate::config::auth::Params::builder()
165                .operation_name("StartDeviceAuthorization")
166                .build()
167                .expect("required fields set"),
168        ));
169
170        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
171            "StartDeviceAuthorization",
172            "SSO OIDC",
173        ));
174
175        ::std::option::Option::Some(cfg.freeze())
176    }
177
178    fn runtime_components(
179        &self,
180        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
181    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
182        #[allow(unused_mut)]
183        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("StartDeviceAuthorization")
184            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
185                StartDeviceAuthorizationTelemetryInputCaptureInterceptor,
186            ))
187            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
188                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
189            ))
190            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
191                StartDeviceAuthorizationEndpointParamsInterceptor,
192            ))
193            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
194                crate::operation::start_device_authorization::StartDeviceAuthorizationError,
195            >::new())
196            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
197                crate::operation::start_device_authorization::StartDeviceAuthorizationError,
198            >::new())
199            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
200                crate::operation::start_device_authorization::StartDeviceAuthorizationError,
201            >::new())
202            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
203                crate::operation::start_device_authorization::StartDeviceAuthorizationError,
204            >::new());
205
206        ::std::borrow::Cow::Owned(rcb)
207    }
208}
209
210#[derive(Debug)]
211struct StartDeviceAuthorizationTelemetryInputCaptureInterceptor;
212
213#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
214impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StartDeviceAuthorizationTelemetryInputCaptureInterceptor {
215    fn name(&self) -> &'static str {
216        "StartDeviceAuthorizationTelemetryInputCaptureInterceptor"
217    }
218
219    fn read_before_execution(
220        &self,
221        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
222            '_,
223            ::aws_smithy_runtime_api::client::interceptors::context::Input,
224            ::aws_smithy_runtime_api::client::interceptors::context::Output,
225            ::aws_smithy_runtime_api::client::interceptors::context::Error,
226        >,
227        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
228    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
229        // Nothing to do unless the customer opted in by naming members to record.
230        let ::std::option::Option::Some(requested) = cfg
231            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
232            .filter(|r| !r.is_empty())
233        else {
234            return ::std::result::Result::Ok(());
235        };
236
237        let ::std::option::Option::Some(input) = context.input().downcast_ref::<StartDeviceAuthorizationInput>() else {
238            // A mismatched input is not this interceptor's concern; skip quietly.
239            return ::std::result::Result::Ok(());
240        };
241
242        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
243        if requested.should_capture("clientId") {
244            if let ::std::option::Option::Some(value) = input.client_id.as_deref() {
245                captured.insert("clientId", value);
246            }
247        }
248        if requested.should_capture("startUrl") {
249            if let ::std::option::Option::Some(value) = input.start_url.as_deref() {
250                captured.insert("startUrl", value);
251            }
252        }
253
254        cfg.interceptor_state().store_put(captured);
255        ::std::result::Result::Ok(())
256    }
257}
258#[derive(Debug)]
259struct StartDeviceAuthorizationResponseDeserializer;
260impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StartDeviceAuthorizationResponseDeserializer {
261    fn deserialize_nonstreaming_with_config(
262        &self,
263        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
264        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
265    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
266        let (success, status) = (response.status().is_success(), response.status().as_u16());
267        // Load body and headers BEFORE BeforeParseResponse so customizations
268        // (e.g., S3's `body_is_error` check that detects errors returned with
269        // HTTP 200) can inspect them. The legacy non-streaming path also
270        // loads `body` before firing this hook.
271        #[allow(unused_variables)]
272        let body = response.body().bytes().expect("body loaded");
273        let headers = response.headers();
274        #[allow(unused_mut)]
275        let mut force_error = false;
276        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
277        if !success && status != 200 || force_error {
278            let protocol = _cfg
279                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
280                .expect("a SharedClientProtocol is required");
281            #[allow(unused_mut)]
282            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
283                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
284            })?;
285            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
286            let generic = generic_builder.build();
287            let error_code = match generic.code() {
288                ::std::option::Option::Some(code) => code,
289                ::std::option::Option::None => {
290                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
291                        ::aws_smithy_runtime_api::box_error::BoxError::from(
292                            crate::operation::start_device_authorization::StartDeviceAuthorizationError::unhandled(generic),
293                        ),
294                    ))
295                }
296            };
297            let _error_message = generic.message().map(|msg| msg.to_owned());
298            let err = match error_code {
299                "InternalServerException" => crate::operation::start_device_authorization::StartDeviceAuthorizationError::InternalServerException({
300                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
301                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
302                            e,
303                        ))
304                    })?;
305                    let mut tmp = <crate::types::error::builders::InternalServerExceptionBuilder>::default();
306                    tmp.deserialize_members(&mut *deser).map_err(|e| {
307                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
308                            e,
309                        ))
310                    })?;
311                    if tmp.message.is_none() {
312                        tmp.message = _error_message;
313                    }
314                    let tmp = tmp.meta(generic);
315                    tmp.build()
316                }),
317                "InvalidClientException" => crate::operation::start_device_authorization::StartDeviceAuthorizationError::InvalidClientException({
318                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
319                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
320                            e,
321                        ))
322                    })?;
323                    let mut tmp = <crate::types::error::builders::InvalidClientExceptionBuilder>::default();
324                    tmp.deserialize_members(&mut *deser).map_err(|e| {
325                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
326                            e,
327                        ))
328                    })?;
329                    if tmp.message.is_none() {
330                        tmp.message = _error_message;
331                    }
332                    let tmp = tmp.meta(generic);
333                    tmp.build()
334                }),
335                "InvalidRequestException" => crate::operation::start_device_authorization::StartDeviceAuthorizationError::InvalidRequestException({
336                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
337                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
338                            e,
339                        ))
340                    })?;
341                    let mut tmp = <crate::types::error::builders::InvalidRequestExceptionBuilder>::default();
342                    tmp.deserialize_members(&mut *deser).map_err(|e| {
343                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
344                            e,
345                        ))
346                    })?;
347                    if tmp.message.is_none() {
348                        tmp.message = _error_message;
349                    }
350                    let tmp = tmp.meta(generic);
351                    tmp.build()
352                }),
353                "SlowDownException" => crate::operation::start_device_authorization::StartDeviceAuthorizationError::SlowDownException({
354                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
355                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
356                            e,
357                        ))
358                    })?;
359                    let mut tmp = <crate::types::error::builders::SlowDownExceptionBuilder>::default();
360                    tmp.deserialize_members(&mut *deser).map_err(|e| {
361                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
362                            e,
363                        ))
364                    })?;
365                    if tmp.message.is_none() {
366                        tmp.message = _error_message;
367                    }
368                    let tmp = tmp.meta(generic);
369                    tmp.build()
370                }),
371                "UnauthorizedClientException" => {
372                    crate::operation::start_device_authorization::StartDeviceAuthorizationError::UnauthorizedClientException({
373                        let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
374                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
375                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
376                            )
377                        })?;
378                        let mut tmp = <crate::types::error::builders::UnauthorizedClientExceptionBuilder>::default();
379                        tmp.deserialize_members(&mut *deser).map_err(|e| {
380                            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
381                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
382                            )
383                        })?;
384                        if tmp.message.is_none() {
385                            tmp.message = _error_message;
386                        }
387                        let tmp = tmp.meta(generic);
388                        tmp.build()
389                    })
390                }
391                _ => {
392                    // Registry-backed, operation-scoped reification of an error whose
393                    // code this operation does not model directly: the operation's own
394                    // error registry is consulted first, then the lookup widens to the
395                    // service-wide error registry. On a hit, the reified error is attached
396                    // as the source of the returned unhandled error while its metadata
397                    // (code, message, request id) is preserved; on a miss the generic
398                    // error is returned unchanged.
399                    match protocol
400                        .deserialize_error_response(response, _cfg)
401                        .ok()
402                        .and_then(|mut deser| {
403                            ::aws_smithy_schema::registry::reify_error(
404                                crate::operation::start_device_authorization::error_registry::REGISTRY
405                                    .or(&crate::error_type_registry::REGISTRY),
406                                error_code,
407                                &mut *deser,
408                            )
409                        }) {
410                        ::std::option::Option::Some(source) => <crate::operation::start_device_authorization::StartDeviceAuthorizationError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
411                        ::std::option::Option::None => crate::operation::start_device_authorization::StartDeviceAuthorizationError::generic(generic),
412                    }
413                }
414            };
415            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
416                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
417            ))
418        } else {
419            let protocol = _cfg
420                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
421                .expect("a SharedClientProtocol is required");
422            let mut deser = protocol
423                .deserialize_response(response, StartDeviceAuthorization::OUTPUT_SCHEMA, _cfg)
424                .map_err(|e| {
425                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
426                })?;
427            // `headers` is already in scope from the top of the function; alias it as
428            // `_response_headers` so MutateOutput customizations have a stable name to
429            // read from.
430            let _response_headers = headers;
431            // `mut` is required because `deserialize_members` and the `MutateOutput`
432            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
433            // empty output has no members and no customizations to run.
434            #[allow(unused_mut)]
435            let mut output = <crate::operation::start_device_authorization::builders::StartDeviceAuthorizationOutputBuilder>::default();
436            output.deserialize_members(&mut *deser).map_err(|e| {
437                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
438            })?;
439            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
440            let output = output.build();
441            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
442        }
443    }
444}
445#[derive(Debug)]
446struct StartDeviceAuthorizationRequestSerializer;
447impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StartDeviceAuthorizationRequestSerializer {
448    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
449    fn serialize_input(
450        &self,
451        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
452        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
453    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
454        let input = input
455            .downcast::<crate::operation::start_device_authorization::StartDeviceAuthorizationInput>()
456            .expect("correct type");
457
458        let protocol = _cfg
459            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
460            .expect("a SharedClientProtocol is required");
461        let mut request = protocol
462            .serialize_request(&input, StartDeviceAuthorization::INPUT_SCHEMA, "", _cfg)
463            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
464
465        return ::std::result::Result::Ok(request);
466    }
467}
468#[derive(Debug)]
469struct StartDeviceAuthorizationEndpointParamsInterceptor;
470
471#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
472impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StartDeviceAuthorizationEndpointParamsInterceptor {
473    fn name(&self) -> &'static str {
474        "StartDeviceAuthorizationEndpointParamsInterceptor"
475    }
476
477    fn read_before_execution(
478        &self,
479        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
480            '_,
481            ::aws_smithy_runtime_api::client::interceptors::context::Input,
482            ::aws_smithy_runtime_api::client::interceptors::context::Output,
483            ::aws_smithy_runtime_api::client::interceptors::context::Error,
484        >,
485        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
486    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
487        let _input = context
488            .input()
489            .downcast_ref::<StartDeviceAuthorizationInput>()
490            .ok_or("failed to downcast to StartDeviceAuthorizationInput")?;
491
492        let params = crate::config::endpoint::Params::builder()
493            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
494            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
495            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
496            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
497            .build()
498            .map_err(|err| {
499                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
500            })?;
501        cfg.interceptor_state()
502            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
503        ::std::result::Result::Ok(())
504    }
505}
506
507// The get_* functions below are generated from JMESPath expressions in the
508// operationContextParams trait. They target the operation's input shape.
509
510/// Error type for the `StartDeviceAuthorizationError` operation.
511#[non_exhaustive]
512#[derive(::std::fmt::Debug)]
513pub enum StartDeviceAuthorizationError {
514    /// <p>Indicates that an error from the service occurred while trying to process a request.</p>
515    InternalServerException(crate::types::error::InternalServerException),
516    /// <p>Indicates that the <code>clientId</code> or <code>clientSecret</code> in the request is invalid. For example, this can occur when a client sends an incorrect <code>clientId</code> or an expired <code>clientSecret</code>.</p>
517    InvalidClientException(crate::types::error::InvalidClientException),
518    /// <p>Indicates that something is wrong with the input to the request. For example, a required parameter might be missing or out of range.</p>
519    InvalidRequestException(crate::types::error::InvalidRequestException),
520    /// <p>Indicates that the client is making the request too frequently and is more than the service can handle.</p>
521    SlowDownException(crate::types::error::SlowDownException),
522    /// <p>Indicates that the client is not currently authorized to make the request. This can happen when a <code>clientId</code> is not issued for a public client.</p>
523    UnauthorizedClientException(crate::types::error::UnauthorizedClientException),
524    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
525    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
526    variable wildcard pattern and check `.code()`:
527     \
528    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
529     \
530    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-StartDeviceAuthorizationError) for what information is available for the error.")]
531    Unhandled(crate::error::sealed_unhandled::Unhandled),
532}
533impl StartDeviceAuthorizationError {
534    /// Creates the `StartDeviceAuthorizationError::Unhandled` variant from any error type.
535    pub fn unhandled(
536        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
537    ) -> Self {
538        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
539            source: err.into(),
540            meta: ::std::default::Default::default(),
541        })
542    }
543
544    /// Creates the `StartDeviceAuthorizationError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
545    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
546        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
547            source: err.clone().into(),
548            meta: err,
549        })
550    }
551    ///
552    /// Returns error metadata, which includes the error code, message,
553    /// request ID, and potentially additional information.
554    ///
555    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
556        match self {
557            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
558            Self::InvalidClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
559            Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
560            Self::SlowDownException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
561            Self::UnauthorizedClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
562            Self::Unhandled(e) => &e.meta,
563        }
564    }
565    /// Returns `true` if the error kind is `StartDeviceAuthorizationError::InternalServerException`.
566    pub fn is_internal_server_exception(&self) -> bool {
567        matches!(self, Self::InternalServerException(_))
568    }
569    /// Returns `true` if the error kind is `StartDeviceAuthorizationError::InvalidClientException`.
570    pub fn is_invalid_client_exception(&self) -> bool {
571        matches!(self, Self::InvalidClientException(_))
572    }
573    /// Returns `true` if the error kind is `StartDeviceAuthorizationError::InvalidRequestException`.
574    pub fn is_invalid_request_exception(&self) -> bool {
575        matches!(self, Self::InvalidRequestException(_))
576    }
577    /// Returns `true` if the error kind is `StartDeviceAuthorizationError::SlowDownException`.
578    pub fn is_slow_down_exception(&self) -> bool {
579        matches!(self, Self::SlowDownException(_))
580    }
581    /// Returns `true` if the error kind is `StartDeviceAuthorizationError::UnauthorizedClientException`.
582    pub fn is_unauthorized_client_exception(&self) -> bool {
583        matches!(self, Self::UnauthorizedClientException(_))
584    }
585}
586impl ::std::error::Error for StartDeviceAuthorizationError {
587    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
588        match self {
589            Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
590            Self::InvalidClientException(_inner) => ::std::option::Option::Some(_inner),
591            Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
592            Self::SlowDownException(_inner) => ::std::option::Option::Some(_inner),
593            Self::UnauthorizedClientException(_inner) => ::std::option::Option::Some(_inner),
594            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
595        }
596    }
597}
598impl ::std::fmt::Display for StartDeviceAuthorizationError {
599    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
600        match self {
601            Self::InternalServerException(_inner) => _inner.fmt(f),
602            Self::InvalidClientException(_inner) => _inner.fmt(f),
603            Self::InvalidRequestException(_inner) => _inner.fmt(f),
604            Self::SlowDownException(_inner) => _inner.fmt(f),
605            Self::UnauthorizedClientException(_inner) => _inner.fmt(f),
606            Self::Unhandled(_inner) => {
607                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
608                    write!(f, "unhandled error ({code})")
609                } else {
610                    f.write_str("unhandled error")
611                }
612            }
613        }
614    }
615}
616impl ::aws_smithy_types::retry::ProvideErrorKind for StartDeviceAuthorizationError {
617    fn code(&self) -> ::std::option::Option<&str> {
618        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
619    }
620    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
621        ::std::option::Option::None
622    }
623}
624impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for StartDeviceAuthorizationError {
625    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
626        match self {
627            Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
628            Self::InvalidClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
629            Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
630            Self::SlowDownException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
631            Self::UnauthorizedClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
632            Self::Unhandled(_inner) => &_inner.meta,
633        }
634    }
635}
636impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for StartDeviceAuthorizationError {
637    fn create_unhandled_error(
638        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
639        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
640    ) -> Self {
641        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
642            source,
643            meta: meta.unwrap_or_default(),
644        })
645    }
646}
647impl ::aws_types::request_id::RequestId for crate::operation::start_device_authorization::StartDeviceAuthorizationError {
648    fn request_id(&self) -> Option<&str> {
649        self.meta().request_id()
650    }
651}
652
653pub use crate::operation::start_device_authorization::_start_device_authorization_input::StartDeviceAuthorizationInput;
654
655pub use crate::operation::start_device_authorization::_start_device_authorization_output::StartDeviceAuthorizationOutput;
656
657mod _start_device_authorization_input;
658
659mod _start_device_authorization_output;
660
661/// Builders
662pub mod builders;