Skip to main content

aws_sdk_ssooidc/operation/
create_token_with_iam.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `CreateTokenWithIAM`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateTokenWithIAM;
6impl CreateTokenWithIAM {
7    /// Creates a new `CreateTokenWithIAM`
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::create_token_with_iam::CreateTokenWithIamInput::SCHEMA;
13    /// The schema for this operation's output shape.
14    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
15        crate::operation::create_token_with_iam::CreateTokenWithIamOutput::SCHEMA;
16    pub(crate) async fn orchestrate(
17        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
18        input: crate::operation::create_token_with_iam::CreateTokenWithIamInput,
19    ) -> ::std::result::Result<
20        crate::operation::create_token_with_iam::CreateTokenWithIamOutput,
21        ::aws_smithy_runtime_api::client::result::SdkError<
22            crate::operation::create_token_with_iam::CreateTokenWithIAMError,
23            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24        >,
25    > {
26        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
27            ::aws_smithy_runtime_api::client::interceptors::context::Error,
28            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
29        >| {
30            err.map_service_error(|err| {
31                err.downcast::<crate::operation::create_token_with_iam::CreateTokenWithIAMError>()
32                    .expect("correct error type")
33            })
34        };
35        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
36            .await
37            .map_err(map_err)?;
38        let output = context.finalize().map_err(map_err)?;
39        ::std::result::Result::Ok(
40            output
41                .downcast::<crate::operation::create_token_with_iam::CreateTokenWithIamOutput>()
42                .expect("correct output type"),
43        )
44    }
45
46    pub(crate) async fn orchestrate_with_stop_point(
47        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
48        input: crate::operation::create_token_with_iam::CreateTokenWithIamInput,
49        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
50    ) -> ::std::result::Result<
51        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
52        ::aws_smithy_runtime_api::client::result::SdkError<
53            ::aws_smithy_runtime_api::client::interceptors::context::Error,
54            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
55        >,
56    > {
57        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
58        use ::tracing::Instrument;
59        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("SSO OIDC", "CreateTokenWithIAM", input, runtime_plugins, stop_point)
60            // Create a parent span for the entire operation. Includes a random, internal-only,
61            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
62            .instrument(::tracing::debug_span!(
63                "SSO OIDC.CreateTokenWithIAM",
64                "rpc.service" = "SSO OIDC",
65                "rpc.method" = "CreateTokenWithIAM",
66                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
67                "rpc.system" = "aws-api",
68            ))
69            .await
70    }
71
72    pub(crate) fn operation_runtime_plugins(
73        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
74        client_config: &crate::config::Config,
75        config_override: ::std::option::Option<crate::config::Builder>,
76    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
77        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
78
79        if let ::std::option::Option::Some(config_override) = config_override {
80            for plugin in config_override.runtime_plugins.iter().cloned() {
81                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
82            }
83            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
84                config_override,
85                client_config.config.clone(),
86                &client_config.runtime_components,
87            ));
88        }
89        runtime_plugins
90    }
91}
92/// Per-operation error registry. Contains an entry for every modeled
93/// error this operation can throw.
94///
95/// Used by the schema-serde error path as the operation-scoped lookup
96/// for registry-backed error reification: an error code that does not
97/// match one of the operation's modeled errors directly is resolved
98/// against this registry first, then widened to the service-wide error
99/// registry.
100pub(crate) mod error_registry {
101    pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
102        ::aws_smithy_schema::registry::TypeRegistry::builder()
103                            .insert_error_shape(
104                        crate::types::error::AccessDeniedException::SCHEMA,
105                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
106                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::AccessDeniedException::deserialize(d)?))
107                        },
108                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
109                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::AccessDeniedException::deserialize(d)?))
110                        },
111                    )
112.insert_error_shape(
113                        crate::types::error::AuthorizationPendingException::SCHEMA,
114                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
115                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::AuthorizationPendingException::deserialize(d)?))
116                        },
117                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
118                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::AuthorizationPendingException::deserialize(d)?))
119                        },
120                    )
121.insert_error_shape(
122                        crate::types::error::ExpiredTokenException::SCHEMA,
123                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
124                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ExpiredTokenException::deserialize(d)?))
125                        },
126                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
127                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ExpiredTokenException::deserialize(d)?))
128                        },
129                    )
130.insert_error_shape(
131                        crate::types::error::InternalServerException::SCHEMA,
132                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
133                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InternalServerException::deserialize(d)?))
134                        },
135                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
136                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InternalServerException::deserialize(d)?))
137                        },
138                    )
139.insert_error_shape(
140                        crate::types::error::InvalidClientException::SCHEMA,
141                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
142                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidClientException::deserialize(d)?))
143                        },
144                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
145                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidClientException::deserialize(d)?))
146                        },
147                    )
148.insert_error_shape(
149                        crate::types::error::InvalidGrantException::SCHEMA,
150                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
151                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidGrantException::deserialize(d)?))
152                        },
153                        |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> {
154                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidGrantException::deserialize(d)?))
155                        },
156                    )
157.insert_error_shape(
158                        crate::types::error::InvalidRequestException::SCHEMA,
159                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
160                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidRequestException::deserialize(d)?))
161                        },
162                        |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> {
163                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidRequestException::deserialize(d)?))
164                        },
165                    )
166.insert_error_shape(
167                        crate::types::error::InvalidRequestRegionException::SCHEMA,
168                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
169                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidRequestRegionException::deserialize(d)?))
170                        },
171                        |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> {
172                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidRequestRegionException::deserialize(d)?))
173                        },
174                    )
175.insert_error_shape(
176                        crate::types::error::InvalidScopeException::SCHEMA,
177                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
178                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidScopeException::deserialize(d)?))
179                        },
180                        |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> {
181                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidScopeException::deserialize(d)?))
182                        },
183                    )
184.insert_error_shape(
185                        crate::types::error::SlowDownException::SCHEMA,
186                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
187                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::SlowDownException::deserialize(d)?))
188                        },
189                        |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> {
190                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::SlowDownException::deserialize(d)?))
191                        },
192                    )
193.insert_error_shape(
194                        crate::types::error::UnauthorizedClientException::SCHEMA,
195                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
196                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::UnauthorizedClientException::deserialize(d)?))
197                        },
198                        |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> {
199                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::UnauthorizedClientException::deserialize(d)?))
200                        },
201                    )
202.insert_error_shape(
203                        crate::types::error::UnsupportedGrantTypeException::SCHEMA,
204                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
205                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::UnsupportedGrantTypeException::deserialize(d)?))
206                        },
207                        |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> {
208                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::UnsupportedGrantTypeException::deserialize(d)?))
209                        },
210                    )
211                            .build()
212    });
213}
214impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateTokenWithIAM {
215    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
216        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateTokenWithIAM");
217
218        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
219            CreateTokenWithIAMRequestSerializer,
220        ));
221        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
222            CreateTokenWithIAMResponseDeserializer,
223        ));
224
225        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
226            crate::config::auth::Params::builder()
227                .operation_name("CreateTokenWithIAM")
228                .build()
229                .expect("required fields set"),
230        ));
231
232        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
233        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
234            "CreateTokenWithIAM",
235            "SSO OIDC",
236        ));
237        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
238        signing_options.double_uri_encode = true;
239        signing_options.content_sha256_header = false;
240        signing_options.normalize_uri_path = true;
241        signing_options.payload_override = None;
242
243        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
244            signing_options,
245            ..::std::default::Default::default()
246        });
247
248        ::std::option::Option::Some(cfg.freeze())
249    }
250
251    fn runtime_components(
252        &self,
253        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
254    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
255        #[allow(unused_mut)]
256        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateTokenWithIAM")
257            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
258                CreateTokenWithIAMTelemetryInputCaptureInterceptor,
259            ))
260            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
261                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
262            ))
263            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
264                CreateTokenWithIAMEndpointParamsInterceptor,
265            ))
266            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
267                crate::operation::create_token_with_iam::CreateTokenWithIAMError,
268            >::new())
269            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
270                crate::operation::create_token_with_iam::CreateTokenWithIAMError,
271            >::new())
272            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
273                crate::operation::create_token_with_iam::CreateTokenWithIAMError,
274            >::new())
275            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
276                crate::operation::create_token_with_iam::CreateTokenWithIAMError,
277            >::new());
278
279        ::std::borrow::Cow::Owned(rcb)
280    }
281}
282
283#[derive(Debug)]
284struct CreateTokenWithIAMTelemetryInputCaptureInterceptor;
285
286#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
287impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateTokenWithIAMTelemetryInputCaptureInterceptor {
288    fn name(&self) -> &'static str {
289        "CreateTokenWithIAMTelemetryInputCaptureInterceptor"
290    }
291
292    fn read_before_execution(
293        &self,
294        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
295            '_,
296            ::aws_smithy_runtime_api::client::interceptors::context::Input,
297            ::aws_smithy_runtime_api::client::interceptors::context::Output,
298            ::aws_smithy_runtime_api::client::interceptors::context::Error,
299        >,
300        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
301    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
302        // Nothing to do unless the customer opted in by naming members to record.
303        let ::std::option::Option::Some(requested) = cfg
304            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
305            .filter(|r| !r.is_empty())
306        else {
307            return ::std::result::Result::Ok(());
308        };
309
310        let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateTokenWithIamInput>() else {
311            // A mismatched input is not this interceptor's concern; skip quietly.
312            return ::std::result::Result::Ok(());
313        };
314
315        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
316        if requested.should_capture("clientId") {
317            if let ::std::option::Option::Some(value) = input.client_id.as_deref() {
318                captured.insert("clientId", value);
319            }
320        }
321        if requested.should_capture("grantType") {
322            if let ::std::option::Option::Some(value) = input.grant_type.as_deref() {
323                captured.insert("grantType", value);
324            }
325        }
326        if requested.should_capture("code") {
327            if let ::std::option::Option::Some(value) = input.code.as_deref() {
328                captured.insert("code", value);
329            }
330        }
331        if requested.should_capture("redirectUri") {
332            if let ::std::option::Option::Some(value) = input.redirect_uri.as_deref() {
333                captured.insert("redirectUri", value);
334            }
335        }
336        if requested.should_capture("subjectTokenType") {
337            if let ::std::option::Option::Some(value) = input.subject_token_type.as_deref() {
338                captured.insert("subjectTokenType", value);
339            }
340        }
341        if requested.should_capture("requestedTokenType") {
342            if let ::std::option::Option::Some(value) = input.requested_token_type.as_deref() {
343                captured.insert("requestedTokenType", value);
344            }
345        }
346
347        cfg.interceptor_state().store_put(captured);
348        ::std::result::Result::Ok(())
349    }
350}
351#[derive(Debug)]
352struct CreateTokenWithIAMResponseDeserializer;
353impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateTokenWithIAMResponseDeserializer {
354    fn deserialize_nonstreaming_with_config(
355        &self,
356        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
357        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
358    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
359        let (success, status) = (response.status().is_success(), response.status().as_u16());
360        // Load body and headers BEFORE BeforeParseResponse so customizations
361        // (e.g., S3's `body_is_error` check that detects errors returned with
362        // HTTP 200) can inspect them. The legacy non-streaming path also
363        // loads `body` before firing this hook.
364        #[allow(unused_variables)]
365        let body = response.body().bytes().expect("body loaded");
366        let headers = response.headers();
367        #[allow(unused_mut)]
368        let mut force_error = false;
369        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
370        if !success && status != 200 || force_error {
371            let protocol = _cfg
372                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
373                .expect("a SharedClientProtocol is required");
374            #[allow(unused_mut)]
375            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
376                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
377            })?;
378            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
379            let generic = generic_builder.build();
380            let error_code = match generic.code() {
381                ::std::option::Option::Some(code) => code,
382                ::std::option::Option::None => {
383                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
384                        ::aws_smithy_runtime_api::box_error::BoxError::from(
385                            crate::operation::create_token_with_iam::CreateTokenWithIAMError::unhandled(generic),
386                        ),
387                    ))
388                }
389            };
390            let _error_message = generic.message().map(|msg| msg.to_owned());
391            let err = match error_code {
392                "AccessDeniedException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::AccessDeniedException({
393                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
394                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
395                            e,
396                        ))
397                    })?;
398                    let mut tmp = <crate::types::error::builders::AccessDeniedExceptionBuilder>::default();
399                    tmp.deserialize_members(&mut *deser).map_err(|e| {
400                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
401                            e,
402                        ))
403                    })?;
404                    if tmp.message.is_none() {
405                        tmp.message = _error_message;
406                    }
407                    let tmp = tmp.meta(generic);
408                    tmp.build()
409                }),
410                "AuthorizationPendingException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::AuthorizationPendingException({
411                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
412                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
413                            e,
414                        ))
415                    })?;
416                    let mut tmp = <crate::types::error::builders::AuthorizationPendingExceptionBuilder>::default();
417                    tmp.deserialize_members(&mut *deser).map_err(|e| {
418                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
419                            e,
420                        ))
421                    })?;
422                    if tmp.message.is_none() {
423                        tmp.message = _error_message;
424                    }
425                    let tmp = tmp.meta(generic);
426                    tmp.build()
427                }),
428                "ExpiredTokenException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::ExpiredTokenException({
429                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
430                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
431                            e,
432                        ))
433                    })?;
434                    let mut tmp = <crate::types::error::builders::ExpiredTokenExceptionBuilder>::default();
435                    tmp.deserialize_members(&mut *deser).map_err(|e| {
436                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
437                            e,
438                        ))
439                    })?;
440                    if tmp.message.is_none() {
441                        tmp.message = _error_message;
442                    }
443                    let tmp = tmp.meta(generic);
444                    tmp.build()
445                }),
446                "InternalServerException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InternalServerException({
447                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
448                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
449                            e,
450                        ))
451                    })?;
452                    let mut tmp = <crate::types::error::builders::InternalServerExceptionBuilder>::default();
453                    tmp.deserialize_members(&mut *deser).map_err(|e| {
454                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
455                            e,
456                        ))
457                    })?;
458                    if tmp.message.is_none() {
459                        tmp.message = _error_message;
460                    }
461                    let tmp = tmp.meta(generic);
462                    tmp.build()
463                }),
464                "InvalidClientException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidClientException({
465                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
466                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
467                            e,
468                        ))
469                    })?;
470                    let mut tmp = <crate::types::error::builders::InvalidClientExceptionBuilder>::default();
471                    tmp.deserialize_members(&mut *deser).map_err(|e| {
472                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
473                            e,
474                        ))
475                    })?;
476                    if tmp.message.is_none() {
477                        tmp.message = _error_message;
478                    }
479                    let tmp = tmp.meta(generic);
480                    tmp.build()
481                }),
482                "InvalidGrantException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidGrantException({
483                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
484                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
485                            e,
486                        ))
487                    })?;
488                    let mut tmp = <crate::types::error::builders::InvalidGrantExceptionBuilder>::default();
489                    tmp.deserialize_members(&mut *deser).map_err(|e| {
490                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
491                            e,
492                        ))
493                    })?;
494                    if tmp.message.is_none() {
495                        tmp.message = _error_message;
496                    }
497                    let tmp = tmp.meta(generic);
498                    tmp.build()
499                }),
500                "InvalidRequestException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidRequestException({
501                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
502                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
503                            e,
504                        ))
505                    })?;
506                    let mut tmp = <crate::types::error::builders::InvalidRequestExceptionBuilder>::default();
507                    tmp.deserialize_members(&mut *deser).map_err(|e| {
508                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
509                            e,
510                        ))
511                    })?;
512                    if tmp.message.is_none() {
513                        tmp.message = _error_message;
514                    }
515                    let tmp = tmp.meta(generic);
516                    tmp.build()
517                }),
518                "InvalidRequestRegionException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidRequestRegionException({
519                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
520                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
521                            e,
522                        ))
523                    })?;
524                    let mut tmp = <crate::types::error::builders::InvalidRequestRegionExceptionBuilder>::default();
525                    tmp.deserialize_members(&mut *deser).map_err(|e| {
526                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
527                            e,
528                        ))
529                    })?;
530                    if tmp.message.is_none() {
531                        tmp.message = _error_message;
532                    }
533                    let tmp = tmp.meta(generic);
534                    tmp.build()
535                }),
536                "InvalidScopeException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidScopeException({
537                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
538                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
539                            e,
540                        ))
541                    })?;
542                    let mut tmp = <crate::types::error::builders::InvalidScopeExceptionBuilder>::default();
543                    tmp.deserialize_members(&mut *deser).map_err(|e| {
544                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
545                            e,
546                        ))
547                    })?;
548                    if tmp.message.is_none() {
549                        tmp.message = _error_message;
550                    }
551                    let tmp = tmp.meta(generic);
552                    tmp.build()
553                }),
554                "SlowDownException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::SlowDownException({
555                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
556                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
557                            e,
558                        ))
559                    })?;
560                    let mut tmp = <crate::types::error::builders::SlowDownExceptionBuilder>::default();
561                    tmp.deserialize_members(&mut *deser).map_err(|e| {
562                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
563                            e,
564                        ))
565                    })?;
566                    if tmp.message.is_none() {
567                        tmp.message = _error_message;
568                    }
569                    let tmp = tmp.meta(generic);
570                    tmp.build()
571                }),
572                "UnauthorizedClientException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::UnauthorizedClientException({
573                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
574                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
575                            e,
576                        ))
577                    })?;
578                    let mut tmp = <crate::types::error::builders::UnauthorizedClientExceptionBuilder>::default();
579                    tmp.deserialize_members(&mut *deser).map_err(|e| {
580                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
581                            e,
582                        ))
583                    })?;
584                    if tmp.message.is_none() {
585                        tmp.message = _error_message;
586                    }
587                    let tmp = tmp.meta(generic);
588                    tmp.build()
589                }),
590                "UnsupportedGrantTypeException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::UnsupportedGrantTypeException({
591                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
592                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
593                            e,
594                        ))
595                    })?;
596                    let mut tmp = <crate::types::error::builders::UnsupportedGrantTypeExceptionBuilder>::default();
597                    tmp.deserialize_members(&mut *deser).map_err(|e| {
598                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
599                            e,
600                        ))
601                    })?;
602                    if tmp.message.is_none() {
603                        tmp.message = _error_message;
604                    }
605                    let tmp = tmp.meta(generic);
606                    tmp.build()
607                }),
608                _ => {
609                    // Registry-backed, operation-scoped reification of an error whose
610                    // code this operation does not model directly: the operation's own
611                    // error registry is consulted first, then the lookup widens to the
612                    // service-wide error registry. On a hit, the reified error is attached
613                    // as the source of the returned unhandled error while its metadata
614                    // (code, message, request id) is preserved; on a miss the generic
615                    // error is returned unchanged.
616                    match protocol
617                        .deserialize_error_response(response, _cfg)
618                        .ok()
619                        .and_then(|mut deser| {
620                            ::aws_smithy_schema::registry::reify_error(
621                                crate::operation::create_token_with_iam::error_registry::REGISTRY
622                                    .or(&crate::error_type_registry::REGISTRY),
623                                error_code,
624                                &mut *deser,
625                            )
626                        }) {
627                        ::std::option::Option::Some(source) => <crate::operation::create_token_with_iam::CreateTokenWithIAMError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
628                        ::std::option::Option::None => crate::operation::create_token_with_iam::CreateTokenWithIAMError::generic(generic),
629                    }
630                }
631            };
632            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
633                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
634            ))
635        } else {
636            let protocol = _cfg
637                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
638                .expect("a SharedClientProtocol is required");
639            let mut deser = protocol
640                .deserialize_response(response, CreateTokenWithIAM::OUTPUT_SCHEMA, _cfg)
641                .map_err(|e| {
642                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
643                })?;
644            // `headers` is already in scope from the top of the function; alias it as
645            // `_response_headers` so MutateOutput customizations have a stable name to
646            // read from.
647            let _response_headers = headers;
648            // `mut` is required because `deserialize_members` and the `MutateOutput`
649            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
650            // empty output has no members and no customizations to run.
651            #[allow(unused_mut)]
652            let mut output = <crate::operation::create_token_with_iam::builders::CreateTokenWithIamOutputBuilder>::default();
653            output.deserialize_members(&mut *deser).map_err(|e| {
654                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
655            })?;
656            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
657            let output = output.build();
658            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
659        }
660    }
661}
662#[derive(Debug)]
663struct CreateTokenWithIAMRequestSerializer;
664impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateTokenWithIAMRequestSerializer {
665    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
666    fn serialize_input(
667        &self,
668        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
669        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
670    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
671        let input = input
672            .downcast::<crate::operation::create_token_with_iam::CreateTokenWithIamInput>()
673            .expect("correct type");
674
675        let protocol = _cfg
676            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
677            .expect("a SharedClientProtocol is required");
678        let mut request = protocol
679            .serialize_request(&input, CreateTokenWithIAM::INPUT_SCHEMA, "", _cfg)
680            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
681
682        return ::std::result::Result::Ok(request);
683    }
684}
685#[derive(Debug)]
686struct CreateTokenWithIAMEndpointParamsInterceptor;
687
688#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
689impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateTokenWithIAMEndpointParamsInterceptor {
690    fn name(&self) -> &'static str {
691        "CreateTokenWithIAMEndpointParamsInterceptor"
692    }
693
694    fn read_before_execution(
695        &self,
696        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
697            '_,
698            ::aws_smithy_runtime_api::client::interceptors::context::Input,
699            ::aws_smithy_runtime_api::client::interceptors::context::Output,
700            ::aws_smithy_runtime_api::client::interceptors::context::Error,
701        >,
702        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
703    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
704        let _input = context
705            .input()
706            .downcast_ref::<CreateTokenWithIamInput>()
707            .ok_or("failed to downcast to CreateTokenWithIamInput")?;
708
709        let params = crate::config::endpoint::Params::builder()
710            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
711            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
712            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
713            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
714            .build()
715            .map_err(|err| {
716                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
717            })?;
718        cfg.interceptor_state()
719            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
720        ::std::result::Result::Ok(())
721    }
722}
723
724// The get_* functions below are generated from JMESPath expressions in the
725// operationContextParams trait. They target the operation's input shape.
726
727/// Error type for the `CreateTokenWithIAMError` operation.
728#[non_exhaustive]
729#[derive(::std::fmt::Debug)]
730pub enum CreateTokenWithIAMError {
731    /// <p>You do not have sufficient access to perform this action.</p>
732    AccessDeniedException(crate::types::error::AccessDeniedException),
733    /// <p>Indicates that a request to authorize a client with an access user session token is pending.</p>
734    AuthorizationPendingException(crate::types::error::AuthorizationPendingException),
735    /// <p>Indicates that the token issued by the service is expired and is no longer valid.</p>
736    ExpiredTokenException(crate::types::error::ExpiredTokenException),
737    /// <p>Indicates that an error from the service occurred while trying to process a request.</p>
738    InternalServerException(crate::types::error::InternalServerException),
739    /// <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>
740    InvalidClientException(crate::types::error::InvalidClientException),
741    /// <p>Indicates that a request contains an invalid grant. This can occur if a client makes a <code>CreateToken</code> request with an invalid grant type.</p>
742    InvalidGrantException(crate::types::error::InvalidGrantException),
743    /// <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>
744    InvalidRequestException(crate::types::error::InvalidRequestException),
745    /// <p>Indicates that a token provided as input to the request was issued by and is only usable by calling IAM Identity Center endpoints in another region.</p>
746    InvalidRequestRegionException(crate::types::error::InvalidRequestRegionException),
747    /// <p>Indicates that the scope provided in the request is invalid.</p>
748    InvalidScopeException(crate::types::error::InvalidScopeException),
749    /// <p>Indicates that the client is making the request too frequently and is more than the service can handle.</p>
750    SlowDownException(crate::types::error::SlowDownException),
751    /// <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>
752    UnauthorizedClientException(crate::types::error::UnauthorizedClientException),
753    /// <p>Indicates that the grant type in the request is not supported by the service.</p>
754    UnsupportedGrantTypeException(crate::types::error::UnsupportedGrantTypeException),
755    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
756    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
757    variable wildcard pattern and check `.code()`:
758     \
759    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
760     \
761    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateTokenWithIAMError) for what information is available for the error.")]
762    Unhandled(crate::error::sealed_unhandled::Unhandled),
763}
764impl CreateTokenWithIAMError {
765    /// Creates the `CreateTokenWithIAMError::Unhandled` variant from any error type.
766    pub fn unhandled(
767        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
768    ) -> Self {
769        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
770            source: err.into(),
771            meta: ::std::default::Default::default(),
772        })
773    }
774
775    /// Creates the `CreateTokenWithIAMError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
776    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
777        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
778            source: err.clone().into(),
779            meta: err,
780        })
781    }
782    ///
783    /// Returns error metadata, which includes the error code, message,
784    /// request ID, and potentially additional information.
785    ///
786    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
787        match self {
788            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
789            Self::AuthorizationPendingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
790            Self::ExpiredTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
791            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
792            Self::InvalidClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
793            Self::InvalidGrantException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
794            Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
795            Self::InvalidRequestRegionException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
796            Self::InvalidScopeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
797            Self::SlowDownException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
798            Self::UnauthorizedClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
799            Self::UnsupportedGrantTypeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
800            Self::Unhandled(e) => &e.meta,
801        }
802    }
803    /// Returns `true` if the error kind is `CreateTokenWithIAMError::AccessDeniedException`.
804    pub fn is_access_denied_exception(&self) -> bool {
805        matches!(self, Self::AccessDeniedException(_))
806    }
807    /// Returns `true` if the error kind is `CreateTokenWithIAMError::AuthorizationPendingException`.
808    pub fn is_authorization_pending_exception(&self) -> bool {
809        matches!(self, Self::AuthorizationPendingException(_))
810    }
811    /// Returns `true` if the error kind is `CreateTokenWithIAMError::ExpiredTokenException`.
812    pub fn is_expired_token_exception(&self) -> bool {
813        matches!(self, Self::ExpiredTokenException(_))
814    }
815    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InternalServerException`.
816    pub fn is_internal_server_exception(&self) -> bool {
817        matches!(self, Self::InternalServerException(_))
818    }
819    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidClientException`.
820    pub fn is_invalid_client_exception(&self) -> bool {
821        matches!(self, Self::InvalidClientException(_))
822    }
823    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidGrantException`.
824    pub fn is_invalid_grant_exception(&self) -> bool {
825        matches!(self, Self::InvalidGrantException(_))
826    }
827    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidRequestException`.
828    pub fn is_invalid_request_exception(&self) -> bool {
829        matches!(self, Self::InvalidRequestException(_))
830    }
831    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidRequestRegionException`.
832    pub fn is_invalid_request_region_exception(&self) -> bool {
833        matches!(self, Self::InvalidRequestRegionException(_))
834    }
835    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidScopeException`.
836    pub fn is_invalid_scope_exception(&self) -> bool {
837        matches!(self, Self::InvalidScopeException(_))
838    }
839    /// Returns `true` if the error kind is `CreateTokenWithIAMError::SlowDownException`.
840    pub fn is_slow_down_exception(&self) -> bool {
841        matches!(self, Self::SlowDownException(_))
842    }
843    /// Returns `true` if the error kind is `CreateTokenWithIAMError::UnauthorizedClientException`.
844    pub fn is_unauthorized_client_exception(&self) -> bool {
845        matches!(self, Self::UnauthorizedClientException(_))
846    }
847    /// Returns `true` if the error kind is `CreateTokenWithIAMError::UnsupportedGrantTypeException`.
848    pub fn is_unsupported_grant_type_exception(&self) -> bool {
849        matches!(self, Self::UnsupportedGrantTypeException(_))
850    }
851}
852impl ::std::error::Error for CreateTokenWithIAMError {
853    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
854        match self {
855            Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
856            Self::AuthorizationPendingException(_inner) => ::std::option::Option::Some(_inner),
857            Self::ExpiredTokenException(_inner) => ::std::option::Option::Some(_inner),
858            Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
859            Self::InvalidClientException(_inner) => ::std::option::Option::Some(_inner),
860            Self::InvalidGrantException(_inner) => ::std::option::Option::Some(_inner),
861            Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
862            Self::InvalidRequestRegionException(_inner) => ::std::option::Option::Some(_inner),
863            Self::InvalidScopeException(_inner) => ::std::option::Option::Some(_inner),
864            Self::SlowDownException(_inner) => ::std::option::Option::Some(_inner),
865            Self::UnauthorizedClientException(_inner) => ::std::option::Option::Some(_inner),
866            Self::UnsupportedGrantTypeException(_inner) => ::std::option::Option::Some(_inner),
867            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
868        }
869    }
870}
871impl ::std::fmt::Display for CreateTokenWithIAMError {
872    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
873        match self {
874            Self::AccessDeniedException(_inner) => _inner.fmt(f),
875            Self::AuthorizationPendingException(_inner) => _inner.fmt(f),
876            Self::ExpiredTokenException(_inner) => _inner.fmt(f),
877            Self::InternalServerException(_inner) => _inner.fmt(f),
878            Self::InvalidClientException(_inner) => _inner.fmt(f),
879            Self::InvalidGrantException(_inner) => _inner.fmt(f),
880            Self::InvalidRequestException(_inner) => _inner.fmt(f),
881            Self::InvalidRequestRegionException(_inner) => _inner.fmt(f),
882            Self::InvalidScopeException(_inner) => _inner.fmt(f),
883            Self::SlowDownException(_inner) => _inner.fmt(f),
884            Self::UnauthorizedClientException(_inner) => _inner.fmt(f),
885            Self::UnsupportedGrantTypeException(_inner) => _inner.fmt(f),
886            Self::Unhandled(_inner) => {
887                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
888                    write!(f, "unhandled error ({code})")
889                } else {
890                    f.write_str("unhandled error")
891                }
892            }
893        }
894    }
895}
896impl ::aws_smithy_types::retry::ProvideErrorKind for CreateTokenWithIAMError {
897    fn code(&self) -> ::std::option::Option<&str> {
898        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
899    }
900    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
901        ::std::option::Option::None
902    }
903}
904impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateTokenWithIAMError {
905    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
906        match self {
907            Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
908            Self::AuthorizationPendingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
909            Self::ExpiredTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
910            Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
911            Self::InvalidClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
912            Self::InvalidGrantException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
913            Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
914            Self::InvalidRequestRegionException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
915            Self::InvalidScopeException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
916            Self::SlowDownException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
917            Self::UnauthorizedClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
918            Self::UnsupportedGrantTypeException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
919            Self::Unhandled(_inner) => &_inner.meta,
920        }
921    }
922}
923impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateTokenWithIAMError {
924    fn create_unhandled_error(
925        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
926        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
927    ) -> Self {
928        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
929            source,
930            meta: meta.unwrap_or_default(),
931        })
932    }
933}
934impl ::aws_types::request_id::RequestId for crate::operation::create_token_with_iam::CreateTokenWithIAMError {
935    fn request_id(&self) -> Option<&str> {
936        self.meta().request_id()
937    }
938}
939
940pub use crate::operation::create_token_with_iam::_create_token_with_iam_input::CreateTokenWithIamInput;
941
942pub use crate::operation::create_token_with_iam::_create_token_with_iam_output::CreateTokenWithIamOutput;
943
944mod _create_token_with_iam_input;
945
946mod _create_token_with_iam_output;
947
948/// Builders
949pub mod builders;