1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct ListAccountRoles;
6impl ListAccountRoles {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::list_account_roles::ListAccountRolesInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::list_account_roles::ListAccountRolesOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::list_account_roles::ListAccountRolesInput,
18 ) -> ::std::result::Result<crate::operation::list_account_roles::ListAccountRolesOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_account_roles::ListAccountRolesError, ::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::list_account_roles::ListAccountRolesError>().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::list_account_roles::ListAccountRolesOutput>().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::list_account_roles::ListAccountRolesInput,
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 "ListAccountRoles",
41 input,
42 runtime_plugins,
43 stop_point
44 )
45 .instrument(::tracing::debug_span!(
48 "SSO.ListAccountRoles",
49 "rpc.service" = "SSO",
50 "rpc.method" = "ListAccountRoles",
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 ListAccountRoles {
76 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
77 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListAccountRoles");
78
79 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(ListAccountRolesRequestSerializer));
80 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(ListAccountRolesResponseDeserializer));
81
82 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
83 crate::config::auth::Params::builder()
84 .operation_name("ListAccountRoles")
85 .build()
86 .expect("required fields set")
87 ));
88
89 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
90 "ListAccountRoles",
91 "SSO",
92 ));
93
94 ::std::option::Option::Some(cfg.freeze())
95 }
96
97 fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
98 #[allow(unused_mut)]
99 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListAccountRoles")
100 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
101.with_interceptor(ListAccountRolesEndpointParamsInterceptor)
102 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::list_account_roles::ListAccountRolesError>::new())
103.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::list_account_roles::ListAccountRolesError>::new())
104.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::list_account_roles::ListAccountRolesError>::new());
105
106 ::std::borrow::Cow::Owned(rcb)
107 }
108 }
109
110
111#[derive(Debug)]
112 struct ListAccountRolesResponseDeserializer;
113 impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListAccountRolesResponseDeserializer {
114
115
116 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 {
117 let (success, status) = (response.status().is_success(), response.status().as_u16());
118 #[allow(unused_mut)]
119 let mut force_error = false;
120 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
121 if !success && status != 200 || force_error {
122 let headers = response.headers();
123 let body = response.body().bytes().expect("body loaded");
124#[allow(unused_mut)]
125 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body)
126 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
127 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
128 let generic = generic_builder.build();
129let error_code = match generic.code() {
130 ::std::option::Option::Some(code) => code,
131 ::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::list_account_roles::ListAccountRolesError::unhandled(generic)))),
132 };
133 let _error_message = generic.message().map(|msg| msg.to_owned());
134 let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
135 .expect("a SharedClientProtocol is required");
136let err = match error_code {
137"InvalidRequestException" => crate::operation::list_account_roles::ListAccountRolesError::InvalidRequestException({
138let mut tmp = match protocol.deserialize_response(response, crate::types::error::InvalidRequestException::SCHEMA, _cfg)
139 .and_then(|mut deser| crate::types::error::InvalidRequestException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
140 {
141 ::std::result::Result::Ok(val) => val,
142 ::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))),
143 };
144 tmp.meta = generic;
145if tmp.message.is_none() {
146 tmp.message = _error_message;
147 }
148tmp
149}),
150"ResourceNotFoundException" => crate::operation::list_account_roles::ListAccountRolesError::ResourceNotFoundException({
151let mut tmp = match protocol.deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
152 .and_then(|mut deser| crate::types::error::ResourceNotFoundException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
153 {
154 ::std::result::Result::Ok(val) => val,
155 ::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))),
156 };
157 tmp.meta = generic;
158if tmp.message.is_none() {
159 tmp.message = _error_message;
160 }
161tmp
162}),
163"TooManyRequestsException" => crate::operation::list_account_roles::ListAccountRolesError::TooManyRequestsException({
164let mut tmp = match protocol.deserialize_response(response, crate::types::error::TooManyRequestsException::SCHEMA, _cfg)
165 .and_then(|mut deser| crate::types::error::TooManyRequestsException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
166 {
167 ::std::result::Result::Ok(val) => val,
168 ::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))),
169 };
170 tmp.meta = generic;
171if tmp.message.is_none() {
172 tmp.message = _error_message;
173 }
174tmp
175}),
176"UnauthorizedException" => crate::operation::list_account_roles::ListAccountRolesError::UnauthorizedException({
177let mut tmp = match protocol.deserialize_response(response, crate::types::error::UnauthorizedException::SCHEMA, _cfg)
178 .and_then(|mut deser| crate::types::error::UnauthorizedException::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body))
179 {
180 ::std::result::Result::Ok(val) => val,
181 ::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))),
182 };
183 tmp.meta = generic;
184if tmp.message.is_none() {
185 tmp.message = _error_message;
186 }
187tmp
188}),
189_ => crate::operation::list_account_roles::ListAccountRolesError::generic(generic)
190};
191 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err)))
192} else {
193 let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
194 .expect("a SharedClientProtocol is required");
195 let mut deser = protocol.deserialize_response(response, ListAccountRoles::OUTPUT_SCHEMA, _cfg)
196 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
197 let body = response.body().bytes().expect("body loaded");
198 let output = crate::operation::list_account_roles::ListAccountRolesOutput::deserialize_with_response(
199 &mut *deser,
200 response.headers(),
201 response.status().into(),
202 body,
203 ).map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
204 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
205 }
206 }
207 }
208#[derive(Debug)]
209 struct ListAccountRolesRequestSerializer;
210 impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListAccountRolesRequestSerializer {
211 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
212 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> {
213 let input = input.downcast::<crate::operation::list_account_roles::ListAccountRolesInput>().expect("correct type");
214 let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
215 .expect("a SharedClientProtocol is required");
216 let mut request = protocol.serialize_request(
217 &input, ListAccountRoles::INPUT_SCHEMA, "", _cfg,
218 ).map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
219
220 return ::std::result::Result::Ok(request);
221 }
222 }
223#[derive(Debug)]
224 struct ListAccountRolesEndpointParamsInterceptor;
225
226 impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListAccountRolesEndpointParamsInterceptor {
227 fn name(&self) -> &'static str {
228 "ListAccountRolesEndpointParamsInterceptor"
229 }
230
231 fn read_before_execution(
232 &self,
233 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>,
234 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
235 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
236 let _input = context.input()
237 .downcast_ref::<ListAccountRolesInput>()
238 .ok_or("failed to downcast to ListAccountRolesInput")?;
239
240
241
242 let params = crate::config::endpoint::Params::builder()
243 .set_region(cfg.load::<::aws_types::region::Region>().map(|r|r.as_ref().to_owned()))
244.set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
245.set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
246.set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
247 .build()
248 .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?;
249 cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
250 ::std::result::Result::Ok(())
251 }
252 }
253
254 #[non_exhaustive]
261#[derive(::std::fmt::Debug)]
262pub enum ListAccountRolesError {
263 InvalidRequestException(crate::types::error::InvalidRequestException),
265 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
267 TooManyRequestsException(crate::types::error::TooManyRequestsException),
269 UnauthorizedException(crate::types::error::UnauthorizedException),
271 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
273 variable wildcard pattern and check `.code()`:
274 \
275 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
276 \
277 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListAccountRolesError) for what information is available for the error.")]
278 Unhandled(crate::error::sealed_unhandled::Unhandled),
279}
280impl ListAccountRolesError {
281 pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>) -> Self {
283 Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() })
284 }
285
286 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
288 Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err })
289 }
290 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
295 match self {
296 Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
297 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
298 Self::TooManyRequestsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
299 Self::UnauthorizedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
300 Self::Unhandled(e) => &e.meta,
301 }
302 }
303 pub fn is_invalid_request_exception(&self) -> bool {
305 matches!(self, Self::InvalidRequestException(_))
306 }
307 pub fn is_resource_not_found_exception(&self) -> bool {
309 matches!(self, Self::ResourceNotFoundException(_))
310 }
311 pub fn is_too_many_requests_exception(&self) -> bool {
313 matches!(self, Self::TooManyRequestsException(_))
314 }
315 pub fn is_unauthorized_exception(&self) -> bool {
317 matches!(self, Self::UnauthorizedException(_))
318 }
319}
320impl ::std::error::Error for ListAccountRolesError {
321 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
322 match self {
323 Self::InvalidRequestException(_inner) =>
324 ::std::option::Option::Some(_inner)
325 ,
326 Self::ResourceNotFoundException(_inner) =>
327 ::std::option::Option::Some(_inner)
328 ,
329 Self::TooManyRequestsException(_inner) =>
330 ::std::option::Option::Some(_inner)
331 ,
332 Self::UnauthorizedException(_inner) =>
333 ::std::option::Option::Some(_inner)
334 ,
335 Self::Unhandled(_inner) => {
336 ::std::option::Option::Some(&*_inner.source)
337 }
338 }
339 }
340}
341impl ::std::fmt::Display for ListAccountRolesError {
342 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
343 match self {
344 Self::InvalidRequestException(_inner) =>
345 _inner.fmt(f)
346 ,
347 Self::ResourceNotFoundException(_inner) =>
348 _inner.fmt(f)
349 ,
350 Self::TooManyRequestsException(_inner) =>
351 _inner.fmt(f)
352 ,
353 Self::UnauthorizedException(_inner) =>
354 _inner.fmt(f)
355 ,
356 Self::Unhandled(_inner) => {
357 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
358 write!(f, "unhandled error ({code})")
359 } else {
360 f.write_str("unhandled error")
361 }
362 }
363 }
364 }
365}
366impl ::aws_smithy_types::retry::ProvideErrorKind for ListAccountRolesError {
367 fn code(&self) -> ::std::option::Option<&str> {
368 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
369 }
370 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
371 ::std::option::Option::None
372 }
373}
374impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListAccountRolesError {
375 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
376 match self {
377 Self::InvalidRequestException(_inner) =>
378 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
379 ,
380 Self::ResourceNotFoundException(_inner) =>
381 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
382 ,
383 Self::TooManyRequestsException(_inner) =>
384 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
385 ,
386 Self::UnauthorizedException(_inner) =>
387 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner)
388 ,
389 Self::Unhandled(_inner) => {
390 &_inner.meta
391 }
392 }
393 }
394}
395impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListAccountRolesError {
396 fn create_unhandled_error(
397 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
398 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>
399 ) -> Self {
400 Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() })
401 }
402}
403impl ::aws_types::request_id::RequestId for crate::operation::list_account_roles::ListAccountRolesError {
404 fn request_id(&self) -> Option<&str> {
405 self.meta().request_id()
406 }
407 }
408
409pub use crate::operation::list_account_roles::_list_account_roles_input::ListAccountRolesInput;
410
411pub use crate::operation::list_account_roles::_list_account_roles_output::ListAccountRolesOutput;
412
413mod _list_account_roles_input;
414
415mod _list_account_roles_output;
416
417pub mod builders;
419
420pub mod paginator;
422