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    pub(crate) async fn orchestrate(
12                        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13                        input: crate::operation::create_token_with_iam::CreateTokenWithIamInput,
14                    ) -> ::std::result::Result<crate::operation::create_token_with_iam::CreateTokenWithIamOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_token_with_iam::CreateTokenWithIAMError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
15                        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| {
16                            err.map_service_error(|err| {
17                                err.downcast::<crate::operation::create_token_with_iam::CreateTokenWithIAMError>().expect("correct error type")
18                            })
19                        };
20                        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
21                            .await
22                            .map_err(map_err)?;
23                        let output = context.finalize().map_err(map_err)?;
24                        ::std::result::Result::Ok(output.downcast::<crate::operation::create_token_with_iam::CreateTokenWithIamOutput>().expect("correct output type"))
25                    }
26
27                    pub(crate) async fn orchestrate_with_stop_point(
28                        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
29                        input: crate::operation::create_token_with_iam::CreateTokenWithIamInput,
30                        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
31                    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
32                        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
33                        use ::tracing::Instrument;
34                        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
35                            "SSO OIDC",
36                            "CreateTokenWithIAM",
37                            input,
38                            runtime_plugins,
39                            stop_point
40                        )
41                        // Create a parent span for the entire operation. Includes a random, internal-only,
42                        // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
43                        .instrument(::tracing::debug_span!(
44                                "SSO OIDC.CreateTokenWithIAM",
45                                "rpc.service" = "SSO OIDC",
46                                "rpc.method" = "CreateTokenWithIAM",
47                                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
48                                "rpc.system" = "aws-api",
49                            ))
50                        .await
51                    }
52
53                    pub(crate) fn operation_runtime_plugins(
54                        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
55                        client_config: &crate::config::Config,
56                        config_override: ::std::option::Option<crate::config::Builder>,
57                    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
58                        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
59
60                        if let ::std::option::Option::Some(config_override) = config_override {
61                            for plugin in config_override.runtime_plugins.iter().cloned() {
62                                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
63                            }
64                            runtime_plugins = runtime_plugins.with_operation_plugin(
65                                crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components)
66                            );
67                        }
68                        runtime_plugins
69                    }
70}
71impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateTokenWithIAM {
72                fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
73                    let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateTokenWithIAM");
74
75                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(CreateTokenWithIAMRequestSerializer));
76                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(CreateTokenWithIAMResponseDeserializer));
77
78                    cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
79                        crate::config::auth::Params::builder()
80                            .operation_name("CreateTokenWithIAM")
81                            .build()
82                            .expect("required fields set")
83                    ));
84
85                    cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
86cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
87                            "CreateTokenWithIAM",
88                            "SSO OIDC",
89                        ));
90let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
91                            signing_options.double_uri_encode = true;
92                            signing_options.content_sha256_header = false;
93                            signing_options.normalize_uri_path = true;
94                            signing_options.payload_override = None;
95
96                            cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
97                                signing_options,
98                                ..::std::default::Default::default()
99                            });
100
101                    ::std::option::Option::Some(cfg.freeze())
102                }
103
104                fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
105                    #[allow(unused_mut)]
106                    let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateTokenWithIAM")
107                            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(CreateTokenWithIAMTelemetryInputCaptureInterceptor))
108.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()))
109.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(CreateTokenWithIAMEndpointParamsInterceptor))
110                            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::create_token_with_iam::CreateTokenWithIAMError>::new())
111.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::create_token_with_iam::CreateTokenWithIAMError>::new())
112.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::create_token_with_iam::CreateTokenWithIAMError>::new())
113.with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<crate::operation::create_token_with_iam::CreateTokenWithIAMError>::new());
114
115                    ::std::borrow::Cow::Owned(rcb)
116                }
117            }
118
119            #[derive(Debug)]
120            struct CreateTokenWithIAMTelemetryInputCaptureInterceptor;
121
122            #[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
123            impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateTokenWithIAMTelemetryInputCaptureInterceptor {
124                fn name(&self) -> &'static str {
125                    "CreateTokenWithIAMTelemetryInputCaptureInterceptor"
126                }
127
128                fn read_before_execution(
129                    &self,
130                    context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>,
131                    cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
132                ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
133                    // Nothing to do unless the customer opted in by naming members to record.
134                    let ::std::option::Option::Some(requested) = cfg.load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>().filter(|r| !r.is_empty()) else {
135                        return ::std::result::Result::Ok(());
136                    };
137
138                    let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateTokenWithIamInput>() else {
139                        // A mismatched input is not this interceptor's concern; skip quietly.
140                        return ::std::result::Result::Ok(());
141                    };
142
143                    let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
144                    if requested.should_capture("clientId") {
145                            if let ::std::option::Option::Some(value) = input.client_id.as_deref() {
146                                captured.insert("clientId", value);
147                            }
148                        }
149if requested.should_capture("grantType") {
150                            if let ::std::option::Option::Some(value) = input.grant_type.as_deref() {
151                                captured.insert("grantType", value);
152                            }
153                        }
154if requested.should_capture("code") {
155                            if let ::std::option::Option::Some(value) = input.code.as_deref() {
156                                captured.insert("code", value);
157                            }
158                        }
159if requested.should_capture("redirectUri") {
160                            if let ::std::option::Option::Some(value) = input.redirect_uri.as_deref() {
161                                captured.insert("redirectUri", value);
162                            }
163                        }
164if requested.should_capture("subjectTokenType") {
165                            if let ::std::option::Option::Some(value) = input.subject_token_type.as_deref() {
166                                captured.insert("subjectTokenType", value);
167                            }
168                        }
169if requested.should_capture("requestedTokenType") {
170                            if let ::std::option::Option::Some(value) = input.requested_token_type.as_deref() {
171                                captured.insert("requestedTokenType", value);
172                            }
173                        }
174
175                    cfg.interceptor_state().store_put(captured);
176                    ::std::result::Result::Ok(())
177                }
178            }
179#[derive(Debug)]
180            struct CreateTokenWithIAMResponseDeserializer;
181            impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateTokenWithIAMResponseDeserializer {
182
183
184                fn deserialize_nonstreaming_with_config(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse, _cfg: &::aws_smithy_types::config_bag::ConfigBag) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
185                    let (success, status) = (response.status().is_success(), response.status().as_u16());
186            let headers = response.headers();
187            let body = response.body().bytes().expect("body loaded");
188            #[allow(unused_mut)]
189            let mut force_error = false;
190            ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
191            let parse_result = if !success && status != 200 || force_error {
192                crate::protocol_serde::shape_create_token_with_iam::de_create_token_with_iam_http_error(status, headers, body, _cfg)
193            } else {
194                crate::protocol_serde::shape_create_token_with_iam::de_create_token_with_iam_http_response(status, headers, body, _cfg)
195            };
196            crate::protocol_serde::type_erase_result(parse_result)
197                }
198            }
199#[derive(Debug)]
200            struct CreateTokenWithIAMRequestSerializer;
201            impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateTokenWithIAMRequestSerializer {
202                #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
203                fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
204                    let input = input.downcast::<crate::operation::create_token_with_iam::CreateTokenWithIamInput>().expect("correct type");
205                    let _header_serialization_settings = _cfg.load::<crate::serialization_settings::HeaderSerializationSettings>().cloned().unwrap_or_default();
206                    let mut request_builder = {
207                        #[allow(clippy::uninlined_format_args)]
208fn uri_base(_input: &crate::operation::create_token_with_iam::CreateTokenWithIamInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
209    use ::std::fmt::Write as _;
210    ::std::write!(output, "/token").expect("formatting should succeed");
211    ::std::result::Result::Ok(())
212}
213fn uri_query(_input: &crate::operation::create_token_with_iam::CreateTokenWithIamInput, mut output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
214    let mut query = ::aws_smithy_http::query::Writer::new(output);
215    query.push_kv("aws_iam", "t");
216    ::std::result::Result::Ok(())
217}
218#[allow(clippy::unnecessary_wraps)]
219fn update_http_builder(
220                input: &crate::operation::create_token_with_iam::CreateTokenWithIamInput,
221                builder: ::http_1x::request::Builder
222            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
223    let mut uri = ::std::string::String::new();
224    uri_base(input, &mut uri)?;
225    uri_query(input, &mut uri)?;
226    ::std::result::Result::Ok(builder.method("POST").uri(uri))
227}
228let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
229builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
230builder
231                    };
232                    let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_token_with_iam::ser_create_token_with_iam_input(&input)?);
233                    if let Some(content_length) = body.content_length() {
234                                let content_length = content_length.to_string();
235                                request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
236                            }
237                    ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
238                }
239            }
240#[derive(Debug)]
241            struct CreateTokenWithIAMEndpointParamsInterceptor;
242
243            #[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
244            impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateTokenWithIAMEndpointParamsInterceptor {
245                fn name(&self) -> &'static str {
246                    "CreateTokenWithIAMEndpointParamsInterceptor"
247                }
248
249                fn read_before_execution(
250                    &self,
251                    context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>,
252                    cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
253                ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
254                    let _input = context.input()
255                        .downcast_ref::<CreateTokenWithIamInput>()
256                        .ok_or("failed to downcast to CreateTokenWithIamInput")?;
257
258
259
260                    let params = crate::config::endpoint::Params::builder()
261                        .set_region(cfg.load::<::aws_types::region::Region>().map(|r|r.as_ref().to_owned()))
262.set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
263.set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
264.set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
265                        .build()
266                        .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?;
267                    cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
268                    ::std::result::Result::Ok(())
269                }
270            }
271
272            // The get_* functions below are generated from JMESPath expressions in the
273            // operationContextParams trait. They target the operation's input shape.
274
275
276
277/// Error type for the `CreateTokenWithIAMError` operation.
278#[non_exhaustive]
279#[derive(::std::fmt::Debug)]
280pub enum CreateTokenWithIAMError {
281    /// <p>You do not have sufficient access to perform this action.</p>
282    AccessDeniedException(crate::types::error::AccessDeniedException),
283    /// <p>Indicates that a request to authorize a client with an access user session token is pending.</p>
284    AuthorizationPendingException(crate::types::error::AuthorizationPendingException),
285    /// <p>Indicates that the token issued by the service is expired and is no longer valid.</p>
286    ExpiredTokenException(crate::types::error::ExpiredTokenException),
287    /// <p>Indicates that an error from the service occurred while trying to process a request.</p>
288    InternalServerException(crate::types::error::InternalServerException),
289    /// <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>
290    InvalidClientException(crate::types::error::InvalidClientException),
291    /// <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>
292    InvalidGrantException(crate::types::error::InvalidGrantException),
293    /// <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>
294    InvalidRequestException(crate::types::error::InvalidRequestException),
295    /// <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>
296    InvalidRequestRegionException(crate::types::error::InvalidRequestRegionException),
297    /// <p>Indicates that the scope provided in the request is invalid.</p>
298    InvalidScopeException(crate::types::error::InvalidScopeException),
299    /// <p>Indicates that the client is making the request too frequently and is more than the service can handle.</p>
300    SlowDownException(crate::types::error::SlowDownException),
301    /// <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>
302    UnauthorizedClientException(crate::types::error::UnauthorizedClientException),
303    /// <p>Indicates that the grant type in the request is not supported by the service.</p>
304    UnsupportedGrantTypeException(crate::types::error::UnsupportedGrantTypeException),
305    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
306                    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
307    variable wildcard pattern and check `.code()`:
308     \
309    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
310     \
311    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateTokenWithIAMError) for what information is available for the error.")]
312                    Unhandled(crate::error::sealed_unhandled::Unhandled),
313}
314impl CreateTokenWithIAMError {
315    /// Creates the `CreateTokenWithIAMError::Unhandled` variant from any error type.
316                    pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>) -> Self {
317                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() })
318                    }
319
320                    /// Creates the `CreateTokenWithIAMError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
321                    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
322                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err })
323                    }
324    ///
325    /// Returns error metadata, which includes the error code, message,
326    /// request ID, and potentially additional information.
327    ///
328    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
329        match self {
330            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
331            Self::AuthorizationPendingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
332            Self::ExpiredTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
333            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
334            Self::InvalidClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
335            Self::InvalidGrantException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
336            Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
337            Self::InvalidRequestRegionException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
338            Self::InvalidScopeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
339            Self::SlowDownException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
340            Self::UnauthorizedClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
341            Self::UnsupportedGrantTypeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
342            Self::Unhandled(e) => &e.meta,
343        }
344    }
345    /// Returns `true` if the error kind is `CreateTokenWithIAMError::AccessDeniedException`.
346    pub fn is_access_denied_exception(&self) -> bool {
347        matches!(self, Self::AccessDeniedException(_))
348    }
349    /// Returns `true` if the error kind is `CreateTokenWithIAMError::AuthorizationPendingException`.
350    pub fn is_authorization_pending_exception(&self) -> bool {
351        matches!(self, Self::AuthorizationPendingException(_))
352    }
353    /// Returns `true` if the error kind is `CreateTokenWithIAMError::ExpiredTokenException`.
354    pub fn is_expired_token_exception(&self) -> bool {
355        matches!(self, Self::ExpiredTokenException(_))
356    }
357    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InternalServerException`.
358    pub fn is_internal_server_exception(&self) -> bool {
359        matches!(self, Self::InternalServerException(_))
360    }
361    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidClientException`.
362    pub fn is_invalid_client_exception(&self) -> bool {
363        matches!(self, Self::InvalidClientException(_))
364    }
365    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidGrantException`.
366    pub fn is_invalid_grant_exception(&self) -> bool {
367        matches!(self, Self::InvalidGrantException(_))
368    }
369    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidRequestException`.
370    pub fn is_invalid_request_exception(&self) -> bool {
371        matches!(self, Self::InvalidRequestException(_))
372    }
373    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidRequestRegionException`.
374    pub fn is_invalid_request_region_exception(&self) -> bool {
375        matches!(self, Self::InvalidRequestRegionException(_))
376    }
377    /// Returns `true` if the error kind is `CreateTokenWithIAMError::InvalidScopeException`.
378    pub fn is_invalid_scope_exception(&self) -> bool {
379        matches!(self, Self::InvalidScopeException(_))
380    }
381    /// Returns `true` if the error kind is `CreateTokenWithIAMError::SlowDownException`.
382    pub fn is_slow_down_exception(&self) -> bool {
383        matches!(self, Self::SlowDownException(_))
384    }
385    /// Returns `true` if the error kind is `CreateTokenWithIAMError::UnauthorizedClientException`.
386    pub fn is_unauthorized_client_exception(&self) -> bool {
387        matches!(self, Self::UnauthorizedClientException(_))
388    }
389    /// Returns `true` if the error kind is `CreateTokenWithIAMError::UnsupportedGrantTypeException`.
390    pub fn is_unsupported_grant_type_exception(&self) -> bool {
391        matches!(self, Self::UnsupportedGrantTypeException(_))
392    }
393}
394impl ::std::error::Error for CreateTokenWithIAMError {
395    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
396        match self {
397            Self::AccessDeniedException(_inner) =>
398            ::std::option::Option::Some(_inner)
399            ,
400            Self::AuthorizationPendingException(_inner) =>
401            ::std::option::Option::Some(_inner)
402            ,
403            Self::ExpiredTokenException(_inner) =>
404            ::std::option::Option::Some(_inner)
405            ,
406            Self::InternalServerException(_inner) =>
407            ::std::option::Option::Some(_inner)
408            ,
409            Self::InvalidClientException(_inner) =>
410            ::std::option::Option::Some(_inner)
411            ,
412            Self::InvalidGrantException(_inner) =>
413            ::std::option::Option::Some(_inner)
414            ,
415            Self::InvalidRequestException(_inner) =>
416            ::std::option::Option::Some(_inner)
417            ,
418            Self::InvalidRequestRegionException(_inner) =>
419            ::std::option::Option::Some(_inner)
420            ,
421            Self::InvalidScopeException(_inner) =>
422            ::std::option::Option::Some(_inner)
423            ,
424            Self::SlowDownException(_inner) =>
425            ::std::option::Option::Some(_inner)
426            ,
427            Self::UnauthorizedClientException(_inner) =>
428            ::std::option::Option::Some(_inner)
429            ,
430            Self::UnsupportedGrantTypeException(_inner) =>
431            ::std::option::Option::Some(_inner)
432            ,
433            Self::Unhandled(_inner) => {
434                ::std::option::Option::Some(&*_inner.source)
435            }
436        }
437    }
438}
439impl ::std::fmt::Display for CreateTokenWithIAMError {
440    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
441        match self {
442            Self::AccessDeniedException(_inner) =>
443            _inner.fmt(f)
444            ,
445            Self::AuthorizationPendingException(_inner) =>
446            _inner.fmt(f)
447            ,
448            Self::ExpiredTokenException(_inner) =>
449            _inner.fmt(f)
450            ,
451            Self::InternalServerException(_inner) =>
452            _inner.fmt(f)
453            ,
454            Self::InvalidClientException(_inner) =>
455            _inner.fmt(f)
456            ,
457            Self::InvalidGrantException(_inner) =>
458            _inner.fmt(f)
459            ,
460            Self::InvalidRequestException(_inner) =>
461            _inner.fmt(f)
462            ,
463            Self::InvalidRequestRegionException(_inner) =>
464            _inner.fmt(f)
465            ,
466            Self::InvalidScopeException(_inner) =>
467            _inner.fmt(f)
468            ,
469            Self::SlowDownException(_inner) =>
470            _inner.fmt(f)
471            ,
472            Self::UnauthorizedClientException(_inner) =>
473            _inner.fmt(f)
474            ,
475            Self::UnsupportedGrantTypeException(_inner) =>
476            _inner.fmt(f)
477            ,
478            Self::Unhandled(_inner) => {
479                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
480                                                        write!(f, "unhandled error ({code})")
481                                                    } else {
482                                                        f.write_str("unhandled error")
483                                                    }
484            }
485        }
486    }
487}
488impl ::aws_smithy_types::retry::ProvideErrorKind for CreateTokenWithIAMError {
489    fn code(&self) -> ::std::option::Option<&str> {
490        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
491    }
492    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
493        ::std::option::Option::None
494    }
495}
496impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateTokenWithIAMError {
497    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
498        match self {
499            Self::AccessDeniedException(_inner) =>
500            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
501            ,
502            Self::AuthorizationPendingException(_inner) =>
503            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
504            ,
505            Self::ExpiredTokenException(_inner) =>
506            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
507            ,
508            Self::InternalServerException(_inner) =>
509            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
510            ,
511            Self::InvalidClientException(_inner) =>
512            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
513            ,
514            Self::InvalidGrantException(_inner) =>
515            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
516            ,
517            Self::InvalidRequestException(_inner) =>
518            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
519            ,
520            Self::InvalidRequestRegionException(_inner) =>
521            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
522            ,
523            Self::InvalidScopeException(_inner) =>
524            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
525            ,
526            Self::SlowDownException(_inner) =>
527            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
528            ,
529            Self::UnauthorizedClientException(_inner) =>
530            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
531            ,
532            Self::UnsupportedGrantTypeException(_inner) =>
533            ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
534            ,
535            Self::Unhandled(_inner) => {
536                &_inner.meta
537            }
538        }
539    }
540}
541impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateTokenWithIAMError {
542    fn create_unhandled_error(
543                        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
544                        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>
545                    ) -> Self {
546        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() })
547    }
548}
549impl ::aws_types::request_id::RequestId for crate::operation::create_token_with_iam::CreateTokenWithIAMError {
550                                fn request_id(&self) -> Option<&str> {
551                                    self.meta().request_id()
552                                }
553                            }
554
555pub use crate::operation::create_token_with_iam::_create_token_with_iam_input::CreateTokenWithIamInput;
556
557pub use crate::operation::create_token_with_iam::_create_token_with_iam_output::CreateTokenWithIamOutput;
558
559mod _create_token_with_iam_input;
560
561mod _create_token_with_iam_output;
562
563/// Builders
564pub mod builders;
565