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