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