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