aws_sdk_ssooidc/operation/
create_token_with_iam.rs

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