Skip to main content

aws_sdk_ssooidc/operation/
create_token.rs

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