aws_sdk_dynamodb/
config.rs

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