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