Skip to main content

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