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