aws_sdk_macie/
config.rs

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