1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateToken;
6impl CreateToken {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::create_token::CreateTokenInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = 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<
19 crate::operation::create_token::CreateTokenOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::create_token::CreateTokenError,
22 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
23 >,
24 > {
25 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
26 ::aws_smithy_runtime_api::client::interceptors::context::Error,
27 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
28 >| {
29 err.map_service_error(|err| {
30 err.downcast::<crate::operation::create_token::CreateTokenError>()
31 .expect("correct error type")
32 })
33 };
34 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
35 .await
36 .map_err(map_err)?;
37 let output = context.finalize().map_err(map_err)?;
38 ::std::result::Result::Ok(
39 output
40 .downcast::<crate::operation::create_token::CreateTokenOutput>()
41 .expect("correct output type"),
42 )
43 }
44
45 pub(crate) async fn orchestrate_with_stop_point(
46 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
47 input: crate::operation::create_token::CreateTokenInput,
48 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
49 ) -> ::std::result::Result<
50 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
51 ::aws_smithy_runtime_api::client::result::SdkError<
52 ::aws_smithy_runtime_api::client::interceptors::context::Error,
53 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
54 >,
55 > {
56 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
57 use ::tracing::Instrument;
58 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("SSO OIDC", "CreateToken", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "SSO OIDC.CreateToken",
63 "rpc.service" = "SSO OIDC",
64 "rpc.method" = "CreateToken",
65 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
66 "rpc.system" = "aws-api",
67 ))
68 .await
69 }
70
71 pub(crate) fn operation_runtime_plugins(
72 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
73 client_config: &crate::config::Config,
74 config_override: ::std::option::Option<crate::config::Builder>,
75 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
76 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
77
78 if let ::std::option::Option::Some(config_override) = config_override {
79 for plugin in config_override.runtime_plugins.iter().cloned() {
80 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
81 }
82 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
83 config_override,
84 client_config.config.clone(),
85 &client_config.runtime_components,
86 ));
87 }
88 runtime_plugins
89 }
90}
91pub(crate) mod error_registry {
100 pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
101 ::aws_smithy_schema::registry::TypeRegistry::builder()
102 .insert_error_shape(
103 crate::types::error::AccessDeniedException::SCHEMA,
104 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
105 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::AccessDeniedException::deserialize(d)?))
106 },
107 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
108 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::AccessDeniedException::deserialize(d)?))
109 },
110 )
111.insert_error_shape(
112 crate::types::error::AuthorizationPendingException::SCHEMA,
113 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
114 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::AuthorizationPendingException::deserialize(d)?))
115 },
116 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
117 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::AuthorizationPendingException::deserialize(d)?))
118 },
119 )
120.insert_error_shape(
121 crate::types::error::ExpiredTokenException::SCHEMA,
122 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
123 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ExpiredTokenException::deserialize(d)?))
124 },
125 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
126 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ExpiredTokenException::deserialize(d)?))
127 },
128 )
129.insert_error_shape(
130 crate::types::error::InternalServerException::SCHEMA,
131 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
132 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InternalServerException::deserialize(d)?))
133 },
134 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
135 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InternalServerException::deserialize(d)?))
136 },
137 )
138.insert_error_shape(
139 crate::types::error::InvalidClientException::SCHEMA,
140 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
141 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidClientException::deserialize(d)?))
142 },
143 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
144 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidClientException::deserialize(d)?))
145 },
146 )
147.insert_error_shape(
148 crate::types::error::InvalidGrantException::SCHEMA,
149 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
150 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidGrantException::deserialize(d)?))
151 },
152 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
153 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidGrantException::deserialize(d)?))
154 },
155 )
156.insert_error_shape(
157 crate::types::error::InvalidRequestException::SCHEMA,
158 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
159 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidRequestException::deserialize(d)?))
160 },
161 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
162 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidRequestException::deserialize(d)?))
163 },
164 )
165.insert_error_shape(
166 crate::types::error::InvalidScopeException::SCHEMA,
167 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
168 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidScopeException::deserialize(d)?))
169 },
170 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
171 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidScopeException::deserialize(d)?))
172 },
173 )
174.insert_error_shape(
175 crate::types::error::SlowDownException::SCHEMA,
176 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
177 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::SlowDownException::deserialize(d)?))
178 },
179 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
180 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::SlowDownException::deserialize(d)?))
181 },
182 )
183.insert_error_shape(
184 crate::types::error::UnauthorizedClientException::SCHEMA,
185 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
186 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::UnauthorizedClientException::deserialize(d)?))
187 },
188 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
189 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::UnauthorizedClientException::deserialize(d)?))
190 },
191 )
192.insert_error_shape(
193 crate::types::error::UnsupportedGrantTypeException::SCHEMA,
194 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
195 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::UnsupportedGrantTypeException::deserialize(d)?))
196 },
197 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
198 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::UnsupportedGrantTypeException::deserialize(d)?))
199 },
200 )
201 .build()
202 });
203}
204impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateToken {
205 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
206 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateToken");
207
208 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
209 CreateTokenRequestSerializer,
210 ));
211 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
212 CreateTokenResponseDeserializer,
213 ));
214
215 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
216 crate::config::auth::Params::builder()
217 .operation_name("CreateToken")
218 .build()
219 .expect("required fields set"),
220 ));
221
222 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
223 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("CreateToken", "SSO OIDC"));
224
225 ::std::option::Option::Some(cfg.freeze())
226 }
227
228 fn runtime_components(
229 &self,
230 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
231 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
232 #[allow(unused_mut)]
233 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateToken")
234 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
235 CreateTokenTelemetryInputCaptureInterceptor,
236 ))
237 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
238 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
239 ))
240 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
241 CreateTokenEndpointParamsInterceptor,
242 ))
243 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
244 crate::operation::create_token::CreateTokenError,
245 >::new())
246 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
247 crate::operation::create_token::CreateTokenError,
248 >::new())
249 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
250 crate::operation::create_token::CreateTokenError,
251 >::new())
252 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
253 crate::operation::create_token::CreateTokenError,
254 >::new());
255
256 ::std::borrow::Cow::Owned(rcb)
257 }
258}
259
260#[derive(Debug)]
261struct CreateTokenTelemetryInputCaptureInterceptor;
262
263#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
264impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateTokenTelemetryInputCaptureInterceptor {
265 fn name(&self) -> &'static str {
266 "CreateTokenTelemetryInputCaptureInterceptor"
267 }
268
269 fn read_before_execution(
270 &self,
271 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
272 '_,
273 ::aws_smithy_runtime_api::client::interceptors::context::Input,
274 ::aws_smithy_runtime_api::client::interceptors::context::Output,
275 ::aws_smithy_runtime_api::client::interceptors::context::Error,
276 >,
277 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
278 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
279 let ::std::option::Option::Some(requested) = cfg
281 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
282 .filter(|r| !r.is_empty())
283 else {
284 return ::std::result::Result::Ok(());
285 };
286
287 let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateTokenInput>() else {
288 return ::std::result::Result::Ok(());
290 };
291
292 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
293 if requested.should_capture("clientId") {
294 if let ::std::option::Option::Some(value) = input.client_id.as_deref() {
295 captured.insert("clientId", value);
296 }
297 }
298 if requested.should_capture("grantType") {
299 if let ::std::option::Option::Some(value) = input.grant_type.as_deref() {
300 captured.insert("grantType", value);
301 }
302 }
303 if requested.should_capture("deviceCode") {
304 if let ::std::option::Option::Some(value) = input.device_code.as_deref() {
305 captured.insert("deviceCode", value);
306 }
307 }
308 if requested.should_capture("code") {
309 if let ::std::option::Option::Some(value) = input.code.as_deref() {
310 captured.insert("code", value);
311 }
312 }
313 if requested.should_capture("redirectUri") {
314 if let ::std::option::Option::Some(value) = input.redirect_uri.as_deref() {
315 captured.insert("redirectUri", value);
316 }
317 }
318
319 cfg.interceptor_state().store_put(captured);
320 ::std::result::Result::Ok(())
321 }
322}
323#[derive(Debug)]
324struct CreateTokenResponseDeserializer;
325impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateTokenResponseDeserializer {
326 fn deserialize_nonstreaming_with_config(
327 &self,
328 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
329 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
330 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
331 let (success, status) = (response.status().is_success(), response.status().as_u16());
332 #[allow(unused_variables)]
337 let body = response.body().bytes().expect("body loaded");
338 let headers = response.headers();
339 #[allow(unused_mut)]
340 let mut force_error = false;
341 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
342 if !success && status != 200 || force_error {
343 let protocol = _cfg
344 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
345 .expect("a SharedClientProtocol is required");
346 #[allow(unused_mut)]
347 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
348 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
349 })?;
350 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
351 let generic = generic_builder.build();
352 let error_code = match generic.code() {
353 ::std::option::Option::Some(code) => code,
354 ::std::option::Option::None => {
355 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
356 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::create_token::CreateTokenError::unhandled(generic)),
357 ))
358 }
359 };
360 let _error_message = generic.message().map(|msg| msg.to_owned());
361 let err = match error_code {
362 "AccessDeniedException" => crate::operation::create_token::CreateTokenError::AccessDeniedException({
363 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
364 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
365 e,
366 ))
367 })?;
368 let mut tmp = <crate::types::error::builders::AccessDeniedExceptionBuilder>::default();
369 tmp.deserialize_members(&mut *deser).map_err(|e| {
370 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
371 e,
372 ))
373 })?;
374 if tmp.message.is_none() {
375 tmp.message = _error_message;
376 }
377 let tmp = tmp.meta(generic);
378 tmp.build()
379 }),
380 "AuthorizationPendingException" => crate::operation::create_token::CreateTokenError::AuthorizationPendingException({
381 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
382 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
383 e,
384 ))
385 })?;
386 let mut tmp = <crate::types::error::builders::AuthorizationPendingExceptionBuilder>::default();
387 tmp.deserialize_members(&mut *deser).map_err(|e| {
388 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
389 e,
390 ))
391 })?;
392 if tmp.message.is_none() {
393 tmp.message = _error_message;
394 }
395 let tmp = tmp.meta(generic);
396 tmp.build()
397 }),
398 "ExpiredTokenException" => crate::operation::create_token::CreateTokenError::ExpiredTokenException({
399 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
400 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
401 e,
402 ))
403 })?;
404 let mut tmp = <crate::types::error::builders::ExpiredTokenExceptionBuilder>::default();
405 tmp.deserialize_members(&mut *deser).map_err(|e| {
406 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
407 e,
408 ))
409 })?;
410 if tmp.message.is_none() {
411 tmp.message = _error_message;
412 }
413 let tmp = tmp.meta(generic);
414 tmp.build()
415 }),
416 "InternalServerException" => crate::operation::create_token::CreateTokenError::InternalServerException({
417 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
418 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
419 e,
420 ))
421 })?;
422 let mut tmp = <crate::types::error::builders::InternalServerExceptionBuilder>::default();
423 tmp.deserialize_members(&mut *deser).map_err(|e| {
424 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
425 e,
426 ))
427 })?;
428 if tmp.message.is_none() {
429 tmp.message = _error_message;
430 }
431 let tmp = tmp.meta(generic);
432 tmp.build()
433 }),
434 "InvalidClientException" => crate::operation::create_token::CreateTokenError::InvalidClientException({
435 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
436 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
437 e,
438 ))
439 })?;
440 let mut tmp = <crate::types::error::builders::InvalidClientExceptionBuilder>::default();
441 tmp.deserialize_members(&mut *deser).map_err(|e| {
442 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
443 e,
444 ))
445 })?;
446 if tmp.message.is_none() {
447 tmp.message = _error_message;
448 }
449 let tmp = tmp.meta(generic);
450 tmp.build()
451 }),
452 "InvalidGrantException" => crate::operation::create_token::CreateTokenError::InvalidGrantException({
453 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
454 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
455 e,
456 ))
457 })?;
458 let mut tmp = <crate::types::error::builders::InvalidGrantExceptionBuilder>::default();
459 tmp.deserialize_members(&mut *deser).map_err(|e| {
460 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
461 e,
462 ))
463 })?;
464 if tmp.message.is_none() {
465 tmp.message = _error_message;
466 }
467 let tmp = tmp.meta(generic);
468 tmp.build()
469 }),
470 "InvalidRequestException" => crate::operation::create_token::CreateTokenError::InvalidRequestException({
471 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
472 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
473 e,
474 ))
475 })?;
476 let mut tmp = <crate::types::error::builders::InvalidRequestExceptionBuilder>::default();
477 tmp.deserialize_members(&mut *deser).map_err(|e| {
478 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
479 e,
480 ))
481 })?;
482 if tmp.message.is_none() {
483 tmp.message = _error_message;
484 }
485 let tmp = tmp.meta(generic);
486 tmp.build()
487 }),
488 "InvalidScopeException" => crate::operation::create_token::CreateTokenError::InvalidScopeException({
489 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
490 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
491 e,
492 ))
493 })?;
494 let mut tmp = <crate::types::error::builders::InvalidScopeExceptionBuilder>::default();
495 tmp.deserialize_members(&mut *deser).map_err(|e| {
496 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
497 e,
498 ))
499 })?;
500 if tmp.message.is_none() {
501 tmp.message = _error_message;
502 }
503 let tmp = tmp.meta(generic);
504 tmp.build()
505 }),
506 "SlowDownException" => crate::operation::create_token::CreateTokenError::SlowDownException({
507 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
508 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
509 e,
510 ))
511 })?;
512 let mut tmp = <crate::types::error::builders::SlowDownExceptionBuilder>::default();
513 tmp.deserialize_members(&mut *deser).map_err(|e| {
514 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
515 e,
516 ))
517 })?;
518 if tmp.message.is_none() {
519 tmp.message = _error_message;
520 }
521 let tmp = tmp.meta(generic);
522 tmp.build()
523 }),
524 "UnauthorizedClientException" => crate::operation::create_token::CreateTokenError::UnauthorizedClientException({
525 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
526 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
527 e,
528 ))
529 })?;
530 let mut tmp = <crate::types::error::builders::UnauthorizedClientExceptionBuilder>::default();
531 tmp.deserialize_members(&mut *deser).map_err(|e| {
532 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
533 e,
534 ))
535 })?;
536 if tmp.message.is_none() {
537 tmp.message = _error_message;
538 }
539 let tmp = tmp.meta(generic);
540 tmp.build()
541 }),
542 "UnsupportedGrantTypeException" => crate::operation::create_token::CreateTokenError::UnsupportedGrantTypeException({
543 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
544 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
545 e,
546 ))
547 })?;
548 let mut tmp = <crate::types::error::builders::UnsupportedGrantTypeExceptionBuilder>::default();
549 tmp.deserialize_members(&mut *deser).map_err(|e| {
550 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
551 e,
552 ))
553 })?;
554 if tmp.message.is_none() {
555 tmp.message = _error_message;
556 }
557 let tmp = tmp.meta(generic);
558 tmp.build()
559 }),
560 _ => {
561 match protocol
569 .deserialize_error_response(response, _cfg)
570 .ok()
571 .and_then(|mut deser| {
572 ::aws_smithy_schema::registry::reify_error(
573 crate::operation::create_token::error_registry::REGISTRY
574 .or(&crate::error_type_registry::REGISTRY),
575 error_code,
576 &mut *deser,
577 )
578 }) {
579 ::std::option::Option::Some(source) => <crate::operation::create_token::CreateTokenError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
580 ::std::option::Option::None => crate::operation::create_token::CreateTokenError::generic(generic),
581 }
582 }
583 };
584 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
585 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
586 ))
587 } else {
588 let protocol = _cfg
589 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
590 .expect("a SharedClientProtocol is required");
591 let mut deser = protocol.deserialize_response(response, CreateToken::OUTPUT_SCHEMA, _cfg).map_err(|e| {
592 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
593 })?;
594 let _response_headers = headers;
598 #[allow(unused_mut)]
602 let mut output = <crate::operation::create_token::builders::CreateTokenOutputBuilder>::default();
603 output.deserialize_members(&mut *deser).map_err(|e| {
604 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
605 })?;
606 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
607 let output = output.build();
608 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
609 }
610 }
611}
612#[derive(Debug)]
613struct CreateTokenRequestSerializer;
614impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateTokenRequestSerializer {
615 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
616 fn serialize_input(
617 &self,
618 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
619 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
620 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
621 let input = input
622 .downcast::<crate::operation::create_token::CreateTokenInput>()
623 .expect("correct type");
624
625 let protocol = _cfg
626 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
627 .expect("a SharedClientProtocol is required");
628 let mut request = protocol
629 .serialize_request(&input, CreateToken::INPUT_SCHEMA, "", _cfg)
630 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
631
632 return ::std::result::Result::Ok(request);
633 }
634}
635#[derive(Debug)]
636struct CreateTokenEndpointParamsInterceptor;
637
638#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
639impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateTokenEndpointParamsInterceptor {
640 fn name(&self) -> &'static str {
641 "CreateTokenEndpointParamsInterceptor"
642 }
643
644 fn read_before_execution(
645 &self,
646 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
647 '_,
648 ::aws_smithy_runtime_api::client::interceptors::context::Input,
649 ::aws_smithy_runtime_api::client::interceptors::context::Output,
650 ::aws_smithy_runtime_api::client::interceptors::context::Error,
651 >,
652 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
653 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
654 let _input = context
655 .input()
656 .downcast_ref::<CreateTokenInput>()
657 .ok_or("failed to downcast to CreateTokenInput")?;
658
659 let params = crate::config::endpoint::Params::builder()
660 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
661 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
662 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
663 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
664 .build()
665 .map_err(|err| {
666 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
667 })?;
668 cfg.interceptor_state()
669 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
670 ::std::result::Result::Ok(())
671 }
672}
673
674#[non_exhaustive]
679#[derive(::std::fmt::Debug)]
680pub enum CreateTokenError {
681 AccessDeniedException(crate::types::error::AccessDeniedException),
683 AuthorizationPendingException(crate::types::error::AuthorizationPendingException),
685 ExpiredTokenException(crate::types::error::ExpiredTokenException),
687 InternalServerException(crate::types::error::InternalServerException),
689 InvalidClientException(crate::types::error::InvalidClientException),
691 InvalidGrantException(crate::types::error::InvalidGrantException),
693 InvalidRequestException(crate::types::error::InvalidRequestException),
695 InvalidScopeException(crate::types::error::InvalidScopeException),
697 SlowDownException(crate::types::error::SlowDownException),
699 UnauthorizedClientException(crate::types::error::UnauthorizedClientException),
701 UnsupportedGrantTypeException(crate::types::error::UnsupportedGrantTypeException),
703 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
705 variable wildcard pattern and check `.code()`:
706 \
707 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
708 \
709 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateTokenError) for what information is available for the error.")]
710 Unhandled(crate::error::sealed_unhandled::Unhandled),
711}
712impl CreateTokenError {
713 pub fn unhandled(
715 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
716 ) -> Self {
717 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
718 source: err.into(),
719 meta: ::std::default::Default::default(),
720 })
721 }
722
723 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
725 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
726 source: err.clone().into(),
727 meta: err,
728 })
729 }
730 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
735 match self {
736 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
737 Self::AuthorizationPendingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
738 Self::ExpiredTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
739 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
740 Self::InvalidClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
741 Self::InvalidGrantException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
742 Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
743 Self::InvalidScopeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
744 Self::SlowDownException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
745 Self::UnauthorizedClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
746 Self::UnsupportedGrantTypeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
747 Self::Unhandled(e) => &e.meta,
748 }
749 }
750 pub fn is_access_denied_exception(&self) -> bool {
752 matches!(self, Self::AccessDeniedException(_))
753 }
754 pub fn is_authorization_pending_exception(&self) -> bool {
756 matches!(self, Self::AuthorizationPendingException(_))
757 }
758 pub fn is_expired_token_exception(&self) -> bool {
760 matches!(self, Self::ExpiredTokenException(_))
761 }
762 pub fn is_internal_server_exception(&self) -> bool {
764 matches!(self, Self::InternalServerException(_))
765 }
766 pub fn is_invalid_client_exception(&self) -> bool {
768 matches!(self, Self::InvalidClientException(_))
769 }
770 pub fn is_invalid_grant_exception(&self) -> bool {
772 matches!(self, Self::InvalidGrantException(_))
773 }
774 pub fn is_invalid_request_exception(&self) -> bool {
776 matches!(self, Self::InvalidRequestException(_))
777 }
778 pub fn is_invalid_scope_exception(&self) -> bool {
780 matches!(self, Self::InvalidScopeException(_))
781 }
782 pub fn is_slow_down_exception(&self) -> bool {
784 matches!(self, Self::SlowDownException(_))
785 }
786 pub fn is_unauthorized_client_exception(&self) -> bool {
788 matches!(self, Self::UnauthorizedClientException(_))
789 }
790 pub fn is_unsupported_grant_type_exception(&self) -> bool {
792 matches!(self, Self::UnsupportedGrantTypeException(_))
793 }
794}
795impl ::std::error::Error for CreateTokenError {
796 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
797 match self {
798 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
799 Self::AuthorizationPendingException(_inner) => ::std::option::Option::Some(_inner),
800 Self::ExpiredTokenException(_inner) => ::std::option::Option::Some(_inner),
801 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
802 Self::InvalidClientException(_inner) => ::std::option::Option::Some(_inner),
803 Self::InvalidGrantException(_inner) => ::std::option::Option::Some(_inner),
804 Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
805 Self::InvalidScopeException(_inner) => ::std::option::Option::Some(_inner),
806 Self::SlowDownException(_inner) => ::std::option::Option::Some(_inner),
807 Self::UnauthorizedClientException(_inner) => ::std::option::Option::Some(_inner),
808 Self::UnsupportedGrantTypeException(_inner) => ::std::option::Option::Some(_inner),
809 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
810 }
811 }
812}
813impl ::std::fmt::Display for CreateTokenError {
814 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
815 match self {
816 Self::AccessDeniedException(_inner) => _inner.fmt(f),
817 Self::AuthorizationPendingException(_inner) => _inner.fmt(f),
818 Self::ExpiredTokenException(_inner) => _inner.fmt(f),
819 Self::InternalServerException(_inner) => _inner.fmt(f),
820 Self::InvalidClientException(_inner) => _inner.fmt(f),
821 Self::InvalidGrantException(_inner) => _inner.fmt(f),
822 Self::InvalidRequestException(_inner) => _inner.fmt(f),
823 Self::InvalidScopeException(_inner) => _inner.fmt(f),
824 Self::SlowDownException(_inner) => _inner.fmt(f),
825 Self::UnauthorizedClientException(_inner) => _inner.fmt(f),
826 Self::UnsupportedGrantTypeException(_inner) => _inner.fmt(f),
827 Self::Unhandled(_inner) => {
828 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
829 write!(f, "unhandled error ({code})")
830 } else {
831 f.write_str("unhandled error")
832 }
833 }
834 }
835 }
836}
837impl ::aws_smithy_types::retry::ProvideErrorKind for CreateTokenError {
838 fn code(&self) -> ::std::option::Option<&str> {
839 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
840 }
841 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
842 ::std::option::Option::None
843 }
844}
845impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateTokenError {
846 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
847 match self {
848 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
849 Self::AuthorizationPendingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
850 Self::ExpiredTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
851 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
852 Self::InvalidClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
853 Self::InvalidGrantException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
854 Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
855 Self::InvalidScopeException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
856 Self::SlowDownException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
857 Self::UnauthorizedClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
858 Self::UnsupportedGrantTypeException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
859 Self::Unhandled(_inner) => &_inner.meta,
860 }
861 }
862}
863impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateTokenError {
864 fn create_unhandled_error(
865 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
866 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
867 ) -> Self {
868 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
869 source,
870 meta: meta.unwrap_or_default(),
871 })
872 }
873}
874impl ::aws_types::request_id::RequestId for crate::operation::create_token::CreateTokenError {
875 fn request_id(&self) -> Option<&str> {
876 self.meta().request_id()
877 }
878}
879
880pub use crate::operation::create_token::_create_token_input::CreateTokenInput;
881
882pub use crate::operation::create_token::_create_token_output::CreateTokenOutput;
883
884mod _create_token_input;
885
886mod _create_token_output;
887
888pub mod builders;