aws_sdk_signin/client.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[derive(Debug)]
3 pub(crate) struct Handle {
4 pub(crate) conf: crate::Config,
5 #[allow(dead_code)] // unused when a service does not provide any operations
6 pub(crate) runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
7 }
8
9 /// Client for AWS Sign-In Service
10 ///
11 /// Client for invoking operations on AWS Sign-In Service. Each operation on AWS Sign-In Service is a method on this
12 /// this struct. `.send()` MUST be invoked on the generated operations to dispatch the request to the service.
13 #[derive(::std::clone::Clone, ::std::fmt::Debug)]
14 pub struct Client {
15 handle: ::std::sync::Arc<Handle>,
16 }
17
18 impl Client {
19 /// Creates a new client from the service [`Config`](crate::Config).
20 ///
21 /// # Panics
22 ///
23 /// This method will panic in the following cases:
24 ///
25 /// - Retries or timeouts are enabled without a `sleep_impl` configured.
26 /// - Identity caching is enabled without a `sleep_impl` and `time_source` configured.
27 /// - No `behavior_version` is provided.
28 ///
29 /// The panic message for each of these will have instructions on how to resolve them.
30 #[track_caller]
31 pub fn from_conf(conf: crate::Config) -> Self {
32 let handle = Handle {
33 conf: conf.clone(),
34 runtime_plugins: crate::config::base_client_runtime_plugins(conf),
35 };
36 if let Err(err) = Self::validate_config(&handle) {
37 panic!("Invalid client configuration: {err}");
38 }
39 Self {
40 handle: ::std::sync::Arc::new(handle)
41 }
42 }
43
44 /// Returns the client's configuration.
45 pub fn config(&self) -> &crate::Config {
46 &self.handle.conf
47 }
48
49 fn validate_config(handle: &Handle) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
50 let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
51 handle.runtime_plugins
52 .apply_client_configuration(&mut cfg)?
53 .validate_base_client_config(&cfg)?;
54 Ok(())
55 }
56 }
57
58impl Client {
59 /// Creates a new client from an [SDK Config](::aws_types::sdk_config::SdkConfig).
60 ///
61 /// # Panics
62 ///
63 /// - This method will panic if the `sdk_config` is missing an async sleep implementation. If you experience this panic, set
64 /// the `sleep_impl` on the Config passed into this function to fix it.
65 /// - This method will panic if the `sdk_config` is missing an HTTP connector. If you experience this panic, set the
66 /// `http_connector` on the Config passed into this function to fix it.
67 /// - This method will panic if no `BehaviorVersion` is provided. If you experience this panic, set `behavior_version` on the Config or enable the `behavior-version-latest` Cargo feature.
68 #[track_caller]
69 pub fn new(sdk_config: &::aws_types::sdk_config::SdkConfig) -> Self {
70 Self::from_conf(sdk_config.into())
71 }
72}
73
74mod create_o_auth2_token;
75
76/// Operation customization and supporting types.
77///
78/// The underlying HTTP requests made during an operation can be customized
79/// by calling the `customize()` method on the builder returned from a client
80/// operation call. For example, this can be used to add an additional HTTP header:
81///
82/// ```ignore
83/// # async fn wrapper() -> ::std::result::Result<(), aws_sdk_signin::Error> {
84/// # let client: aws_sdk_signin::Client = unimplemented!();
85/// use ::http::header::{HeaderName, HeaderValue};
86///
87/// let result = client.create_o_auth2_token()
88/// .customize()
89/// .mutate_request(|req| {
90/// // Add `x-example-header` with value
91/// req.headers_mut()
92/// .insert(
93/// HeaderName::from_static("x-example-header"),
94/// HeaderValue::from_static("1"),
95/// );
96/// })
97/// .send()
98/// .await;
99/// # }
100/// ```
101pub mod customize;
102