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