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