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