Skip to main content

aws_sdk_signin/
config.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#![allow(clippy::empty_line_after_doc_comments)]
3/// Configuration for a aws_sdk_signin service client.
4///
5/// Service configuration allows for customization of endpoints, region, credentials providers,
6/// and retry configuration. Generally, it is constructed automatically for you from a shared
7/// configuration loaded by the `aws-config` crate. For example:
8///
9/// ```ignore
10/// // Load a shared config from the environment
11/// let shared_config = aws_config::from_env().load().await;
12/// // The client constructor automatically converts the shared config into the service config
13/// let client = Client::new(&shared_config);
14/// ```
15///
16/// The service config can also be constructed manually using its builder.
17///
18#[derive(::std::clone::Clone, ::std::fmt::Debug)]
19pub struct Config {
20    // Both `config` and `cloneable` are the same config, but the cloneable one
21                    // is kept around so that it is possible to convert back into a builder. This can be
22                    // optimized in the future.
23                    pub(crate) config: crate::config::FrozenLayer,
24                    cloneable: ::aws_smithy_types::config_bag::CloneableLayer,
25                    pub(crate) runtime_components: crate::config::RuntimeComponentsBuilder,
26                    pub(crate) runtime_plugins: ::std::vec::Vec<crate::config::SharedRuntimePlugin>,
27                    pub(crate) behavior_version: ::std::option::Option<crate::config::BehaviorVersion>,
28}
29impl Config {
30    ///
31    /// Constructs a config builder.
32    /// <div class="warning">
33    /// Note that a config created from this builder will not have the same safe defaults as one created by
34    /// the <a href="https://crates.io/crates/aws-config" target="_blank">aws-config</a> crate.
35    /// </div>
36    ///
37    pub fn builder() -> Builder { Builder::default() }
38    /// Converts this config back into a builder so that it can be tweaked.
39                    pub fn to_builder(&self) -> Builder {
40                        Builder {
41                            config: self.cloneable.clone(),
42                            runtime_components: self.runtime_components.clone(),
43                            runtime_plugins: self.runtime_plugins.clone(),
44                            behavior_version: self.behavior_version,
45                        }
46                    }
47    /// Return a reference to the stalled stream protection configuration contained in this config, if any.
48                            pub fn stalled_stream_protection(&self) -> ::std::option::Option<&crate::config::StalledStreamProtectionConfig> {
49                                self.config.load::<crate::config::StalledStreamProtectionConfig>()
50                            }
51    /// Return the [`SharedHttpClient`](crate::config::SharedHttpClient) to use when making requests, if any.
52                            pub fn http_client(&self) -> Option<crate::config::SharedHttpClient> {
53                                self.runtime_components.http_client()
54                            }
55    /// Return the auth schemes configured on this service config
56                            pub fn auth_schemes(&self) -> impl Iterator<Item = ::aws_smithy_runtime_api::client::auth::SharedAuthScheme> + '_ {
57                                self.runtime_components.auth_schemes()
58                            }
59
60                            /// Return the auth scheme resolver configured on this service config
61                            pub fn auth_scheme_resolver(&self) -> ::std::option::Option<::aws_smithy_runtime_api::client::auth::SharedAuthSchemeOptionResolver> {
62                                self.runtime_components.auth_scheme_option_resolver()
63                            }
64    /// Returns the configured auth scheme preference
65                            pub fn auth_scheme_preference(&self) -> ::std::option::Option<&::aws_smithy_runtime_api::client::auth::AuthSchemePreference> {
66                                self.config.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
67                            }
68    /// Returns the endpoint resolver.
69                            pub fn endpoint_resolver(&self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver {
70                                self.runtime_components.endpoint_resolver().expect("resolver defaulted if not set")
71                            }
72    /// Return a reference to the retry configuration contained in this config, if any.
73                            pub fn retry_config(&self) -> ::std::option::Option<&::aws_smithy_types::retry::RetryConfig> {
74                                self.config.load::<::aws_smithy_types::retry::RetryConfig>()
75                            }
76
77                            /// Return a cloned shared async sleep implementation from this config, if any.
78                            pub fn sleep_impl(&self) -> ::std::option::Option<crate::config::SharedAsyncSleep> {
79                                self.runtime_components.sleep_impl()
80                            }
81
82                            /// Return a reference to the timeout configuration contained in this config, if any.
83                            pub fn timeout_config(&self) -> ::std::option::Option<&::aws_smithy_types::timeout::TimeoutConfig> {
84                                self.config.load::<::aws_smithy_types::timeout::TimeoutConfig>()
85                            }
86
87                            /// Returns a reference to the retry partition contained in this config, if any.
88                            ///
89                            /// WARNING: This method is unstable and may be removed at any time. Do not rely on this
90                            /// method for anything!
91                            pub fn retry_partition(&self) -> ::std::option::Option<&::aws_smithy_runtime::client::retries::RetryPartition> {
92                                self.config.load::<::aws_smithy_runtime::client::retries::RetryPartition>()
93                            }
94    /// Returns the configured identity cache for auth.
95                            pub fn identity_cache(&self) -> ::std::option::Option<crate::config::SharedIdentityCache> {
96                                self.runtime_components.identity_cache()
97                            }
98    /// Returns interceptors currently registered by the user.
99                            pub fn interceptors(&self) -> impl Iterator<Item = crate::config::SharedInterceptor> + '_ {
100                                self.runtime_components.interceptors()
101                            }
102    /// Return time source used for this service.
103    pub fn time_source(&self) -> ::std::option::Option<::aws_smithy_async::time::SharedTimeSource> {
104        self.runtime_components.time_source()
105    }
106    /// Returns retry classifiers currently registered by the user.
107                            pub fn retry_classifiers(&self) -> impl Iterator<Item = ::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier> + '_ {
108                                self.runtime_components.retry_classifiers()
109                            }
110    /// Returns the name of the app that is using the client, if it was provided.
111                                ///
112                                /// This _optional_ name is used to identify the application in the user agent that
113                                /// gets sent along with requests.
114                                pub fn app_name(&self) -> ::std::option::Option<&::aws_types::app_name::AppName> {
115                                   self.config.load::<::aws_types::app_name::AppName>()
116                                }
117    /// Returns the framework metadata that has been configured, if any.
118                                ///
119                                /// This _optional_ metadata identifies software frameworks or third-party libraries
120                                /// being used with the client, rendered into the user agent as `lib/{name}/{version}`.
121                                /// Entries are returned in first-seen (insertion) order, matching the order they are
122                                /// rendered into the user agent.
123                                pub fn framework_metadata(&self) -> ::std::vec::Vec<&::aws_types::sdk_ua_metadata::FrameworkMetadata> {
124                                    // `StoreAppend` loads entries newest-first; reverse to first-seen order so
125                                    // this getter agrees with both the user agent and `SdkConfig::framework_metadata`.
126                                    let mut entries: ::std::vec::Vec<&::aws_types::sdk_ua_metadata::FrameworkMetadata> =
127                                        self.config.load::<::aws_types::sdk_ua_metadata::FrameworkMetadata>().collect();
128                                    entries.reverse();
129                                    entries
130                                }
131    /// Returns the invocation ID generator if one was given in config.
132    ///
133    /// The invocation ID generator generates ID values for the `amz-sdk-invocation-id` header. By default, this will be a random UUID. Overriding it may be useful in tests that examine the HTTP request and need to be deterministic.
134    pub fn invocation_id_generator(&self) -> ::std::option::Option<::aws_runtime::invocation_id::SharedInvocationIdGenerator> {
135                                self.config.load::<::aws_runtime::invocation_id::SharedInvocationIdGenerator>().cloned()
136                            }
137    /// Creates a new [service config](crate::Config) from a [shared `config`](::aws_types::sdk_config::SdkConfig).
138                            pub fn new(config: &::aws_types::sdk_config::SdkConfig) -> Self {
139                                Builder::from(config).build()
140                            }
141    /// The signature version 4 service signing name to use in the credential scope when signing requests.
142                                ///
143                                /// The signing service may be overridden by the `Endpoint`, or by specifying a custom
144                                /// [`SigningName`](aws_types::SigningName) during operation construction
145                                pub fn signing_name(&self) -> &'static str {
146                                    "signin"
147                                }
148    /// Returns the AWS region, if it was provided.
149                            pub fn region(&self) -> ::std::option::Option<&crate::config::Region> {
150                                self.config.load::<crate::config::Region>()
151                            }
152    /// This function was intended to be removed, and has been broken since release-2023-11-15 as it always returns a `None`. Do not use.
153                            #[deprecated(note = "This function was intended to be removed, and has been broken since release-2023-11-15 as it always returns a `None`. Do not use.")]
154                            pub fn credentials_provider(&self) -> Option<crate::config::SharedCredentialsProvider> {
155                                ::std::option::Option::None
156                            }
157}
158/// Builder for creating a `Config`.
159#[derive(::std::clone::Clone, ::std::fmt::Debug)]
160pub struct Builder {
161    pub(crate) config: ::aws_smithy_types::config_bag::CloneableLayer,
162                    pub(crate) runtime_components: crate::config::RuntimeComponentsBuilder,
163                    pub(crate) runtime_plugins: ::std::vec::Vec<crate::config::SharedRuntimePlugin>,
164                    pub(crate) behavior_version: ::std::option::Option<crate::config::BehaviorVersion>,
165}
166impl ::std::default::Default for Builder {
167    fn default() -> Self {
168                        Self {
169                            config: ::std::default::Default::default(),
170                            runtime_components: crate::config::RuntimeComponentsBuilder::new("service config"),
171                            runtime_plugins: ::std::default::Default::default(),
172                            behavior_version: ::std::default::Default::default(),
173                        }
174                    }
175}
176impl Builder {
177    ///
178    /// Constructs a config builder.
179    /// <div class="warning">
180    /// Note that a config created from this builder will not have the same safe defaults as one created by
181    /// the <a href="https://crates.io/crates/aws-config" target="_blank">aws-config</a> crate.
182    /// </div>
183    ///
184    pub fn new() -> Self { Self::default() }
185    /// Constructs a config builder from the given `config_bag`, setting only fields stored in the config bag,
186    /// but not those in runtime components.
187    #[allow(unused)]
188    pub(crate) fn from_config_bag(config_bag: &::aws_smithy_types::config_bag::ConfigBag) -> Self {
189        let mut builder = Self::new();
190        builder.set_stalled_stream_protection(config_bag.load::<crate::config::StalledStreamProtectionConfig>().cloned());
191        builder.set_auth_scheme_preference(config_bag.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>().cloned());
192        builder.set_retry_config(config_bag.load::<::aws_smithy_types::retry::RetryConfig>().cloned());
193        builder.set_timeout_config(config_bag.load::<::aws_smithy_types::timeout::TimeoutConfig>().cloned());
194        builder.set_retry_partition(config_bag.load::<::aws_smithy_runtime::client::retries::RetryPartition>().cloned());
195        builder.set_app_name(config_bag.load::<::aws_types::app_name::AppName>().cloned());
196        for framework_metadata in config_bag.load::<::aws_types::sdk_ua_metadata::FrameworkMetadata>() {
197                                        builder.push_framework_metadata(framework_metadata.clone());
198                                    }
199        builder.set_endpoint_url(config_bag.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()));
200        builder.set_use_dual_stack(config_bag.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0));
201        builder.set_use_fips(config_bag.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0));
202        builder.set_region(config_bag.load::<crate::config::Region>().cloned());
203        builder
204    }
205    /// Names operation-input members whose values are captured *and* emitted as
206                            /// attributes on the client's built-in metrics (e.g. `["Bucket"]`).
207                            ///
208                            /// Emitting implies capture, so an emitted member is also readable in-process
209                            /// via `CapturedTelemetryAttributes` on the config bag. Names are Smithy input
210                            /// member names; only string-valued, non-sensitive members are eligible, and
211                            /// naming any other member has no effect. Off by default.
212                            ///
213                            /// Prefer bounded identifiers here: an emitted member becomes a metric label, so
214                            /// high-cardinality values (like object keys) fragment the metrics and inflate
215                            /// cost. Use [`Self::capture_input_attributes`] for values you want to read
216                            /// in-process without emitting them on the metrics.
217                            pub fn emit_input_attributes(
218                                mut self,
219                                names: impl ::std::iter::IntoIterator<Item = impl ::std::convert::Into<::std::string::String>>,
220                            ) -> Self {
221                                let mut requested = self.config.load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>().cloned().unwrap_or_default();
222                                requested.emit(names.into_iter().map(|n| n.into()));
223                                self.config.store_put(requested);
224                                self
225                            }
226
227                            /// Names operation-input members whose values are captured into
228                            /// `CapturedTelemetryAttributes` for in-process reads (e.g. from a custom
229                            /// interceptor), but are **not** emitted on the built-in metrics.
230                            ///
231                            /// Use this for values you need during the operation lifecycle but do not want on
232                            /// the metric label set (for example, high-cardinality identifiers). Names follow
233                            /// the same eligibility rules as [`Self::emit_input_attributes`]. Off by default.
234                            pub fn capture_input_attributes(
235                                mut self,
236                                names: impl ::std::iter::IntoIterator<Item = impl ::std::convert::Into<::std::string::String>>,
237                            ) -> Self {
238                                let mut requested = self.config.load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>().cloned().unwrap_or_default();
239                                requested.capture_only(names.into_iter().map(|n| n.into()));
240                                self.config.store_put(requested);
241                                self
242                            }
243    /// Set the [`StalledStreamProtectionConfig`](crate::config::StalledStreamProtectionConfig)
244                            /// to configure protection for stalled streams.
245                            pub fn stalled_stream_protection(
246                                mut self,
247                                stalled_stream_protection_config: crate::config::StalledStreamProtectionConfig
248                            ) -> Self {
249                                self.set_stalled_stream_protection(::std::option::Option::Some(stalled_stream_protection_config));
250                                self
251                            }
252    /// Set the [`StalledStreamProtectionConfig`](crate::config::StalledStreamProtectionConfig)
253                            /// to configure protection for stalled streams.
254                            pub fn set_stalled_stream_protection(
255                                &mut self,
256                                stalled_stream_protection_config: ::std::option::Option<crate::config::StalledStreamProtectionConfig>
257                            ) -> &mut Self {
258                                self.config.store_or_unset(stalled_stream_protection_config);
259                                self
260                            }
261    /// Sets the idempotency token provider to use for service calls that require tokens.
262                            pub fn idempotency_token_provider(mut self, idempotency_token_provider: impl ::std::convert::Into<crate::idempotency_token::IdempotencyTokenProvider>) -> Self {
263                                self.set_idempotency_token_provider(::std::option::Option::Some(idempotency_token_provider.into()));
264                                self
265                            }
266    /// Sets the idempotency token provider to use for service calls that require tokens.
267                            pub fn set_idempotency_token_provider(&mut self, idempotency_token_provider: ::std::option::Option<crate::idempotency_token::IdempotencyTokenProvider>) -> &mut Self {
268                                self.config.store_or_unset(idempotency_token_provider);
269                                self
270                            }
271    /// Sets the HTTP client to use when making requests.
272                            ///
273                            /// # Examples
274                            /// ```no_run
275                            /// # #[cfg(test)]
276                            /// # mod tests {
277                            /// # #[test]
278                            /// # fn example() {
279                            /// use std::time::Duration;
280                            /// use aws_sdk_signin::config::Config;
281                            /// use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;
282                            ///
283                            /// let https_connector = hyper_rustls::HttpsConnectorBuilder::new()
284                            ///     .with_webpki_roots()
285                            ///     .https_only()
286                            ///     .enable_http1()
287                            ///     .enable_http2()
288                            ///     .build();
289                            /// let hyper_client = HyperClientBuilder::new().build(https_connector);
290                            ///
291                            /// // This connector can then be given to a generated service Config
292                            /// let config = my_service_client::Config::builder()
293                            ///     .endpoint_url("https://example.com")
294                            ///     .http_client(hyper_client)
295                            ///     .build();
296                            /// let client = my_service_client::Client::from_conf(config);
297                            /// # }
298                            /// # }
299                            /// ```
300                            pub fn http_client(mut self, http_client: impl crate::config::HttpClient + 'static) -> Self {
301                                self.set_http_client(::std::option::Option::Some(crate::config::IntoShared::into_shared(http_client)));
302                                self
303                            }
304
305                            /// Sets the HTTP client to use when making requests.
306                            ///
307                            /// # Examples
308                            /// ```no_run
309                            /// # #[cfg(test)]
310                            /// # mod tests {
311                            /// # #[test]
312                            /// # fn example() {
313                            /// use std::time::Duration;
314                            /// use aws_sdk_signin::config::{Builder, Config};
315                            /// use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;
316                            ///
317                            /// fn override_http_client(builder: &mut Builder) {
318                            ///     let https_connector = hyper_rustls::HttpsConnectorBuilder::new()
319                            ///         .with_webpki_roots()
320                            ///         .https_only()
321                            ///         .enable_http1()
322                            ///         .enable_http2()
323                            ///         .build();
324                            ///     let hyper_client = HyperClientBuilder::new().build(https_connector);
325                            ///     builder.set_http_client(Some(hyper_client));
326                            /// }
327                            ///
328                            /// let mut builder = aws_sdk_signin::Config::builder();
329                            /// override_http_client(&mut builder);
330                            /// let config = builder.build();
331                            /// # }
332                            /// # }
333                            /// ```
334                            pub fn set_http_client(&mut self, http_client: Option<crate::config::SharedHttpClient>) -> &mut Self {
335                                self.runtime_components.set_http_client(http_client);
336                                self
337                            }
338    /// Adds an auth scheme to the builder
339                            ///
340                            /// If `auth_scheme` has an existing [AuthSchemeId](aws_smithy_runtime_api::client::auth::AuthSchemeId) in the runtime, the current identity
341                            /// resolver and signer for that scheme will be replaced by those from `auth_scheme`.
342                            ///
343                            /// _Important:_ When introducing a custom auth scheme, ensure you override either
344                            /// [`Self::auth_scheme_resolver`] or [`Self::set_auth_scheme_resolver`]
345                            /// so that the custom auth scheme is included in the list of resolved auth scheme options.
346                            /// [The default auth scheme resolver](crate::config::auth::DefaultAuthSchemeResolver) will not recognize your custom auth scheme.
347                            ///
348                            /// # Examples
349                            /// ```no_run
350                            /// # use aws_smithy_runtime_api::{
351                            /// #     box_error::BoxError,
352                            /// #     client::{
353                            /// #         auth::{
354                            /// #             AuthScheme, AuthSchemeEndpointConfig, AuthSchemeId, AuthSchemeOption,
355                            /// #             AuthSchemeOptionsFuture, Sign,
356                            /// #         },
357                            /// #         identity::{Identity, IdentityFuture, ResolveIdentity, SharedIdentityResolver},
358                            /// #         orchestrator::HttpRequest,
359                            /// #         runtime_components::{GetIdentityResolver, RuntimeComponents},
360                            /// #   },
361                            /// #   shared::IntoShared,
362                            /// # };
363                            /// # use aws_smithy_types::config_bag::ConfigBag;
364                            /// // Auth scheme with customer identity resolver and signer
365                            /// #[derive(Debug)]
366                            /// struct CustomAuthScheme {
367                            ///     id: AuthSchemeId,
368                            ///     identity_resolver: SharedIdentityResolver,
369                            ///     signer: CustomSigner,
370                            /// }
371                            /// impl Default for CustomAuthScheme {
372                            ///     fn default() -> Self {
373                            ///         Self {
374                            ///             id: AuthSchemeId::new("custom"),
375                            ///             identity_resolver: CustomIdentityResolver.into_shared(),
376                            ///             signer: CustomSigner,
377                            ///         }
378                            ///     }
379                            /// }
380                            /// impl AuthScheme for CustomAuthScheme {
381                            ///     fn scheme_id(&self) -> AuthSchemeId {
382                            ///         self.id.clone()
383                            ///     }
384                            ///     fn identity_resolver(
385                            ///         &self,
386                            ///         _identity_resolvers: &dyn GetIdentityResolver,
387                            ///     ) -> Option<SharedIdentityResolver> {
388                            ///         Some(self.identity_resolver.clone())
389                            ///     }
390                            ///     fn signer(&self) -> &dyn Sign {
391                            ///         &self.signer
392                            ///     }
393                            /// }
394                            ///
395                            /// #[derive(Debug, Default)]
396                            /// struct CustomSigner;
397                            /// impl Sign for CustomSigner {
398                            ///     fn sign_http_request(
399                            ///         &self,
400                            ///         _request: &mut HttpRequest,
401                            ///         _identity: &Identity,
402                            ///         _auth_scheme_endpoint_config: AuthSchemeEndpointConfig<'_>,
403                            ///         _runtime_components: &RuntimeComponents,
404                            ///         _config_bag: &ConfigBag,
405                            ///     ) -> Result<(), BoxError> {
406                            ///         // --snip--
407                            /// #      todo!()
408                            ///     }
409                            /// }
410                            ///
411                            /// #[derive(Debug)]
412                            /// struct CustomIdentityResolver;
413                            /// impl ResolveIdentity for CustomIdentityResolver {
414                            ///     fn resolve_identity<'a>(
415                            ///         &'a self,
416                            ///         _runtime_components: &'a RuntimeComponents,
417                            ///         _config_bag: &'a ConfigBag,
418                            ///     ) -> IdentityFuture<'a> {
419                            ///         // --snip--
420                            /// #      todo!()
421                            ///     }
422                            /// }
423                            ///
424                            /// // Auth scheme resolver that favors `CustomAuthScheme`
425                            /// #[derive(Debug)]
426                            /// struct CustomAuthSchemeResolver;
427                            /// impl aws_sdk_signin::config::auth::ResolveAuthScheme for CustomAuthSchemeResolver {
428                            ///     fn resolve_auth_scheme<'a>(
429                            ///         &'a self,
430                            ///         _params: &'a aws_sdk_signin::config::auth::Params,
431                            ///         _cfg: &'a ConfigBag,
432                            ///         _runtime_components: &'a RuntimeComponents,
433                            ///     ) -> AuthSchemeOptionsFuture<'a> {
434                            ///         AuthSchemeOptionsFuture::ready(Ok(vec![AuthSchemeOption::from(AuthSchemeId::new(
435                            ///             "custom",
436                            ///         ))]))
437                            ///     }
438                            /// }
439                            ///
440                            /// let config = aws_sdk_signin::Config::builder()
441                            ///     .push_auth_scheme(CustomAuthScheme::default())
442                            ///     .auth_scheme_resolver(CustomAuthSchemeResolver)
443                            ///     // other configurations
444                            ///     .build();
445                            /// ```
446                            pub fn push_auth_scheme(mut self, auth_scheme: impl ::aws_smithy_runtime_api::client::auth::AuthScheme + 'static) -> Self {
447                                self.runtime_components.push_auth_scheme(auth_scheme);
448                                self
449                            }
450
451                            /// Set the auth scheme resolver for the builder
452                            ///
453                            /// # Examples
454                            /// ```no_run
455                            /// # use aws_smithy_runtime_api::{
456                            /// #     client::{
457                            /// #         auth::AuthSchemeOptionsFuture,
458                            /// #         runtime_components::RuntimeComponents,
459                            /// #   },
460                            /// # };
461                            /// # use aws_smithy_types::config_bag::ConfigBag;
462                            /// #[derive(Debug)]
463                            /// struct CustomAuthSchemeResolver;
464                            /// impl aws_sdk_signin::config::auth::ResolveAuthScheme for CustomAuthSchemeResolver {
465                            ///     fn resolve_auth_scheme<'a>(
466                            ///         &'a self,
467                            ///         _params: &'a aws_sdk_signin::config::auth::Params,
468                            ///         _cfg: &'a ConfigBag,
469                            ///         _runtime_components: &'a RuntimeComponents,
470                            ///     ) -> AuthSchemeOptionsFuture<'a> {
471                            ///         // --snip--
472                            /// #      todo!()
473                            ///     }
474                            /// }
475                            ///
476                            /// let config = aws_sdk_signin::Config::builder()
477                            ///     .auth_scheme_resolver(CustomAuthSchemeResolver)
478                            ///     // other configurations
479                            ///     .build();
480                            /// ```
481                            pub fn auth_scheme_resolver(mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> Self {
482                                self.set_auth_scheme_resolver(auth_scheme_resolver);
483                                self
484                            }
485
486                            /// Set the auth scheme resolver for the builder
487                            ///
488                            /// # Examples
489                            /// See an example for [`Self::auth_scheme_resolver`].
490                            pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
491                                self.runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
492                                self
493                            }
494
495                            /// Enable no authentication regardless of what authentication mechanisms operations support
496                            ///
497                            /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
498                            /// and the auth scheme resolver will use it when no other auth schemes are applicable.
499                            pub fn allow_no_auth(mut self) -> Self {
500                                self.set_allow_no_auth();
501                                self
502                            }
503
504                            /// Enable no authentication regardless of what authentication mechanisms operations support
505                            ///
506                            /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
507                            /// and the auth scheme resolver will use it when no other auth schemes are applicable.
508                            pub fn set_allow_no_auth(&mut self) -> &mut Self {
509                                self.push_runtime_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePluginV2::new().into_shared());
510                                self
511                            }
512    /// Set the auth scheme preference for an auth scheme resolver
513                            /// (typically the default auth scheme resolver).
514                            ///
515                            /// Each operation has a predefined order of auth schemes, as determined by the service,
516                            /// for auth scheme resolution. By using the auth scheme preference, customers
517                            /// can reorder the schemes resolved by the auth scheme resolver.
518                            ///
519                            /// The preference list is intended as a hint rather than a strict override.
520                            /// Any schemes not present in the originally resolved auth schemes will be ignored.
521                            ///
522                            /// # Examples
523                            ///
524                            /// ```no_run
525                            /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
526                            /// let config = aws_sdk_signin::Config::builder()
527                            ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
528                            ///     // ...
529                            ///     .build();
530                            /// let client = aws_sdk_signin::Client::from_conf(config);
531                            /// ```
532
533                            pub fn auth_scheme_preference(mut self, preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>) -> Self {
534                                self.set_auth_scheme_preference(::std::option::Option::Some(preference.into()));
535                                self
536                            }
537
538
539                            /// Set the auth scheme preference for an auth scheme resolver
540                            /// (typically the default auth scheme resolver).
541                            ///
542                            /// Each operation has a predefined order of auth schemes, as determined by the service,
543                            /// for auth scheme resolution. By using the auth scheme preference, customers
544                            /// can reorder the schemes resolved by the auth scheme resolver.
545                            ///
546                            /// The preference list is intended as a hint rather than a strict override.
547                            /// Any schemes not present in the originally resolved auth schemes will be ignored.
548                            ///
549                            /// # Examples
550                            ///
551                            /// ```no_run
552                            /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
553                            /// let config = aws_sdk_signin::Config::builder()
554                            ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
555                            ///     // ...
556                            ///     .build();
557                            /// let client = aws_sdk_signin::Client::from_conf(config);
558                            /// ```
559
560                            pub fn set_auth_scheme_preference(&mut self, preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>) -> &mut Self {
561                                self.config.store_or_unset(preference);
562                                self
563                            }
564    /// Sets the endpoint resolver to use when making requests.
565                            ///
566                            ///
567                                /// When unset, the client will used a generated endpoint resolver based on the endpoint resolution
568                                /// rules for `aws_sdk_signin`.
569                                ///
570                            ///
571                            /// Note: setting an endpoint resolver will replace any endpoint URL that has been set.
572                            /// This method accepts an endpoint resolver [specific to this service](crate::config::endpoint::ResolveEndpoint). If you want to
573                            /// provide a shared endpoint resolver, use [`Self::set_endpoint_resolver`].
574                            ///
575                            /// # Examples
576                            /// Create a custom endpoint resolver that resolves a different endpoing per-stage, e.g. staging vs. production.
577                            /// ```no_run
578                            /// use aws_sdk_signin::config::endpoint::{ResolveEndpoint, EndpointFuture, Params, Endpoint};
579                            /// #[derive(Debug)]
580                            /// struct StageResolver { stage: String }
581                            /// impl ResolveEndpoint for StageResolver {
582                            ///     fn resolve_endpoint(&self, params: &Params) -> EndpointFuture<'_> {
583                            ///         let stage = &self.stage;
584                            ///         EndpointFuture::ready(Ok(Endpoint::builder().url(format!("{stage}.myservice.com")).build()))
585                            ///     }
586                            /// }
587                            /// let resolver = StageResolver { stage: std::env::var("STAGE").unwrap() };
588                            /// let config = aws_sdk_signin::Config::builder().endpoint_resolver(resolver).build();
589                            /// let client = aws_sdk_signin::Client::from_conf(config);
590                            /// ```
591                            pub fn endpoint_resolver(mut self, endpoint_resolver: impl crate::config::endpoint::ResolveEndpoint + 'static) -> Self {
592                                self.set_endpoint_resolver(::std::option::Option::Some(endpoint_resolver.into_shared_resolver()));
593                                self
594                            }
595
596                            /// Sets the endpoint resolver to use when making requests.
597                            ///
598                            ///
599                                /// When unset, the client will used a generated endpoint resolver based on the endpoint resolution
600                                /// rules for `aws_sdk_signin`.
601                                ///
602    pub fn set_endpoint_resolver(&mut self, endpoint_resolver: ::std::option::Option<::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver>) -> &mut Self {
603                                self.runtime_components.set_endpoint_resolver(endpoint_resolver);
604                                self
605                            }
606    /// Set the retry_config for the builder
607                            ///
608                            /// # Examples
609                            /// ```no_run
610                            /// use aws_sdk_signin::config::Config;
611                            /// use aws_sdk_signin::config::retry::RetryConfig;
612                            ///
613                            /// let retry_config = RetryConfig::standard().with_max_attempts(5);
614                            /// let config = Config::builder().retry_config(retry_config).build();
615                            /// ```
616                            ///
617                            /// # Retry token bucket
618                            ///
619                            /// [`RetryConfig`](::aws_smithy_types::retry::RetryConfig) controls *how many* times to retry and *how long* to back
620                            /// off. Retries are **also** gated by a retry token bucket (also called the retry quota) that
621                            /// is shared across a [`RetryPartition`](::aws_smithy_runtime::client::retries::RetryPartition). To configure the token bucket — for
622                            /// example, to set
623                            /// its capacity or to give a workload its own bucket — see [`Self::retry_partition`] and
624                            /// [`RetryPartition::custom`](::aws_smithy_runtime::client::retries::RetryPartition::custom).
625                            pub fn retry_config(mut self, retry_config: ::aws_smithy_types::retry::RetryConfig) -> Self {
626                                self.set_retry_config(Some(retry_config));
627                                self
628                            }
629
630                            /// Set the retry_config for the builder
631                            ///
632                            /// # Examples
633                            /// ```no_run
634                            /// use aws_sdk_signin::config::{Builder, Config};
635                            /// use aws_sdk_signin::config::retry::RetryConfig;
636                            ///
637                            /// fn disable_retries(builder: &mut Builder) {
638                            ///     let retry_config = RetryConfig::standard().with_max_attempts(1);
639                            ///     builder.set_retry_config(Some(retry_config));
640                            /// }
641                            ///
642                            /// let mut builder = Config::builder();
643                            /// disable_retries(&mut builder);
644                            /// let config = builder.build();
645                            /// ```
646    pub fn set_retry_config(&mut self, retry_config: ::std::option::Option<::aws_smithy_types::retry::RetryConfig>) -> &mut Self {
647                                retry_config.map(|r| self.config.store_put(r));
648                                self
649                            }
650    /// Set the sleep_impl for the builder
651                            ///
652                            /// # Examples
653                            ///
654                            /// ```no_run
655                            /// use aws_sdk_signin::config::{AsyncSleep, Config, SharedAsyncSleep, Sleep};
656                            ///
657                            /// #[derive(Debug)]
658                            /// pub struct ForeverSleep;
659                            ///
660                            /// impl AsyncSleep for ForeverSleep {
661                            ///     fn sleep(&self, duration: std::time::Duration) -> Sleep {
662                            ///         Sleep::new(std::future::pending())
663                            ///     }
664                            /// }
665                            ///
666                            /// let sleep_impl = SharedAsyncSleep::new(ForeverSleep);
667                            /// let config = Config::builder().sleep_impl(sleep_impl).build();
668                            /// ```
669                            pub fn sleep_impl(mut self, sleep_impl: impl crate::config::AsyncSleep + 'static) -> Self {
670                                self.set_sleep_impl(Some(::aws_smithy_runtime_api::shared::IntoShared::into_shared(sleep_impl)));
671                                self
672                            }
673
674                            /// Set the sleep_impl for the builder
675                            ///
676                            /// # Examples
677                            ///
678                            /// ```no_run
679                            /// use aws_sdk_signin::config::{AsyncSleep, Builder, Config, SharedAsyncSleep, Sleep};
680                            ///
681                            /// #[derive(Debug)]
682                            /// pub struct ForeverSleep;
683                            ///
684                            /// impl AsyncSleep for ForeverSleep {
685                            ///     fn sleep(&self, duration: std::time::Duration) -> Sleep {
686                            ///         Sleep::new(std::future::pending())
687                            ///     }
688                            /// }
689                            ///
690                            /// fn set_never_ending_sleep_impl(builder: &mut Builder) {
691                            ///     let sleep_impl = SharedAsyncSleep::new(ForeverSleep);
692                            ///     builder.set_sleep_impl(Some(sleep_impl));
693                            /// }
694                            ///
695                            /// let mut builder = Config::builder();
696                            /// set_never_ending_sleep_impl(&mut builder);
697                            /// let config = builder.build();
698                            /// ```
699    pub fn set_sleep_impl(&mut self, sleep_impl: ::std::option::Option<crate::config::SharedAsyncSleep>) -> &mut Self {
700                                self.runtime_components.set_sleep_impl(sleep_impl);
701                                self
702                            }
703    /// Set the timeout_config for the builder
704                            ///
705                            /// # Examples
706                            ///
707                            /// ```no_run
708                            /// # use std::time::Duration;
709                            /// use aws_sdk_signin::config::Config;
710                            /// use aws_sdk_signin::config::timeout::TimeoutConfig;
711                            ///
712                            /// let timeout_config = TimeoutConfig::builder()
713                            ///     .operation_attempt_timeout(Duration::from_secs(1))
714                            ///     .build();
715                            /// let config = Config::builder().timeout_config(timeout_config).build();
716                            /// ```
717                            pub fn timeout_config(mut self, timeout_config: ::aws_smithy_types::timeout::TimeoutConfig) -> Self {
718                                self.set_timeout_config(Some(timeout_config));
719                                self
720                            }
721
722                            /// Set the timeout_config for the builder.
723                            ///
724                            /// Setting this to `None` has no effect if another source of configuration has set timeouts. If you
725                            /// are attempting to disable timeouts, use [`TimeoutConfig::disabled`](::aws_smithy_types::timeout::TimeoutConfig::disabled)
726                            ///
727                            ///
728                            /// # Examples
729                            ///
730                            /// ```no_run
731                            /// # use std::time::Duration;
732                            /// use aws_sdk_signin::config::{Builder, Config};
733                            /// use aws_sdk_signin::config::timeout::TimeoutConfig;
734                            ///
735                            /// fn set_request_timeout(builder: &mut Builder) {
736                            ///     let timeout_config = TimeoutConfig::builder()
737                            ///         .operation_attempt_timeout(Duration::from_secs(1))
738                            ///         .build();
739                            ///     builder.set_timeout_config(Some(timeout_config));
740                            /// }
741                            ///
742                            /// let mut builder = Config::builder();
743                            /// set_request_timeout(&mut builder);
744                            /// let config = builder.build();
745                            /// ```
746    pub fn set_timeout_config(&mut self, timeout_config: ::std::option::Option<::aws_smithy_types::timeout::TimeoutConfig>) -> &mut Self {
747                                // passing None has no impact.
748                                let Some(mut timeout_config) = timeout_config else {
749                                    return self
750                                };
751
752                                if let Some(base) = self.config.load::<::aws_smithy_types::timeout::TimeoutConfig>() {
753                                    timeout_config.take_defaults_from(base);
754                                }
755                                self.config.store_put(timeout_config);
756                                self
757                            }
758    /// Set the partition for retry-related state. When clients share a retry partition, they will
759                            /// also share components such as token buckets and client rate limiters.
760                            /// See the [`RetryPartition`](::aws_smithy_runtime::client::retries::RetryPartition) documentation for more details.
761                            ///
762                            /// # Default Behavior
763                            ///
764                            /// When no retry partition is explicitly set, the SDK automatically creates a default retry partition named `signin`
765                            /// (or `signin-<region>` if a region is configured).
766                            /// All Signin clients without an explicit retry partition will share this default partition.
767                            ///
768                            /// # Notes
769                            ///
770                            /// - This is an advanced setting. A common reason to set it is to size or isolate the retry
771                            ///   token bucket — for example, giving a high-throughput workload its own bucket. Otherwise
772                            ///   most users won't need to modify it.
773                            /// - A configured client rate limiter has no effect unless [`RetryConfig::adaptive`](::aws_smithy_types::retry::RetryConfig::adaptive) is used.
774                            ///
775                            /// # Examples
776                            ///
777                            /// Creating a custom retry partition with a token bucket:
778                            /// ```no_run
779                            /// use aws_sdk_signin::config::Config;
780                            /// use aws_sdk_signin::config::retry::{RetryPartition, TokenBucket};
781                            ///
782                            /// let token_bucket = TokenBucket::new(10);
783                            /// let config = Config::builder()
784                            ///     .retry_partition(RetryPartition::custom("custom")
785                            ///         .token_bucket(token_bucket)
786                            ///         .build()
787                            ///     )
788                            ///     .build();
789                            /// ```
790                            ///
791                            /// Sizing the retry token bucket (for example, for a high-throughput workload), or giving a
792                            /// workload its own bucket:
793                            /// ```no_run
794                            /// use aws_sdk_signin::config::Config;
795                            /// use aws_sdk_signin::config::retry::{RetryPartition, TokenBucket};
796                            ///
797                            /// let config = Config::builder()
798                            ///     .retry_partition(
799                            ///         RetryPartition::custom("high-throughput")
800                            ///             .token_bucket(TokenBucket::builder().capacity(5000).build())
801                            ///             .build(),
802                            ///     )
803                            ///     .build();
804                            /// ```
805                            ///
806                            /// Configuring a client rate limiter with adaptive retry mode:
807                            /// ```no_run
808                            /// use aws_sdk_signin::config::Config;
809                            /// use aws_sdk_signin::config::retry::{ClientRateLimiter, RetryConfig, RetryPartition};
810                            ///
811                            /// let client_rate_limiter = ClientRateLimiter::new(10.0);
812                            /// let config = Config::builder()
813                            ///     .retry_partition(RetryPartition::custom("custom")
814                            ///         .client_rate_limiter(client_rate_limiter)
815                            ///         .build()
816                            ///     )
817                            ///     .retry_config(RetryConfig::adaptive())
818                            ///     .build();
819                            /// ```
820                            pub fn retry_partition(mut self, retry_partition: ::aws_smithy_runtime::client::retries::RetryPartition) -> Self {
821                                self.set_retry_partition(Some(retry_partition));
822                                self
823                            }
824    /// Like [`Self::retry_partition`], but takes a mutable reference to the builder and an optional `RetryPartition`
825                            pub fn set_retry_partition(&mut self, retry_partition: ::std::option::Option<::aws_smithy_runtime::client::retries::RetryPartition>) -> &mut Self {
826                                retry_partition.map(|r| self.config.store_put(r));
827                                self
828                            }
829    /// Set the identity cache for auth.
830                            ///
831                            /// The identity cache defaults to a lazy caching implementation that will resolve
832                            /// an identity when it is requested, and place it in the cache thereafter. Subsequent
833                            /// requests will take the value from the cache while it is still valid. Once it expires,
834                            /// the next request will result in refreshing the identity.
835                            ///
836                            /// This configuration allows you to disable or change the default caching mechanism.
837                            /// To use a custom caching mechanism, implement the [`ResolveCachedIdentity`](crate::config::ResolveCachedIdentity)
838                            /// trait and pass that implementation into this function.
839                            ///
840                            /// # Examples
841                            ///
842                            /// Disabling identity caching:
843                            /// ```no_run
844                            /// use aws_sdk_signin::config::IdentityCache;
845                            ///
846                            /// let config = aws_sdk_signin::Config::builder()
847                            ///     .identity_cache(IdentityCache::no_cache())
848                            ///     // ...
849                            ///     .build();
850                            /// let client = aws_sdk_signin::Client::from_conf(config);
851                            /// ```
852                            ///
853                            /// Customizing lazy caching:
854                            /// ```no_run
855                            /// use aws_sdk_signin::config::IdentityCache;
856                            /// use std::time::Duration;
857                            ///
858                            /// let config = aws_sdk_signin::Config::builder()
859                            ///     .identity_cache(
860                            ///         IdentityCache::lazy()
861                            ///             // change the load timeout to 10 seconds
862                            ///             .load_timeout(Duration::from_secs(10))
863                            ///             .build()
864                            ///     )
865                            ///     // ...
866                            ///     .build();
867                            /// let client = aws_sdk_signin::Client::from_conf(config);
868                            /// ```
869                        ///
870                            pub fn identity_cache(mut self, identity_cache: impl crate::config::ResolveCachedIdentity + 'static) -> Self {
871                                self.set_identity_cache(identity_cache);
872                                self
873                            }
874
875
876                            /// Set the identity cache for auth.
877                            ///
878                            /// The identity cache defaults to a lazy caching implementation that will resolve
879                            /// an identity when it is requested, and place it in the cache thereafter. Subsequent
880                            /// requests will take the value from the cache while it is still valid. Once it expires,
881                            /// the next request will result in refreshing the identity.
882                            ///
883                            /// This configuration allows you to disable or change the default caching mechanism.
884                            /// To use a custom caching mechanism, implement the [`ResolveCachedIdentity`](crate::config::ResolveCachedIdentity)
885                            /// trait and pass that implementation into this function.
886                            ///
887                            /// # Examples
888                            ///
889                            /// Disabling identity caching:
890                            /// ```no_run
891                            /// use aws_sdk_signin::config::IdentityCache;
892                            ///
893                            /// let config = aws_sdk_signin::Config::builder()
894                            ///     .identity_cache(IdentityCache::no_cache())
895                            ///     // ...
896                            ///     .build();
897                            /// let client = aws_sdk_signin::Client::from_conf(config);
898                            /// ```
899                            ///
900                            /// Customizing lazy caching:
901                            /// ```no_run
902                            /// use aws_sdk_signin::config::IdentityCache;
903                            /// use std::time::Duration;
904                            ///
905                            /// let config = aws_sdk_signin::Config::builder()
906                            ///     .identity_cache(
907                            ///         IdentityCache::lazy()
908                            ///             // change the load timeout to 10 seconds
909                            ///             .load_timeout(Duration::from_secs(10))
910                            ///             .build()
911                            ///     )
912                            ///     // ...
913                            ///     .build();
914                            /// let client = aws_sdk_signin::Client::from_conf(config);
915                            /// ```
916                        ///
917                            pub fn set_identity_cache(&mut self, identity_cache: impl crate::config::ResolveCachedIdentity + 'static) -> &mut Self {
918                                self.runtime_components.set_identity_cache(::std::option::Option::Some(identity_cache));
919                                self
920                            }
921    /// Add an [interceptor](crate::config::Intercept) that runs at specific stages of the request execution pipeline.
922                            ///
923                            /// Interceptors targeted at a certain stage are executed according to the pre-defined priority.
924                            /// The SDK provides a default set of interceptors. An interceptor configured by this method
925                            /// will run after those default interceptors.
926                            ///
927                            /// # Examples
928                            /// ```no_run
929                            /// # fn example() {
930                            /// use aws_smithy_runtime_api::box_error::BoxError;
931                            /// use aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextMut;
932                            /// use aws_smithy_runtime_api::client::interceptors::Intercept;
933                            /// use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
934                            /// use aws_smithy_types::config_bag::ConfigBag;
935                            /// use aws_sdk_signin::config::Config;
936                            /// use ::http::uri::Uri;
937                            ///
938                            /// fn base_url() -> String {
939                            ///     // ...
940                            ///     # String::new()
941                            /// }
942                            ///
943                            /// #[derive(Debug)]
944                            /// pub struct UriModifierInterceptor;
945                            /// impl Intercept for UriModifierInterceptor {
946                            ///     fn name(&self) -> &'static str {
947                            ///         "UriModifierInterceptor"
948                            ///     }
949                            ///     fn modify_before_signing(
950                            ///         &self,
951                            ///         context: &mut BeforeTransmitInterceptorContextMut<'_>,
952                            ///         _runtime_components: &RuntimeComponents,
953                            ///         _cfg: &mut ConfigBag,
954                            ///     ) -> Result<(), BoxError> {
955                            ///         let request = context.request_mut();
956                            ///         let uri = format!("{}{}", base_url(), request.uri());
957                            ///         *request.uri_mut() = uri.parse::<Uri>()?.into();
958                            ///
959                            ///         Ok(())
960                            ///     }
961                            /// }
962                            ///
963                            /// let config = Config::builder()
964                            ///     .interceptor(UriModifierInterceptor)
965                            ///     .build();
966                            /// # }
967                            /// ```
968                            pub fn interceptor(mut self, interceptor: impl crate::config::Intercept + 'static) -> Self {
969                                self.push_interceptor(crate::config::SharedInterceptor::new(interceptor));
970                                self
971                            }
972
973                            /// Like [`Self::interceptor`], but takes a [`SharedInterceptor`](crate::config::SharedInterceptor).
974                            pub fn push_interceptor(&mut self, interceptor: crate::config::SharedInterceptor) -> &mut Self {
975                                self.runtime_components.push_interceptor(interceptor);
976                                self
977                            }
978
979                            /// Set [`SharedInterceptor`](crate::config::SharedInterceptor)s for the builder.
980                            pub fn set_interceptors(&mut self, interceptors: impl IntoIterator<Item = crate::config::SharedInterceptor>) -> &mut Self {
981                                self.runtime_components.set_interceptors(interceptors.into_iter());
982                                self
983                            }
984    /// Sets the time source used for this service
985                            pub fn time_source(
986                                mut self,
987                                time_source: impl ::aws_smithy_async::time::TimeSource + 'static,
988                            ) -> Self {
989                                self.set_time_source(::std::option::Option::Some(::aws_smithy_runtime_api::shared::IntoShared::into_shared(time_source)));
990                                self
991                            }
992    /// Sets the time source used for this service
993                            pub fn set_time_source(
994                                &mut self,
995                                time_source: ::std::option::Option<::aws_smithy_async::time::SharedTimeSource>,
996                            ) -> &mut Self {
997                                self.runtime_components.set_time_source(time_source);
998                                self
999                            }
1000    /// Add type implementing [`ClassifyRetry`](::aws_smithy_runtime_api::client::retries::classifiers::ClassifyRetry) that will be used by the
1001                            /// [`RetryStrategy`](::aws_smithy_runtime_api::client::retries::RetryStrategy) to determine what responses should be retried.
1002                            ///
1003                            /// A retry classifier configured by this method will run according to its [priority](::aws_smithy_runtime_api::client::retries::classifiers::RetryClassifierPriority).
1004                            ///
1005                            /// # Examples
1006                            /// ```no_run
1007                            /// # fn example() {
1008                            /// use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext;
1009                            /// use aws_smithy_runtime_api::client::orchestrator::OrchestratorError;
1010                            /// use aws_smithy_runtime_api::client::retries::classifiers::{
1011                            ///     ClassifyRetry, RetryAction, RetryClassifierPriority,
1012                            /// };
1013                            /// use aws_smithy_types::error::metadata::ProvideErrorMetadata;
1014                            /// use aws_smithy_types::retry::ErrorKind;
1015                            /// use std::error::Error as StdError;
1016                            /// use std::marker::PhantomData;
1017                            /// use std::fmt;
1018                            /// use aws_sdk_signin::config::Config;
1019                            /// # #[derive(Debug)]
1020                            /// # struct SomeOperationError {}
1021                            /// # impl StdError for SomeOperationError {}
1022                            /// # impl fmt::Display for SomeOperationError {
1023                            /// #    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { todo!() }
1024                            /// # }
1025                            /// # impl ProvideErrorMetadata for SomeOperationError {
1026                            /// #    fn meta(&self) -> &aws_sdk_signin::error::ErrorMetadata { todo!() }
1027                            /// # }
1028                            ///
1029                            /// const RETRYABLE_ERROR_CODES: &[&str] = &[
1030                            ///     // List error codes to be retried here...
1031                            /// ];
1032                            ///
1033                            /// // When classifying at an operation's error type, classifiers require a generic parameter.
1034                            /// // When classifying the HTTP response alone, no generic is needed.
1035                            /// #[derive(Debug, Default)]
1036                            /// pub struct ExampleErrorCodeClassifier<E> {
1037                            ///     _inner: PhantomData<E>,
1038                            /// }
1039                            ///
1040                            /// impl<E> ExampleErrorCodeClassifier<E> {
1041                            ///     pub fn new() -> Self {
1042                            ///         Self {
1043                            ///             _inner: PhantomData,
1044                            ///         }
1045                            ///     }
1046                            /// }
1047                            ///
1048                            /// impl<E> ClassifyRetry for ExampleErrorCodeClassifier<E>
1049                            /// where
1050                            ///     // Adding a trait bound for ProvideErrorMetadata allows us to inspect the error code.
1051                            ///     E: StdError + ProvideErrorMetadata + Send + Sync + 'static,
1052                            /// {
1053                            ///     fn classify_retry(&self, ctx: &InterceptorContext) -> RetryAction {
1054                            ///         // Check for a result
1055                            ///         let output_or_error = ctx.output_or_error();
1056                            ///         // Check for an error
1057                            ///         let error = match output_or_error {
1058                            ///             Some(Ok(_)) | None => return RetryAction::NoActionIndicated,
1059                            ///               Some(Err(err)) => err,
1060                            ///         };
1061                            ///
1062                            ///         // Downcast the generic error and extract the code
1063                            ///         let error_code = OrchestratorError::as_operation_error(error)
1064                            ///             .and_then(|err| err.downcast_ref::<E>())
1065                            ///             .and_then(|err| err.code());
1066                            ///
1067                            ///         // If this error's code is in our list, return an action that tells the RetryStrategy to retry this request.
1068                            ///         if let Some(error_code) = error_code {
1069                            ///             if RETRYABLE_ERROR_CODES.contains(&error_code) {
1070                            ///                 return RetryAction::transient_error();
1071                            ///             }
1072                            ///         }
1073                            ///
1074                            ///         // Otherwise, return that no action is indicated i.e. that this classifier doesn't require a retry.
1075                            ///         // Another classifier may still classify this response as retryable.
1076                            ///         RetryAction::NoActionIndicated
1077                            ///     }
1078                            ///
1079                            ///     fn name(&self) -> &'static str { "Example Error Code Classifier" }
1080                            /// }
1081                            ///
1082                            /// let config = Config::builder()
1083                            ///     .retry_classifier(ExampleErrorCodeClassifier::<SomeOperationError>::new())
1084                            ///     .build();
1085                            /// # }
1086                            /// ```
1087                            pub fn retry_classifier(mut self, retry_classifier: impl ::aws_smithy_runtime_api::client::retries::classifiers::ClassifyRetry + 'static) -> Self {
1088                                self.push_retry_classifier(::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier::new(retry_classifier));
1089                                self
1090                            }
1091
1092                            /// Like [`Self::retry_classifier`], but takes a [`SharedRetryClassifier`](::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier).
1093                            pub fn push_retry_classifier(&mut self, retry_classifier: ::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier) -> &mut Self {
1094                                self.runtime_components.push_retry_classifier(retry_classifier);
1095                                self
1096                            }
1097
1098                            /// Set [`SharedRetryClassifier`](::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier)s for the builder, replacing any that
1099                            /// were previously set.
1100                            pub fn set_retry_classifiers(&mut self, retry_classifiers: impl IntoIterator<Item = ::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier>) -> &mut Self {
1101                                self.runtime_components.set_retry_classifiers(retry_classifiers.into_iter());
1102                                self
1103                            }
1104    /// Sets the name of the app that is using the client.
1105                                ///
1106                                /// This _optional_ name is used to identify the application in the user agent that
1107                                /// gets sent along with requests.
1108                                pub fn app_name(mut self, app_name: ::aws_types::app_name::AppName) -> Self {
1109                                    self.set_app_name(Some(app_name));
1110                                    self
1111                                }
1112    /// Sets the name of the app that is using the client.
1113                                ///
1114                                /// This _optional_ name is used to identify the application in the user agent that
1115                                /// gets sent along with requests.
1116                                pub fn set_app_name(&mut self, app_name: ::std::option::Option<::aws_types::app_name::AppName>) -> &mut Self {
1117                                    self.config.store_or_unset(app_name);
1118                                    self
1119                                }
1120    /// Appends framework metadata to the user agent.
1121                                ///
1122                                /// This _optional_ metadata identifies a software framework or third-party library
1123                                /// that is being used with the client. It is rendered into the user agent string
1124                                /// (as `lib/{name}/{version}`) so that libraries built on top of the AWS SDK can
1125                                /// self-identify in the requests they make. Multiple entries may be added; each call
1126                                /// appends another entry rather than replacing previous ones.
1127                                ///
1128                                /// Entries are de-duplicated on `(name, version)`, rendered in first-seen order, and
1129                                /// the total number of unique entries included in the user agent is capped (currently
1130                                /// at 10); additional entries beyond the cap are dropped with a warning.
1131                                pub fn framework_metadata(mut self, framework_metadata: ::aws_types::sdk_ua_metadata::FrameworkMetadata) -> Self {
1132                                    self.push_framework_metadata(framework_metadata);
1133                                    self
1134                                }
1135    /// Appends framework metadata to the user agent.
1136                                ///
1137                                /// This _optional_ metadata identifies a software framework or third-party library
1138                                /// that is being used with the client. It is rendered into the user agent string
1139                                /// (as `lib/{name}/{version}`) so that libraries built on top of the AWS SDK can
1140                                /// self-identify in the requests they make. Multiple entries may be added; each call
1141                                /// appends another entry rather than replacing previous ones.
1142                                pub fn push_framework_metadata(&mut self, framework_metadata: ::aws_types::sdk_ua_metadata::FrameworkMetadata) -> &mut Self {
1143                                    self.config.store_append(framework_metadata);
1144                                    self
1145                                }
1146    /// Overrides the default invocation ID generator.
1147    ///
1148    /// The invocation ID generator generates ID values for the `amz-sdk-invocation-id` header. By default, this will be a random UUID. Overriding it may be useful in tests that examine the HTTP request and need to be deterministic.
1149    pub fn invocation_id_generator(mut self, gen: impl ::aws_runtime::invocation_id::InvocationIdGenerator + 'static) -> Self {
1150                                self.set_invocation_id_generator(::std::option::Option::Some(::aws_runtime::invocation_id::SharedInvocationIdGenerator::new(gen)));
1151                                self
1152                            }
1153    /// Overrides the default invocation ID generator.
1154    ///
1155    /// The invocation ID generator generates ID values for the `amz-sdk-invocation-id` header. By default, this will be a random UUID. Overriding it may be useful in tests that examine the HTTP request and need to be deterministic.
1156    pub fn set_invocation_id_generator(&mut self, gen: ::std::option::Option<::aws_runtime::invocation_id::SharedInvocationIdGenerator>) -> &mut Self {
1157                                self.config.store_or_unset(gen);
1158                                self
1159                            }
1160    /// Sets the endpoint URL used to communicate with this service.
1161    ///
1162    /// Note: this is used in combination with other endpoint rules, e.g. an API that applies a host-label prefix
1163    /// will be prefixed onto this URL. To fully override the endpoint resolver, use
1164    /// [`Builder::endpoint_resolver`].
1165    pub fn endpoint_url(mut self, endpoint_url: impl Into<::std::string::String>) -> Self {
1166                                    self.set_endpoint_url(Some(endpoint_url.into()));
1167                                    self
1168                        }
1169    /// Sets the endpoint URL used to communicate with this service.
1170    ///
1171    /// Note: this is used in combination with other endpoint rules, e.g. an API that applies a host-label prefix
1172    /// will be prefixed onto this URL. To fully override the endpoint resolver, use
1173    /// [`Builder::endpoint_resolver`].
1174    pub fn set_endpoint_url(&mut self, endpoint_url: Option<::std::string::String>) -> &mut Self {
1175                                    self.config.store_or_unset(endpoint_url.map(::aws_types::endpoint_config::EndpointUrl));
1176                                    self
1177                                }
1178    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1179    pub fn use_dual_stack(mut self, use_dual_stack: impl Into<bool>) -> Self {
1180                                    self.set_use_dual_stack(Some(use_dual_stack.into()));
1181                                    self
1182                        }
1183    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1184    pub fn set_use_dual_stack(&mut self, use_dual_stack: Option<bool>) -> &mut Self {
1185                                    self.config.store_or_unset(use_dual_stack.map(::aws_types::endpoint_config::UseDualStack));
1186                                    self
1187                                }
1188    /// When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
1189    pub fn use_fips(mut self, use_fips: impl Into<bool>) -> Self {
1190                                    self.set_use_fips(Some(use_fips.into()));
1191                                    self
1192                        }
1193    /// When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
1194    pub fn set_use_fips(&mut self, use_fips: Option<bool>) -> &mut Self {
1195                                    self.config.store_or_unset(use_fips.map(::aws_types::endpoint_config::UseFips));
1196                                    self
1197                                }
1198    /// Sets the AWS region to use when making requests.
1199                            ///
1200                            /// # Examples
1201                            /// ```no_run
1202                            /// use aws_types::region::Region;
1203                            /// use aws_sdk_signin::config::{Builder, Config};
1204                            ///
1205                            /// let config = aws_sdk_signin::Config::builder()
1206                            ///     .region(Region::new("us-east-1"))
1207                            ///     .build();
1208                            /// ```
1209                            pub fn region(mut self, region: impl ::std::convert::Into<::std::option::Option<crate::config::Region>>) -> Self {
1210                                self.set_region(region.into());
1211                                self
1212                            }
1213    /// Sets the AWS region to use when making requests.
1214                            pub fn set_region(&mut self, region: ::std::option::Option<crate::config::Region>) -> &mut Self {
1215                                self.config.store_or_unset(region);
1216                                self
1217                            }
1218    /// Sets the credentials provider for this service
1219                            pub fn credentials_provider(mut self, credentials_provider: impl crate::config::ProvideCredentials + 'static) -> Self {
1220                                self.set_credentials_provider(::std::option::Option::Some(crate::config::SharedCredentialsProvider::new(credentials_provider)));
1221                                self
1222                            }
1223    /// Sets the credentials provider for this service
1224                            pub fn set_credentials_provider(&mut self, credentials_provider: ::std::option::Option<crate::config::SharedCredentialsProvider>) -> &mut Self {
1225        if let Some(credentials_provider) = credentials_provider {
1226            self.runtime_components.set_identity_resolver(::aws_runtime::auth::sigv4::SCHEME_ID, credentials_provider);
1227        }
1228        self
1229    }
1230    /// Sets the [`behavior major version`](crate::config::BehaviorVersion).
1231                    ///
1232                    /// Over time, new best-practice behaviors are introduced. However, these behaviors might not be backwards
1233                    /// compatible. For example, a change which introduces new default timeouts or a new retry-mode for
1234                    /// all operations might be the ideal behavior but could break existing applications.
1235                    ///
1236                    /// # Examples
1237                    ///
1238                    /// Set the behavior major version to `latest`. This is equivalent to enabling the `behavior-version-latest` cargo feature.
1239                    /// ```no_run
1240                    /// use aws_sdk_signin::config::BehaviorVersion;
1241                    ///
1242                    /// let config = aws_sdk_signin::Config::builder()
1243                    ///     .behavior_version(BehaviorVersion::latest())
1244                    ///     // ...
1245                    ///     .build();
1246                    /// let client = aws_sdk_signin::Client::from_conf(config);
1247                    /// ```
1248                    ///
1249                    /// Customizing behavior major version:
1250                    /// ```no_run
1251                    /// use aws_sdk_signin::config::BehaviorVersion;
1252                    ///
1253                    /// let config = aws_sdk_signin::Config::builder()
1254                    ///     .behavior_version(BehaviorVersion::v2023_11_09())
1255                    ///     // ...
1256                    ///     .build();
1257                    /// let client = aws_sdk_signin::Client::from_conf(config);
1258                    /// ```
1259                ///
1260                    pub fn behavior_version(mut self, behavior_version: crate::config::BehaviorVersion) -> Self {
1261                        self.set_behavior_version(Some(behavior_version));
1262                        self
1263                    }
1264
1265
1266                    /// Sets the [`behavior major version`](crate::config::BehaviorVersion).
1267                    ///
1268                    /// Over time, new best-practice behaviors are introduced. However, these behaviors might not be backwards
1269                    /// compatible. For example, a change which introduces new default timeouts or a new retry-mode for
1270                    /// all operations might be the ideal behavior but could break existing applications.
1271                    ///
1272                    /// # Examples
1273                    ///
1274                    /// Set the behavior major version to `latest`. This is equivalent to enabling the `behavior-version-latest` cargo feature.
1275                    /// ```no_run
1276                    /// use aws_sdk_signin::config::BehaviorVersion;
1277                    ///
1278                    /// let config = aws_sdk_signin::Config::builder()
1279                    ///     .behavior_version(BehaviorVersion::latest())
1280                    ///     // ...
1281                    ///     .build();
1282                    /// let client = aws_sdk_signin::Client::from_conf(config);
1283                    /// ```
1284                    ///
1285                    /// Customizing behavior major version:
1286                    /// ```no_run
1287                    /// use aws_sdk_signin::config::BehaviorVersion;
1288                    ///
1289                    /// let config = aws_sdk_signin::Config::builder()
1290                    ///     .behavior_version(BehaviorVersion::v2023_11_09())
1291                    ///     // ...
1292                    ///     .build();
1293                    /// let client = aws_sdk_signin::Client::from_conf(config);
1294                    /// ```
1295                ///
1296                    pub fn set_behavior_version(&mut self, behavior_version: Option<crate::config::BehaviorVersion>) -> &mut Self {
1297                        self.behavior_version = behavior_version;
1298                        self
1299                    }
1300
1301                    /// Convenience method to set the latest behavior major version
1302                    ///
1303                    /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
1304                    pub fn behavior_version_latest(mut self) -> Self {
1305                        self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
1306                        self
1307                    }
1308    /// Adds a runtime plugin to the config.
1309    #[allow(unused)]
1310    pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
1311                        self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
1312                        self
1313                    }
1314    /// Adds a runtime plugin to the config.
1315    #[allow(unused)]
1316    pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
1317                        self.runtime_plugins.push(plugin);
1318                        self
1319                    }
1320    #[cfg(any(feature = "test-util", test))]
1321    #[allow(unused_mut)]
1322    /// Apply test defaults to the builder. NOTE: Consider migrating to use `apply_test_defaults_v2` instead.
1323    pub fn apply_test_defaults(&mut self) -> &mut Self {
1324        self.set_idempotency_token_provider(Some("00000000-0000-4000-8000-000000000000".into()));
1325        self
1326                                    .set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
1327                                        ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)))
1328                                    ));
1329        self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
1330        self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(::aws_credential_types::Credentials::for_tests())));
1331        self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
1332        self
1333    }
1334    #[cfg(any(feature = "test-util", test))]
1335    #[allow(unused_mut)]
1336    /// Apply test defaults to the builder. NOTE: Consider migrating to use `with_test_defaults_v2` instead.
1337    pub fn with_test_defaults(mut self) -> Self {
1338        self.apply_test_defaults(); self
1339    }
1340    #[cfg(any(feature = "test-util", test))]
1341    #[allow(unused_mut)]
1342    /// Apply test defaults to the builder. V2 of this function sets additional test defaults such as region configuration (if applicable).
1343    pub fn apply_test_defaults_v2(&mut self) -> &mut Self {
1344        self.apply_test_defaults();
1345        if self.config.load::<crate::config::Region>().is_none() {
1346                                    self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
1347                                }
1348        self
1349    }
1350    #[cfg(any(feature = "test-util", test))]
1351    #[allow(unused_mut)]
1352    /// Apply test defaults to the builder. V2 of this function sets additional test defaults such as region configuration (if applicable).
1353    pub fn with_test_defaults_v2(mut self) -> Self {
1354        self.apply_test_defaults_v2(); self
1355    }
1356    /// Builds a [`Config`].
1357    #[allow(unused_mut)]
1358    pub fn build(mut self) -> Config {
1359        let mut layer = self.config;
1360        if self.runtime_components.time_source().is_none() {
1361                                    self.runtime_components.set_time_source(::std::option::Option::Some(::std::default::Default::default()));
1362                                }
1363        layer.store_put(crate::meta::API_METADATA.clone());
1364        layer.store_put(::aws_types::SigningName::from_static("signin"));
1365                                    layer.load::<::aws_types::region::Region>().cloned().map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
1366        Config {
1367            config: crate::config::Layer::from(layer.clone()).with_name("aws_sdk_signin::config::Config").freeze(),
1368                                    cloneable: layer,
1369                                    runtime_components: self.runtime_components,
1370                                    runtime_plugins: self.runtime_plugins,
1371                                    behavior_version: self.behavior_version,
1372        }
1373    }
1374}
1375#[derive(::std::fmt::Debug)]
1376            pub(crate) struct ServiceRuntimePlugin {
1377                config: ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer>,
1378                runtime_components: ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
1379            }
1380
1381            impl ServiceRuntimePlugin {
1382                pub fn new(_service_config: crate::config::Config) -> Self {
1383                    let config = { let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Signin");
1384                            cfg.store_put(crate::idempotency_token::default_provider());
1385cfg.store_put(::aws_smithy_runtime::client::orchestrator::AuthSchemeAndEndpointOrchestrationV2);
1386                            ::std::option::Option::Some(cfg.freeze()) };
1387                    let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin");
1388                    runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some({
1389            use crate::config::auth::ResolveAuthScheme;
1390            crate::config::auth::DefaultAuthSchemeResolver::default().into_shared_resolver()
1391            }));
1392runtime_components.set_endpoint_resolver(::std::option::Option::Some({
1393                use crate::config::endpoint::ResolveEndpoint;
1394                crate::config::endpoint::DefaultResolver::new().into_shared_resolver()
1395                }));
1396runtime_components.push_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new()));
1397runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default());
1398runtime_components.push_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(crate::sdk_feature_tracker::retry_mode::RetryModeFeatureTrackerInterceptor::new()));
1399runtime_components.push_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(::aws_runtime::service_clock_skew::ServiceClockSkewInterceptor::new()));
1400runtime_components.push_interceptor(::aws_runtime::request_info::RequestInfoInterceptor::new());
1401runtime_components.push_interceptor(::aws_runtime::user_agent::UserAgentInterceptor::new());
1402runtime_components.push_interceptor(::aws_runtime::invocation_id::InvocationIdInterceptor::new());
1403runtime_components.push_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(::aws_runtime::recursion_detection::RecursionDetectionInterceptor::new()));
1404runtime_components.push_auth_scheme(::aws_smithy_runtime_api::client::auth::SharedAuthScheme::new(::aws_runtime::auth::sigv4::SigV4AuthScheme::new()));
1405runtime_components.push_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(crate::config::endpoint::EndpointOverrideFeatureTrackerInterceptor));
1406runtime_components.push_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(crate::observability_feature::ObservabilityFeatureTrackerInterceptor));
1407                    Self { config, runtime_components }
1408                }
1409            }
1410
1411            impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ServiceRuntimePlugin {
1412                fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
1413                    self.config.clone()
1414                }
1415
1416                fn order(&self) -> ::aws_smithy_runtime_api::client::runtime_plugin::Order {
1417                    ::aws_smithy_runtime_api::client::runtime_plugin::Order::Defaults
1418                }
1419
1420                fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
1421                    ::std::borrow::Cow::Borrowed(&self.runtime_components)
1422                }
1423            }
1424
1425            // Cross-operation shared-state singletons
1426
1427/// A plugin that enables configuration for a single operation invocation
1428            ///
1429            /// The `config` method will return a `FrozenLayer` by storing values from `config_override`.
1430            /// In the case of default values requested, they will be obtained from `client_config`.
1431            #[derive(Debug)]
1432            pub(crate) struct ConfigOverrideRuntimePlugin {
1433                pub(crate) config: ::aws_smithy_types::config_bag::FrozenLayer,
1434                pub(crate) components: ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
1435            }
1436
1437            impl ConfigOverrideRuntimePlugin {
1438                #[allow(dead_code)] // unused when a service does not provide any operations
1439                pub(crate) fn new(
1440                    config_override: Builder,
1441                    initial_config: ::aws_smithy_types::config_bag::FrozenLayer,
1442                    initial_components: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder
1443                ) -> Self {
1444                    let mut layer = config_override.config;
1445                    let mut components = config_override.runtime_components;
1446                    #[allow(unused_mut)]
1447                    let mut resolver = ::aws_smithy_runtime::client::config_override::Resolver::overrid(initial_config, initial_components, &mut layer, &mut components);
1448
1449                    resolver.config_mut()
1450                                .load::<::aws_types::region::Region>()
1451                                .cloned()
1452                                .map(|r| resolver.config_mut().store_put(::aws_types::region::SigningRegion::from(r)));
1453
1454                    let _ = resolver;
1455
1456                    // When the config override supplies an identity resolver for any auth scheme
1457                    // known to the client or the override itself, we give this operation its own
1458                    // short-lived identity cache so that new partitions don't accumulate in the
1459                    // shared client cache. A lazy cache (not `no_cache`) is used so that resolved
1460                    // identities are served from the short-lived identity cache on retries.
1461                    //
1462                    // This is skipped if the override already sets its own identity cache.
1463                    if components.has_identity_resolvers() && components.identity_cache().is_none() {
1464                        components.set_identity_cache(::std::option::Option::Some(::aws_smithy_runtime::client::identity::IdentityCache::lazy().max_partitions(1).build()));
1465                    }
1466
1467                    Self {
1468                        config: ::aws_smithy_types::config_bag::Layer::from(layer)
1469                            .with_name("aws_sdk_signin::config::ConfigOverrideRuntimePlugin").freeze(),
1470                        components,
1471                    }
1472                }
1473            }
1474
1475            impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ConfigOverrideRuntimePlugin {
1476                fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
1477                    Some(self.config.clone())
1478                }
1479
1480                fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
1481                    ::std::borrow::Cow::Borrowed(&self.components)
1482                }
1483            }
1484
1485pub use ::aws_smithy_types::config_bag::ConfigBag;
1486                pub use ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
1487                pub use ::aws_smithy_runtime::client::identity::IdentityCache;
1488
1489pub use ::aws_credential_types::Credentials;
1490
1491impl From<&::aws_types::sdk_config::SdkConfig> for Builder {
1492                    fn from(input: &::aws_types::sdk_config::SdkConfig) -> Self {
1493                        let mut builder = Builder::default();
1494                        builder.set_credentials_provider(input.credentials_provider());
1495builder =
1496                         builder.region(input.region().cloned());
1497builder.set_use_fips(input.use_fips());
1498builder.set_use_dual_stack(input.use_dual_stack());
1499if input.get_origin("endpoint_url").is_client_config() {
1500                builder.set_endpoint_url(input.endpoint_url().map(|s|s.to_string()));
1501            } else {
1502                builder.set_endpoint_url(
1503                    input
1504                        .service_config()
1505                        .and_then(|conf| conf.load_config(service_config_key("Signin", "AWS_ENDPOINT_URL", "endpoint_url")).map(|it| it.parse().unwrap()))
1506                        .or_else(|| input.endpoint_url().map(|s|s.to_string()))
1507                );
1508            }
1509// resiliency
1510                    builder.set_retry_config(input.retry_config().cloned());
1511                    builder.set_timeout_config(input.timeout_config().cloned());
1512                    builder.set_sleep_impl(input.sleep_impl());
1513
1514                    builder.set_http_client(input.http_client());
1515                    builder.set_time_source(input.time_source());
1516                    builder.set_behavior_version(input.behavior_version());
1517                    builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
1518// setting `None` here removes the default
1519                    if let Some(config) = input.stalled_stream_protection() {
1520                        builder.set_stalled_stream_protection(Some(config));
1521                    }
1522
1523                    if let Some(cache) = input.identity_cache() {
1524                        builder.set_identity_cache(cache);
1525                    }
1526builder.set_app_name(input.app_name().cloned());
1527for framework_metadata in input.framework_metadata() {
1528                        builder.push_framework_metadata(framework_metadata.clone());
1529                    }
1530
1531                        builder
1532                    }
1533                }
1534
1535                impl From<&::aws_types::sdk_config::SdkConfig> for Config {
1536                    fn from(sdk_config: &::aws_types::sdk_config::SdkConfig) -> Self {
1537                        Builder::from(sdk_config).build()
1538                    }
1539                }
1540
1541pub use ::aws_types::app_name::AppName;
1542pub use ::aws_types::sdk_ua_metadata::FrameworkMetadata;
1543
1544#[allow(dead_code)]
1545fn service_config_key<'a>(
1546                    service_id: &'a str,
1547                    env: &'a str,
1548                    profile: &'a str,
1549                ) -> aws_types::service_config::ServiceConfigKey<'a> {
1550                    ::aws_types::service_config::ServiceConfigKey::builder()
1551                        .service_id(service_id)
1552                        .env(env)
1553                        .profile(profile)
1554                        .build()
1555                        .expect("all field sets explicitly, can't fail")
1556                }
1557
1558pub use ::aws_smithy_async::rt::sleep::{Sleep};
1559
1560pub(crate) fn base_client_runtime_plugins(
1561                    mut config: crate::Config,
1562                ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
1563                    let mut configured_plugins = ::std::vec::Vec::new();
1564                    ::std::mem::swap(&mut config.runtime_plugins, &mut configured_plugins);
1565                    #[cfg(feature = "behavior-version-latest")] {
1566    if config.behavior_version.is_none() {
1567                                    config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest());
1568                                }
1569}
1570
1571                    let default_retry_partition = "signin";
1572                    let default_retry_partition = match config.region() {
1573                            Some(region) => ::std::borrow::Cow::from(format!("{default_retry_partition}-{region}")),
1574                            None => ::std::borrow::Cow::from(default_retry_partition),
1575                        };
1576
1577                    let scope = "aws-sdk-signin";
1578
1579                    #[allow(deprecated)]
1580                    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
1581                        // defaults
1582                        .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins(
1583                            ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new()
1584                                .with_retry_partition_name(default_retry_partition)
1585                                .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature."))
1586                                .with_is_aws_sdk(true)
1587                        ))
1588                        // user config
1589                        .with_client_plugin(
1590                            ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new()
1591                                .with_config(config.config.clone())
1592                                .with_runtime_components(config.runtime_components.clone())
1593                        )
1594                        // codegen config
1595                        .with_client_plugin(crate::config::ServiceRuntimePlugin::new(config.clone()))
1596                        .with_client_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePlugin::new())
1597                        .with_client_plugin(
1598                            ::aws_smithy_runtime::client::metrics::MetricsRuntimePlugin::builder()
1599                                .with_scope(scope)
1600                                .with_time_source(config.runtime_components.time_source().unwrap_or_default())
1601                                .build()
1602                                .expect("All required fields have been set")
1603                        );
1604
1605
1606
1607                    for plugin in configured_plugins {
1608                        plugins = plugins.with_client_plugin(plugin);
1609                    }
1610                    plugins
1611                }
1612
1613pub use ::aws_smithy_types::config_bag::FrozenLayer;
1614
1615pub use ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder;
1616
1617pub use ::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin;
1618
1619pub use ::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion;
1620
1621pub use ::aws_smithy_runtime_api::client::stalled_stream_protection::StalledStreamProtectionConfig;
1622
1623pub use ::aws_smithy_runtime_api::client::http::SharedHttpClient;
1624
1625pub use ::aws_smithy_async::rt::sleep::SharedAsyncSleep;
1626
1627pub use ::aws_smithy_runtime_api::client::identity::SharedIdentityCache;
1628
1629pub use ::aws_smithy_runtime_api::client::interceptors::SharedInterceptor;
1630
1631pub use ::aws_types::region::Region;
1632
1633pub use ::aws_credential_types::provider::SharedCredentialsProvider;
1634
1635pub use ::aws_smithy_runtime_api::client::http::HttpClient;
1636
1637pub use ::aws_smithy_runtime_api::shared::IntoShared;
1638
1639pub use ::aws_smithy_async::rt::sleep::AsyncSleep;
1640
1641pub use ::aws_smithy_runtime_api::client::identity::ResolveCachedIdentity;
1642
1643pub use ::aws_smithy_runtime_api::client::interceptors::Intercept;
1644
1645pub use ::aws_credential_types::provider::ProvideCredentials;
1646
1647pub use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
1648
1649pub use ::aws_smithy_types::config_bag::Layer;
1650
1651/// Types needed to configure endpoint resolution.
1652pub mod endpoint;
1653
1654/// HTTP request and response types.
1655pub mod http;
1656
1657/// Types needed to implement [`Intercept`](crate::config::Intercept).
1658pub mod interceptors;
1659
1660/// Retry configuration.
1661///
1662/// [`RetryConfig`](crate::config::retry::RetryConfig) sets the number of retry attempts and the backoff between them. Retries are additionally bounded by a retry token bucket (a shared retry quota): [`TokenBucket`](crate::config::retry::TokenBucket) holds the tokens and [`RetryPartition`](crate::config::retry::RetryPartition) determines which clients and operations share one. To size the token bucket or give a workload its own, use [`Builder::retry_partition`](crate::config::Builder::retry_partition).
1663pub mod retry;
1664
1665/// Timeout configuration.
1666pub mod timeout;
1667
1668/// Types needed to configure auth scheme resolution.
1669pub mod auth;
1670