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