aws_sdk_workdocs/operation/
describe_users.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct DescribeUsers;
6impl DescribeUsers {
7 pub fn new() -> Self {
9 Self
10 }
11 pub(crate) async fn orchestrate(
12 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13 input: crate::operation::describe_users::DescribeUsersInput,
14 ) -> ::std::result::Result<
15 crate::operation::describe_users::DescribeUsersOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::describe_users::DescribeUsersError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22 ::aws_smithy_runtime_api::client::interceptors::context::Error,
23 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24 >| {
25 err.map_service_error(|err| {
26 err.downcast::<crate::operation::describe_users::DescribeUsersError>()
27 .expect("correct error type")
28 })
29 };
30 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31 .await
32 .map_err(map_err)?;
33 let output = context.finalize().map_err(map_err)?;
34 ::std::result::Result::Ok(
35 output
36 .downcast::<crate::operation::describe_users::DescribeUsersOutput>()
37 .expect("correct output type"),
38 )
39 }
40
41 pub(crate) async fn orchestrate_with_stop_point(
42 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43 input: crate::operation::describe_users::DescribeUsersInput,
44 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45 ) -> ::std::result::Result<
46 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47 ::aws_smithy_runtime_api::client::result::SdkError<
48 ::aws_smithy_runtime_api::client::interceptors::context::Error,
49 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50 >,
51 > {
52 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("workdocs", "DescribeUsers", input, runtime_plugins, stop_point).await
54 }
55
56 pub(crate) fn operation_runtime_plugins(
57 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
58 client_config: &crate::config::Config,
59 config_override: ::std::option::Option<crate::config::Builder>,
60 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
61 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
62 runtime_plugins = runtime_plugins.with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
63 ::aws_runtime::auth::sigv4::SCHEME_ID,
64 ]));
65 if let ::std::option::Option::Some(config_override) = config_override {
66 for plugin in config_override.runtime_plugins.iter().cloned() {
67 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
68 }
69 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
70 config_override,
71 client_config.config.clone(),
72 &client_config.runtime_components,
73 ));
74 }
75 runtime_plugins
76 }
77}
78impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for DescribeUsers {
79 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
80 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("DescribeUsers");
81
82 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
83 DescribeUsersRequestSerializer,
84 ));
85 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
86 DescribeUsersResponseDeserializer,
87 ));
88
89 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
90 ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
91 ));
92
93 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
94 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("DescribeUsers", "workdocs"));
95 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
96 signing_options.double_uri_encode = true;
97 signing_options.content_sha256_header = false;
98 signing_options.normalize_uri_path = true;
99 signing_options.payload_override = None;
100
101 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
102 signing_options,
103 ..::std::default::Default::default()
104 });
105
106 ::std::option::Option::Some(cfg.freeze())
107 }
108
109 fn runtime_components(
110 &self,
111 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
112 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
113 #[allow(unused_mut)]
114 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("DescribeUsers")
115 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
116 .with_interceptor(DescribeUsersEndpointParamsInterceptor)
117 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
118 crate::operation::describe_users::DescribeUsersError,
119 >::new())
120 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
121 crate::operation::describe_users::DescribeUsersError,
122 >::new())
123 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
124 crate::operation::describe_users::DescribeUsersError,
125 >::new());
126
127 ::std::borrow::Cow::Owned(rcb)
128 }
129}
130
131#[derive(Debug)]
132struct DescribeUsersResponseDeserializer;
133impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DescribeUsersResponseDeserializer {
134 fn deserialize_nonstreaming(
135 &self,
136 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
137 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
138 let (success, status) = (response.status().is_success(), response.status().as_u16());
139 let headers = response.headers();
140 let body = response.body().bytes().expect("body loaded");
141 #[allow(unused_mut)]
142 let mut force_error = false;
143 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
144 let parse_result = if !success && status != 200 || force_error {
145 crate::protocol_serde::shape_describe_users::de_describe_users_http_error(status, headers, body)
146 } else {
147 crate::protocol_serde::shape_describe_users::de_describe_users_http_response(status, headers, body)
148 };
149 crate::protocol_serde::type_erase_result(parse_result)
150 }
151}
152#[derive(Debug)]
153struct DescribeUsersRequestSerializer;
154impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DescribeUsersRequestSerializer {
155 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
156 fn serialize_input(
157 &self,
158 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
159 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
160 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
161 let input = input
162 .downcast::<crate::operation::describe_users::DescribeUsersInput>()
163 .expect("correct type");
164 let _header_serialization_settings = _cfg
165 .load::<crate::serialization_settings::HeaderSerializationSettings>()
166 .cloned()
167 .unwrap_or_default();
168 let mut request_builder = {
169 fn uri_base(
170 _input: &crate::operation::describe_users::DescribeUsersInput,
171 output: &mut ::std::string::String,
172 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
173 use ::std::fmt::Write as _;
174 ::std::write!(output, "/api/v1/users").expect("formatting should succeed");
175 ::std::result::Result::Ok(())
176 }
177 fn uri_query(
178 _input: &crate::operation::describe_users::DescribeUsersInput,
179 mut output: &mut ::std::string::String,
180 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
181 let mut query = ::aws_smithy_http::query::Writer::new(output);
182 if let ::std::option::Option::Some(inner_1) = &_input.organization_id {
183 {
184 query.push_kv("organizationId", &::aws_smithy_http::query::fmt_string(inner_1));
185 }
186 }
187 if let ::std::option::Option::Some(inner_2) = &_input.user_ids {
188 {
189 query.push_kv("userIds", &::aws_smithy_http::query::fmt_string(inner_2));
190 }
191 }
192 if let ::std::option::Option::Some(inner_3) = &_input.query {
193 {
194 query.push_kv("query", &::aws_smithy_http::query::fmt_string(inner_3));
195 }
196 }
197 if let ::std::option::Option::Some(inner_4) = &_input.include {
198 {
199 query.push_kv("include", &::aws_smithy_http::query::fmt_string(inner_4));
200 }
201 }
202 if let ::std::option::Option::Some(inner_5) = &_input.order {
203 {
204 query.push_kv("order", &::aws_smithy_http::query::fmt_string(inner_5));
205 }
206 }
207 if let ::std::option::Option::Some(inner_6) = &_input.sort {
208 {
209 query.push_kv("sort", &::aws_smithy_http::query::fmt_string(inner_6));
210 }
211 }
212 if let ::std::option::Option::Some(inner_7) = &_input.marker {
213 {
214 query.push_kv("marker", &::aws_smithy_http::query::fmt_string(inner_7));
215 }
216 }
217 if let ::std::option::Option::Some(inner_8) = &_input.limit {
218 {
219 query.push_kv("limit", ::aws_smithy_types::primitive::Encoder::from(*inner_8).encode());
220 }
221 }
222 if let ::std::option::Option::Some(inner_9) = &_input.fields {
223 {
224 query.push_kv("fields", &::aws_smithy_http::query::fmt_string(inner_9));
225 }
226 }
227 ::std::result::Result::Ok(())
228 }
229 #[allow(clippy::unnecessary_wraps)]
230 fn update_http_builder(
231 input: &crate::operation::describe_users::DescribeUsersInput,
232 builder: ::http::request::Builder,
233 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
234 let mut uri = ::std::string::String::new();
235 uri_base(input, &mut uri)?;
236 uri_query(input, &mut uri)?;
237 let builder = crate::protocol_serde::shape_describe_users::ser_describe_users_headers(input, builder)?;
238 ::std::result::Result::Ok(builder.method("GET").uri(uri))
239 }
240 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
241 builder
242 };
243 let body = ::aws_smithy_types::body::SdkBody::from("");
244
245 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
246 }
247}
248#[derive(Debug)]
249struct DescribeUsersEndpointParamsInterceptor;
250
251impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DescribeUsersEndpointParamsInterceptor {
252 fn name(&self) -> &'static str {
253 "DescribeUsersEndpointParamsInterceptor"
254 }
255
256 fn read_before_execution(
257 &self,
258 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
259 '_,
260 ::aws_smithy_runtime_api::client::interceptors::context::Input,
261 ::aws_smithy_runtime_api::client::interceptors::context::Output,
262 ::aws_smithy_runtime_api::client::interceptors::context::Error,
263 >,
264 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
265 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
266 let _input = context
267 .input()
268 .downcast_ref::<DescribeUsersInput>()
269 .ok_or("failed to downcast to DescribeUsersInput")?;
270
271 let params = crate::config::endpoint::Params::builder()
272 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
273 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
274 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
275 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
276 .build()
277 .map_err(|err| {
278 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
279 })?;
280 cfg.interceptor_state()
281 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
282 ::std::result::Result::Ok(())
283 }
284}
285
286#[non_exhaustive]
291#[derive(::std::fmt::Debug)]
292pub enum DescribeUsersError {
293 EntityNotExistsException(crate::types::error::EntityNotExistsException),
295 FailedDependencyException(crate::types::error::FailedDependencyException),
297 InvalidArgumentException(crate::types::error::InvalidArgumentException),
299 RequestedEntityTooLargeException(crate::types::error::RequestedEntityTooLargeException),
301 ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
303 UnauthorizedOperationException(crate::types::error::UnauthorizedOperationException),
305 UnauthorizedResourceAccessException(crate::types::error::UnauthorizedResourceAccessException),
307 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
309 variable wildcard pattern and check `.code()`:
310 \
311 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
312 \
313 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DescribeUsersError) for what information is available for the error.")]
314 Unhandled(crate::error::sealed_unhandled::Unhandled),
315}
316impl DescribeUsersError {
317 pub fn unhandled(
319 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
320 ) -> Self {
321 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
322 source: err.into(),
323 meta: ::std::default::Default::default(),
324 })
325 }
326
327 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
329 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
330 source: err.clone().into(),
331 meta: err,
332 })
333 }
334 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
339 match self {
340 Self::EntityNotExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
341 Self::FailedDependencyException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
342 Self::InvalidArgumentException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
343 Self::RequestedEntityTooLargeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
344 Self::ServiceUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
345 Self::UnauthorizedOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
346 Self::UnauthorizedResourceAccessException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
347 Self::Unhandled(e) => &e.meta,
348 }
349 }
350 pub fn is_entity_not_exists_exception(&self) -> bool {
352 matches!(self, Self::EntityNotExistsException(_))
353 }
354 pub fn is_failed_dependency_exception(&self) -> bool {
356 matches!(self, Self::FailedDependencyException(_))
357 }
358 pub fn is_invalid_argument_exception(&self) -> bool {
360 matches!(self, Self::InvalidArgumentException(_))
361 }
362 pub fn is_requested_entity_too_large_exception(&self) -> bool {
364 matches!(self, Self::RequestedEntityTooLargeException(_))
365 }
366 pub fn is_service_unavailable_exception(&self) -> bool {
368 matches!(self, Self::ServiceUnavailableException(_))
369 }
370 pub fn is_unauthorized_operation_exception(&self) -> bool {
372 matches!(self, Self::UnauthorizedOperationException(_))
373 }
374 pub fn is_unauthorized_resource_access_exception(&self) -> bool {
376 matches!(self, Self::UnauthorizedResourceAccessException(_))
377 }
378}
379impl ::std::error::Error for DescribeUsersError {
380 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
381 match self {
382 Self::EntityNotExistsException(_inner) => ::std::option::Option::Some(_inner),
383 Self::FailedDependencyException(_inner) => ::std::option::Option::Some(_inner),
384 Self::InvalidArgumentException(_inner) => ::std::option::Option::Some(_inner),
385 Self::RequestedEntityTooLargeException(_inner) => ::std::option::Option::Some(_inner),
386 Self::ServiceUnavailableException(_inner) => ::std::option::Option::Some(_inner),
387 Self::UnauthorizedOperationException(_inner) => ::std::option::Option::Some(_inner),
388 Self::UnauthorizedResourceAccessException(_inner) => ::std::option::Option::Some(_inner),
389 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
390 }
391 }
392}
393impl ::std::fmt::Display for DescribeUsersError {
394 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
395 match self {
396 Self::EntityNotExistsException(_inner) => _inner.fmt(f),
397 Self::FailedDependencyException(_inner) => _inner.fmt(f),
398 Self::InvalidArgumentException(_inner) => _inner.fmt(f),
399 Self::RequestedEntityTooLargeException(_inner) => _inner.fmt(f),
400 Self::ServiceUnavailableException(_inner) => _inner.fmt(f),
401 Self::UnauthorizedOperationException(_inner) => _inner.fmt(f),
402 Self::UnauthorizedResourceAccessException(_inner) => _inner.fmt(f),
403 Self::Unhandled(_inner) => {
404 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
405 write!(f, "unhandled error ({code})")
406 } else {
407 f.write_str("unhandled error")
408 }
409 }
410 }
411 }
412}
413impl ::aws_smithy_types::retry::ProvideErrorKind for DescribeUsersError {
414 fn code(&self) -> ::std::option::Option<&str> {
415 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
416 }
417 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
418 ::std::option::Option::None
419 }
420}
421impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DescribeUsersError {
422 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
423 match self {
424 Self::EntityNotExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
425 Self::FailedDependencyException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
426 Self::InvalidArgumentException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
427 Self::RequestedEntityTooLargeException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
428 Self::ServiceUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
429 Self::UnauthorizedOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
430 Self::UnauthorizedResourceAccessException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
431 Self::Unhandled(_inner) => &_inner.meta,
432 }
433 }
434}
435impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DescribeUsersError {
436 fn create_unhandled_error(
437 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
438 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
439 ) -> Self {
440 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
441 source,
442 meta: meta.unwrap_or_default(),
443 })
444 }
445}
446impl ::aws_types::request_id::RequestId for crate::operation::describe_users::DescribeUsersError {
447 fn request_id(&self) -> Option<&str> {
448 self.meta().request_id()
449 }
450}
451
452pub use crate::operation::describe_users::_describe_users_output::DescribeUsersOutput;
453
454pub use crate::operation::describe_users::_describe_users_input::DescribeUsersInput;
455
456mod _describe_users_input;
457
458mod _describe_users_output;
459
460pub mod builders;
462
463pub mod paginator;