1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetUser;
6impl GetUser {
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::get_user::GetUserInput,
14 ) -> ::std::result::Result<
15 crate::operation::get_user::GetUserOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::get_user::GetUserError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err =
22 |err: ::aws_smithy_runtime_api::client::result::SdkError<
23 ::aws_smithy_runtime_api::client::interceptors::context::Error,
24 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
25 >| { err.map_service_error(|err| err.downcast::<crate::operation::get_user::GetUserError>().expect("correct error type")) };
26 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
27 .await
28 .map_err(map_err)?;
29 let output = context.finalize().map_err(map_err)?;
30 ::std::result::Result::Ok(
31 output
32 .downcast::<crate::operation::get_user::GetUserOutput>()
33 .expect("correct output type"),
34 )
35 }
36
37 pub(crate) async fn orchestrate_with_stop_point(
38 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
39 input: crate::operation::get_user::GetUserInput,
40 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
41 ) -> ::std::result::Result<
42 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
43 ::aws_smithy_runtime_api::client::result::SdkError<
44 ::aws_smithy_runtime_api::client::interceptors::context::Error,
45 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
46 >,
47 > {
48 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
49 use ::tracing::Instrument;
50 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("Chime", "GetUser", input, runtime_plugins, stop_point)
51 .instrument(::tracing::debug_span!(
54 "Chime.GetUser",
55 "rpc.service" = "Chime",
56 "rpc.method" = "GetUser",
57 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
58 "rpc.system" = "aws-api",
59 ))
60 .await
61 }
62
63 pub(crate) fn operation_runtime_plugins(
64 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
65 client_config: &crate::config::Config,
66 config_override: ::std::option::Option<crate::config::Builder>,
67 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
68 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
69
70 if let ::std::option::Option::Some(config_override) = config_override {
71 for plugin in config_override.runtime_plugins.iter().cloned() {
72 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
73 }
74 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
75 config_override,
76 client_config.config.clone(),
77 &client_config.runtime_components,
78 ));
79 }
80 runtime_plugins
81 }
82}
83impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetUser {
84 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
85 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetUser");
86
87 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
88 GetUserRequestSerializer,
89 ));
90 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
91 GetUserResponseDeserializer,
92 ));
93
94 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
95 crate::config::auth::Params::builder()
96 .operation_name("GetUser")
97 .build()
98 .expect("required fields set"),
99 ));
100
101 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
102 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("GetUser", "Chime"));
103 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
104 signing_options.double_uri_encode = true;
105 signing_options.content_sha256_header = false;
106 signing_options.normalize_uri_path = true;
107 signing_options.payload_override = None;
108
109 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
110 signing_options,
111 ..::std::default::Default::default()
112 });
113
114 ::std::option::Option::Some(cfg.freeze())
115 }
116
117 fn runtime_components(
118 &self,
119 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
120 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
121 #[allow(unused_mut)]
122 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetUser")
123 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
124 GetUserTelemetryInputCaptureInterceptor,
125 ))
126 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
127 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
128 ))
129 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
130 GetUserEndpointParamsInterceptor,
131 ))
132 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
133 crate::operation::get_user::GetUserError,
134 >::new())
135 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
136 crate::operation::get_user::GetUserError,
137 >::new())
138 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
139 crate::operation::get_user::GetUserError,
140 >::new());
141
142 ::std::borrow::Cow::Owned(rcb)
143 }
144}
145
146#[derive(Debug)]
147struct GetUserTelemetryInputCaptureInterceptor;
148
149#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
150impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetUserTelemetryInputCaptureInterceptor {
151 fn name(&self) -> &'static str {
152 "GetUserTelemetryInputCaptureInterceptor"
153 }
154
155 fn read_before_execution(
156 &self,
157 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
158 '_,
159 ::aws_smithy_runtime_api::client::interceptors::context::Input,
160 ::aws_smithy_runtime_api::client::interceptors::context::Output,
161 ::aws_smithy_runtime_api::client::interceptors::context::Error,
162 >,
163 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
164 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
165 let ::std::option::Option::Some(requested) = cfg
167 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
168 .filter(|r| !r.is_empty())
169 else {
170 return ::std::result::Result::Ok(());
171 };
172
173 let ::std::option::Option::Some(input) = context.input().downcast_ref::<GetUserInput>() else {
174 return ::std::result::Result::Ok(());
176 };
177
178 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
179 if requested.should_capture("AccountId") {
180 if let ::std::option::Option::Some(value) = input.account_id.as_deref() {
181 captured.insert("AccountId", value);
182 }
183 }
184 if requested.should_capture("UserId") {
185 if let ::std::option::Option::Some(value) = input.user_id.as_deref() {
186 captured.insert("UserId", value);
187 }
188 }
189
190 cfg.interceptor_state().store_put(captured);
191 ::std::result::Result::Ok(())
192 }
193}
194#[derive(Debug)]
195struct GetUserResponseDeserializer;
196impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetUserResponseDeserializer {
197 fn deserialize_nonstreaming_with_config(
198 &self,
199 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
200 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
201 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
202 let (success, status) = (response.status().is_success(), response.status().as_u16());
203 let headers = response.headers();
204 let body = response.body().bytes().expect("body loaded");
205 #[allow(unused_mut)]
206 let mut force_error = false;
207 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
208 let parse_result = if !success && status != 200 || force_error {
209 crate::protocol_serde::shape_get_user::de_get_user_http_error(status, headers, body)
210 } else {
211 crate::protocol_serde::shape_get_user::de_get_user_http_response(status, headers, body)
212 };
213 crate::protocol_serde::type_erase_result(parse_result)
214 }
215}
216#[derive(Debug)]
217struct GetUserRequestSerializer;
218impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetUserRequestSerializer {
219 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
220 fn serialize_input(
221 &self,
222 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
223 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
224 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
225 let input = input.downcast::<crate::operation::get_user::GetUserInput>().expect("correct type");
226 let _header_serialization_settings = _cfg
227 .load::<crate::serialization_settings::HeaderSerializationSettings>()
228 .cloned()
229 .unwrap_or_default();
230 let mut request_builder = {
231 #[allow(clippy::uninlined_format_args)]
232 fn uri_base(
233 _input: &crate::operation::get_user::GetUserInput,
234 output: &mut ::std::string::String,
235 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
236 use ::std::fmt::Write as _;
237 let input_1 = &_input.account_id;
238 let input_1 = input_1
239 .as_ref()
240 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("account_id", "cannot be empty or unset"))?;
241 let account_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
242 if account_id.is_empty() {
243 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
244 "account_id",
245 "cannot be empty or unset",
246 ));
247 }
248 let input_2 = &_input.user_id;
249 let input_2 = input_2
250 .as_ref()
251 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("user_id", "cannot be empty or unset"))?;
252 let user_id = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
253 if user_id.is_empty() {
254 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
255 "user_id",
256 "cannot be empty or unset",
257 ));
258 }
259 ::std::write!(output, "/accounts/{AccountId}/users/{UserId}", AccountId = account_id, UserId = user_id)
260 .expect("formatting should succeed");
261 ::std::result::Result::Ok(())
262 }
263 #[allow(clippy::unnecessary_wraps)]
264 fn update_http_builder(
265 input: &crate::operation::get_user::GetUserInput,
266 builder: ::http_1x::request::Builder,
267 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
268 let mut uri = ::std::string::String::new();
269 uri_base(input, &mut uri)?;
270 ::std::result::Result::Ok(builder.method("GET").uri(uri))
271 }
272 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
273 builder
274 };
275 let body = ::aws_smithy_types::body::SdkBody::from("");
276
277 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
278 }
279}
280#[derive(Debug)]
281struct GetUserEndpointParamsInterceptor;
282
283#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
284impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetUserEndpointParamsInterceptor {
285 fn name(&self) -> &'static str {
286 "GetUserEndpointParamsInterceptor"
287 }
288
289 fn read_before_execution(
290 &self,
291 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
292 '_,
293 ::aws_smithy_runtime_api::client::interceptors::context::Input,
294 ::aws_smithy_runtime_api::client::interceptors::context::Output,
295 ::aws_smithy_runtime_api::client::interceptors::context::Error,
296 >,
297 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
298 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
299 let _input = context
300 .input()
301 .downcast_ref::<GetUserInput>()
302 .ok_or("failed to downcast to GetUserInput")?;
303
304 let params = crate::config::endpoint::Params::builder()
305 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
306 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
307 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
308 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
309 .build()
310 .map_err(|err| {
311 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
312 })?;
313 cfg.interceptor_state()
314 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
315 ::std::result::Result::Ok(())
316 }
317}
318
319#[non_exhaustive]
324#[derive(::std::fmt::Debug)]
325pub enum GetUserError {
326 BadRequestException(crate::types::error::BadRequestException),
328 ForbiddenException(crate::types::error::ForbiddenException),
330 NotFoundException(crate::types::error::NotFoundException),
332 ServiceFailureException(crate::types::error::ServiceFailureException),
334 ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
336 ThrottledClientException(crate::types::error::ThrottledClientException),
338 UnauthorizedClientException(crate::types::error::UnauthorizedClientException),
340 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
342 variable wildcard pattern and check `.code()`:
343 \
344 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
345 \
346 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetUserError) for what information is available for the error.")]
347 Unhandled(crate::error::sealed_unhandled::Unhandled),
348}
349impl GetUserError {
350 pub fn unhandled(
352 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
353 ) -> Self {
354 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
355 source: err.into(),
356 meta: ::std::default::Default::default(),
357 })
358 }
359
360 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
362 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
363 source: err.clone().into(),
364 meta: err,
365 })
366 }
367 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
372 match self {
373 Self::BadRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
374 Self::ForbiddenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
375 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
376 Self::ServiceFailureException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
377 Self::ServiceUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
378 Self::ThrottledClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
379 Self::UnauthorizedClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
380 Self::Unhandled(e) => &e.meta,
381 }
382 }
383 pub fn is_bad_request_exception(&self) -> bool {
385 matches!(self, Self::BadRequestException(_))
386 }
387 pub fn is_forbidden_exception(&self) -> bool {
389 matches!(self, Self::ForbiddenException(_))
390 }
391 pub fn is_not_found_exception(&self) -> bool {
393 matches!(self, Self::NotFoundException(_))
394 }
395 pub fn is_service_failure_exception(&self) -> bool {
397 matches!(self, Self::ServiceFailureException(_))
398 }
399 pub fn is_service_unavailable_exception(&self) -> bool {
401 matches!(self, Self::ServiceUnavailableException(_))
402 }
403 pub fn is_throttled_client_exception(&self) -> bool {
405 matches!(self, Self::ThrottledClientException(_))
406 }
407 pub fn is_unauthorized_client_exception(&self) -> bool {
409 matches!(self, Self::UnauthorizedClientException(_))
410 }
411}
412impl ::std::error::Error for GetUserError {
413 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
414 match self {
415 Self::BadRequestException(_inner) => ::std::option::Option::Some(_inner),
416 Self::ForbiddenException(_inner) => ::std::option::Option::Some(_inner),
417 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
418 Self::ServiceFailureException(_inner) => ::std::option::Option::Some(_inner),
419 Self::ServiceUnavailableException(_inner) => ::std::option::Option::Some(_inner),
420 Self::ThrottledClientException(_inner) => ::std::option::Option::Some(_inner),
421 Self::UnauthorizedClientException(_inner) => ::std::option::Option::Some(_inner),
422 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
423 }
424 }
425}
426impl ::std::fmt::Display for GetUserError {
427 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
428 match self {
429 Self::BadRequestException(_inner) => _inner.fmt(f),
430 Self::ForbiddenException(_inner) => _inner.fmt(f),
431 Self::NotFoundException(_inner) => _inner.fmt(f),
432 Self::ServiceFailureException(_inner) => _inner.fmt(f),
433 Self::ServiceUnavailableException(_inner) => _inner.fmt(f),
434 Self::ThrottledClientException(_inner) => _inner.fmt(f),
435 Self::UnauthorizedClientException(_inner) => _inner.fmt(f),
436 Self::Unhandled(_inner) => {
437 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
438 write!(f, "unhandled error ({code})")
439 } else {
440 f.write_str("unhandled error")
441 }
442 }
443 }
444 }
445}
446impl ::aws_smithy_types::retry::ProvideErrorKind for GetUserError {
447 fn code(&self) -> ::std::option::Option<&str> {
448 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
449 }
450 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
451 ::std::option::Option::None
452 }
453}
454impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetUserError {
455 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
456 match self {
457 Self::BadRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
458 Self::ForbiddenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
459 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
460 Self::ServiceFailureException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
461 Self::ServiceUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
462 Self::ThrottledClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
463 Self::UnauthorizedClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
464 Self::Unhandled(_inner) => &_inner.meta,
465 }
466 }
467}
468impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetUserError {
469 fn create_unhandled_error(
470 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
471 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
472 ) -> Self {
473 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
474 source,
475 meta: meta.unwrap_or_default(),
476 })
477 }
478}
479impl ::aws_types::request_id::RequestId for crate::operation::get_user::GetUserError {
480 fn request_id(&self) -> Option<&str> {
481 self.meta().request_id()
482 }
483}
484
485pub use crate::operation::get_user::_get_user_input::GetUserInput;
486
487pub use crate::operation::get_user::_get_user_output::GetUserOutput;
488
489mod _get_user_input;
490
491mod _get_user_output;
492
493pub mod builders;