1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct StartDeviceAuthorization;
6impl StartDeviceAuthorization {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
13 crate::operation::start_device_authorization::StartDeviceAuthorizationInput::SCHEMA;
14 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 .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}
93pub(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 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 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 #[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 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 let _response_headers = headers;
431 #[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#[non_exhaustive]
512#[derive(::std::fmt::Debug)]
513pub enum StartDeviceAuthorizationError {
514 InternalServerException(crate::types::error::InternalServerException),
516 InvalidClientException(crate::types::error::InvalidClientException),
518 InvalidRequestException(crate::types::error::InvalidRequestException),
520 SlowDownException(crate::types::error::SlowDownException),
522 UnauthorizedClientException(crate::types::error::UnauthorizedClientException),
524 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
526 variable wildcard pattern and check `.code()`:
527 \
528 `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 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 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 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 pub fn is_internal_server_exception(&self) -> bool {
567 matches!(self, Self::InternalServerException(_))
568 }
569 pub fn is_invalid_client_exception(&self) -> bool {
571 matches!(self, Self::InvalidClientException(_))
572 }
573 pub fn is_invalid_request_exception(&self) -> bool {
575 matches!(self, Self::InvalidRequestException(_))
576 }
577 pub fn is_slow_down_exception(&self) -> bool {
579 matches!(self, Self::SlowDownException(_))
580 }
581 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
661pub mod builders;