1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetRoleCredentials;
6impl GetRoleCredentials {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::get_role_credentials::GetRoleCredentialsInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::get_role_credentials::GetRoleCredentialsOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::get_role_credentials::GetRoleCredentialsInput,
18 ) -> ::std::result::Result<crate::operation::get_role_credentials::GetRoleCredentialsOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_role_credentials::GetRoleCredentialsError, ::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::get_role_credentials::GetRoleCredentialsError>().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::get_role_credentials::GetRoleCredentialsOutput>().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::get_role_credentials::GetRoleCredentialsInput,
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",
40 "GetRoleCredentials",
41 input,
42 runtime_plugins,
43 stop_point
44 )
45 .instrument(::tracing::debug_span!(
48 "SSO.GetRoleCredentials",
49 "rpc.service" = "SSO",
50 "rpc.method" = "GetRoleCredentials",
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 GetRoleCredentials {
76 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
77 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetRoleCredentials");
78
79 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(GetRoleCredentialsRequestSerializer));
80 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(GetRoleCredentialsResponseDeserializer));
81
82 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
83 crate::config::auth::Params::builder()
84 .operation_name("GetRoleCredentials")
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 "GetRoleCredentials",
92 "SSO",
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("GetRoleCredentials")
101 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
102.with_interceptor(GetRoleCredentialsEndpointParamsInterceptor)
103 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::get_role_credentials::GetRoleCredentialsError>::new())
104.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::get_role_credentials::GetRoleCredentialsError>::new())
105.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::get_role_credentials::GetRoleCredentialsError>::new());
106
107 ::std::borrow::Cow::Owned(rcb)
108 }
109 }
110
111
112#[derive(Debug)]
113 struct GetRoleCredentialsResponseDeserializer;
114 impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetRoleCredentialsResponseDeserializer {
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::get_role_credentials::GetRoleCredentialsError::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"InvalidRequestException" => crate::operation::get_role_credentials::GetRoleCredentialsError::InvalidRequestException({
139let mut tmp = match protocol.deserialize_response(response, crate::types::error::InvalidRequestException::SCHEMA, _cfg)
140 .and_then(|mut deser| crate::types::error::InvalidRequestException::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"ResourceNotFoundException" => crate::operation::get_role_credentials::GetRoleCredentialsError::ResourceNotFoundException({
152let mut tmp = match protocol.deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
153 .and_then(|mut deser| crate::types::error::ResourceNotFoundException::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"TooManyRequestsException" => crate::operation::get_role_credentials::GetRoleCredentialsError::TooManyRequestsException({
165let mut tmp = match protocol.deserialize_response(response, crate::types::error::TooManyRequestsException::SCHEMA, _cfg)
166 .and_then(|mut deser| crate::types::error::TooManyRequestsException::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"UnauthorizedException" => crate::operation::get_role_credentials::GetRoleCredentialsError::UnauthorizedException({
178let mut tmp = match protocol.deserialize_response(response, crate::types::error::UnauthorizedException::SCHEMA, _cfg)
179 .and_then(|mut deser| crate::types::error::UnauthorizedException::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_ => crate::operation::get_role_credentials::GetRoleCredentialsError::generic(generic)
191};
192 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err)))
193} else {
194 let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
195 .expect("a SharedClientProtocol is required");
196 let mut deser = protocol.deserialize_response(response, GetRoleCredentials::OUTPUT_SCHEMA, _cfg)
197 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
198 let body = response.body().bytes().expect("body loaded");
199 let output = crate::operation::get_role_credentials::GetRoleCredentialsOutput::deserialize_with_response(
200 &mut *deser,
201 response.headers(),
202 response.status().into(),
203 body,
204 ).map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
205 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
206 }
207 }
208 }
209#[derive(Debug)]
210 struct GetRoleCredentialsRequestSerializer;
211 impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetRoleCredentialsRequestSerializer {
212 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
213 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> {
214 let input = input.downcast::<crate::operation::get_role_credentials::GetRoleCredentialsInput>().expect("correct type");
215 let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
216 .expect("a SharedClientProtocol is required");
217 let mut request = protocol.serialize_request(
218 &input, GetRoleCredentials::INPUT_SCHEMA, "", _cfg,
219 ).map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
220
221 return ::std::result::Result::Ok(request);
222 }
223 }
224#[derive(Debug)]
225 struct GetRoleCredentialsEndpointParamsInterceptor;
226
227 impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetRoleCredentialsEndpointParamsInterceptor {
228 fn name(&self) -> &'static str {
229 "GetRoleCredentialsEndpointParamsInterceptor"
230 }
231
232 fn read_before_execution(
233 &self,
234 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>,
235 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
236 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
237 let _input = context.input()
238 .downcast_ref::<GetRoleCredentialsInput>()
239 .ok_or("failed to downcast to GetRoleCredentialsInput")?;
240
241
242
243 let params = crate::config::endpoint::Params::builder()
244 .set_region(cfg.load::<::aws_types::region::Region>().map(|r|r.as_ref().to_owned()))
245.set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
246.set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
247.set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
248 .build()
249 .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?;
250 cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
251 ::std::result::Result::Ok(())
252 }
253 }
254
255 #[non_exhaustive]
262#[derive(::std::fmt::Debug)]
263pub enum GetRoleCredentialsError {
264 InvalidRequestException(crate::types::error::InvalidRequestException),
266 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
268 TooManyRequestsException(crate::types::error::TooManyRequestsException),
270 UnauthorizedException(crate::types::error::UnauthorizedException),
272 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
274 variable wildcard pattern and check `.code()`:
275 \
276 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
277 \
278 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetRoleCredentialsError) for what information is available for the error.")]
279 Unhandled(crate::error::sealed_unhandled::Unhandled),
280}
281impl GetRoleCredentialsError {
282 pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>) -> Self {
284 Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() })
285 }
286
287 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
289 Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err })
290 }
291 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
296 match self {
297 Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
298 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
299 Self::TooManyRequestsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
300 Self::UnauthorizedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
301 Self::Unhandled(e) => &e.meta,
302 }
303 }
304 pub fn is_invalid_request_exception(&self) -> bool {
306 matches!(self, Self::InvalidRequestException(_))
307 }
308 pub fn is_resource_not_found_exception(&self) -> bool {
310 matches!(self, Self::ResourceNotFoundException(_))
311 }
312 pub fn is_too_many_requests_exception(&self) -> bool {
314 matches!(self, Self::TooManyRequestsException(_))
315 }
316 pub fn is_unauthorized_exception(&self) -> bool {
318 matches!(self, Self::UnauthorizedException(_))
319 }
320}
321impl ::std::error::Error for GetRoleCredentialsError {
322 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
323 match self {
324 Self::InvalidRequestException(_inner) =>
325 ::std::option::Option::Some(_inner)
326 ,
327 Self::ResourceNotFoundException(_inner) =>
328 ::std::option::Option::Some(_inner)
329 ,
330 Self::TooManyRequestsException(_inner) =>
331 ::std::option::Option::Some(_inner)
332 ,
333 Self::UnauthorizedException(_inner) =>
334 ::std::option::Option::Some(_inner)
335 ,
336 Self::Unhandled(_inner) => {
337 ::std::option::Option::Some(&*_inner.source)
338 }
339 }
340 }
341}
342impl ::std::fmt::Display for GetRoleCredentialsError {
343 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
344 match self {
345 Self::InvalidRequestException(_inner) =>
346 _inner.fmt(f)
347 ,
348 Self::ResourceNotFoundException(_inner) =>
349 _inner.fmt(f)
350 ,
351 Self::TooManyRequestsException(_inner) =>
352 _inner.fmt(f)
353 ,
354 Self::UnauthorizedException(_inner) =>
355 _inner.fmt(f)
356 ,
357 Self::Unhandled(_inner) => {
358 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
359 write!(f, "unhandled error ({code})")
360 } else {
361 f.write_str("unhandled error")
362 }
363 }
364 }
365 }
366}
367impl ::aws_smithy_types::retry::ProvideErrorKind for GetRoleCredentialsError {
368 fn code(&self) -> ::std::option::Option<&str> {
369 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
370 }
371 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
372 ::std::option::Option::None
373 }
374}
375impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetRoleCredentialsError {
376 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
377 match self {
378 Self::InvalidRequestException(_inner) =>
379 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
380 ,
381 Self::ResourceNotFoundException(_inner) =>
382 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
383 ,
384 Self::TooManyRequestsException(_inner) =>
385 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
386 ,
387 Self::UnauthorizedException(_inner) =>
388 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
389 ,
390 Self::Unhandled(_inner) => {
391 &_inner.meta
392 }
393 }
394 }
395}
396impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetRoleCredentialsError {
397 fn create_unhandled_error(
398 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
399 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>
400 ) -> Self {
401 Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() })
402 }
403}
404impl ::aws_types::request_id::RequestId for crate::operation::get_role_credentials::GetRoleCredentialsError {
405 fn request_id(&self) -> Option<&str> {
406 self.meta().request_id()
407 }
408 }
409
410pub use crate::operation::get_role_credentials::_get_role_credentials_input::GetRoleCredentialsInput;
411
412pub use crate::operation::get_role_credentials::_get_role_credentials_output::GetRoleCredentialsOutput;
413
414mod _get_role_credentials_input;
415
416mod _get_role_credentials_output;
417
418pub mod builders;
420