1273 1273 | }
|
1274 1274 | #[derive(::std::fmt::Debug)]
|
1275 1275 | pub(crate) struct ServiceRuntimePlugin {
|
1276 1276 | config: ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer>,
|
1277 1277 | runtime_components: ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
|
1278 1278 | }
|
1279 1279 |
|
1280 1280 | impl ServiceRuntimePlugin {
|
1281 1281 | pub fn new(_service_config: crate::config::Config) -> Self {
|
1282 1282 | let config = {
|
1283 1283 | let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Transcribe");
|
1284 1284 | cfg.store_put(::aws_smithy_runtime::client::orchestrator::AuthSchemeAndEndpointOrchestrationV2);
|
1285 1285 | ::std::option::Option::Some(cfg.freeze())
|
1286 1286 | };
|
1287 1287 | let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin");
|
1288 1288 | runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some({
|
1289 1289 | use crate::config::auth::ResolveAuthScheme;
|
1290 1290 | crate::config::auth::DefaultAuthSchemeResolver::default().into_shared_resolver()
|
1291 1291 | }));
|
1292 1292 | runtime_components.set_endpoint_resolver(::std::option::Option::Some({
|
1293 1293 | use crate::config::endpoint::ResolveEndpoint;
|
1294 1294 | crate::config::endpoint::DefaultResolver::new().into_shared_resolver()
|
1295 1295 | }));
|
1296 1296 | runtime_components.push_interceptor(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new());
|
1297 1297 | runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default());
|
1298 1298 | runtime_components.push_interceptor(crate::sdk_feature_tracker::retry_mode::RetryModeFeatureTrackerInterceptor::new());
|
1299 1299 | runtime_components.push_interceptor(::aws_runtime::service_clock_skew::ServiceClockSkewInterceptor::new());
|
1300 1300 | runtime_components.push_interceptor(::aws_runtime::request_info::RequestInfoInterceptor::new());
|
1301 1301 | runtime_components.push_interceptor(::aws_runtime::user_agent::UserAgentInterceptor::new());
|
1302 1302 | runtime_components.push_interceptor(::aws_runtime::invocation_id::InvocationIdInterceptor::new());
|
1303 + | runtime_components.push_interceptor(::aws_runtime::observability_detection::ObservabilityDetectionInterceptor::new());
|
1303 1304 | runtime_components.push_interceptor(::aws_runtime::recursion_detection::RecursionDetectionInterceptor::new());
|
1304 1305 | runtime_components.push_auth_scheme(::aws_smithy_runtime_api::client::auth::SharedAuthScheme::new(
|
1305 1306 | ::aws_runtime::auth::sigv4::SigV4AuthScheme::new(),
|
1306 1307 | ));
|
1307 1308 | Self { config, runtime_components }
|
1308 1309 | }
|
1309 1310 | }
|
1310 1311 |
|
1311 1312 | impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ServiceRuntimePlugin {
|
1312 1313 | fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
|
1313 1314 | self.config.clone()
|
1314 1315 | }
|
1315 1316 |
|
1316 1317 | fn order(&self) -> ::aws_smithy_runtime_api::client::runtime_plugin::Order {
|
1317 1318 | ::aws_smithy_runtime_api::client::runtime_plugin::Order::Defaults
|
1318 1319 | }
|
1319 1320 |
|
1320 1321 | fn runtime_components(
|
1321 1322 | &self,
|
1322 1323 | _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
|
1323 1324 | ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
|
1324 1325 | ::std::borrow::Cow::Borrowed(&self.runtime_components)
|
1325 1326 | }
|
1326 1327 | }
|
1327 1328 |
|
1328 1329 | // Cross-operation shared-state singletons
|
1329 1330 |
|
1330 1331 | /// A plugin that enables configuration for a single operation invocation
|
1331 1332 | ///
|
1332 1333 | /// The `config` method will return a `FrozenLayer` by storing values from `config_override`.
|
1363 1364 | .freeze(),
|
1364 1365 | components,
|
1365 1366 | }
|
1366 1367 | }
|
1367 1368 | }
|
1368 1369 |
|
1369 1370 | impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ConfigOverrideRuntimePlugin {
|
1370 1371 | fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
|
1371 1372 | Some(self.config.clone())
|
1372 1373 | }
|
1373 1374 |
|
1374 1375 | fn runtime_components(
|
1375 1376 | &self,
|
1376 1377 | _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
|
1377 1378 | ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
|
1378 1379 | ::std::borrow::Cow::Borrowed(&self.components)
|
1379 1380 | }
|
1380 1381 | }
|
1381 1382 |
|
1382 1383 | pub use ::aws_smithy_runtime::client::identity::IdentityCache;
|
1383 1384 | pub use ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
|
1384 1385 | pub use ::aws_smithy_types::config_bag::ConfigBag;
|
1385 1386 |
|
1386 1387 | pub use ::aws_credential_types::Credentials;
|
1387 1388 |
|
1388 1389 | impl From<&::aws_types::sdk_config::SdkConfig> for Builder {
|
1389 1390 | fn from(input: &::aws_types::sdk_config::SdkConfig) -> Self {
|
1390 1391 | let mut builder = Builder::default();
|
1391 1392 | builder.set_credentials_provider(input.credentials_provider());
|
1392 1393 | builder = builder.region(input.region().cloned());
|
1394 + | // Track endpoint override metric if endpoint URL is configured from any source
|
1395 + | let has_global_endpoint = input.endpoint_url().is_some();
|
1396 + | let has_service_specific_endpoint = input
|
1397 + | .service_config()
|
1398 + | .and_then(|conf| conf.load_config(service_config_key("Transcribe Streaming", "AWS_ENDPOINT_URL", "endpoint_url")))
|
1399 + | .is_some();
|
1400 + |
|
1401 + | if has_global_endpoint || has_service_specific_endpoint {
|
1402 + | builder.push_runtime_plugin(::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin::new(
|
1403 + | ::aws_runtime::endpoint_override::EndpointOverrideRuntimePlugin::new_with_feature_flag(),
|
1404 + | ));
|
1405 + | }
|
1393 1406 | builder.set_use_fips(input.use_fips());
|
1394 1407 | builder.set_use_dual_stack(input.use_dual_stack());
|
1395 1408 | if input.get_origin("endpoint_url").is_client_config() {
|
1396 1409 | builder.set_endpoint_url(input.endpoint_url().map(|s| s.to_string()));
|
1397 1410 | } else {
|
1398 1411 | builder.set_endpoint_url(
|
1399 1412 | input
|
1400 1413 | .service_config()
|
1401 1414 | .and_then(|conf| {
|
1402 1415 | conf.load_config(service_config_key("Transcribe Streaming", "AWS_ENDPOINT_URL", "endpoint_url"))
|
1403 1416 | .map(|it| it.parse().unwrap())
|
1404 1417 | })
|
1405 1418 | .or_else(|| input.endpoint_url().map(|s| s.to_string())),
|
1406 1419 | );
|
1407 1420 | }
|
1408 1421 | // resiliency
|
1409 1422 | builder.set_retry_config(input.retry_config().cloned());
|
1410 1423 | builder.set_timeout_config(input.timeout_config().cloned());
|
1411 1424 | builder.set_sleep_impl(input.sleep_impl());
|
1412 1425 |
|
1413 1426 | builder.set_http_client(input.http_client());
|
1414 1427 | builder.set_time_source(input.time_source());
|
1415 1428 | builder.set_behavior_version(input.behavior_version());
|
1416 1429 | builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
|
1417 1430 | // setting `None` here removes the default
|
1418 1431 | if let Some(config) = input.stalled_stream_protection() {
|
1419 1432 | builder.set_stalled_stream_protection(Some(config));
|
1420 1433 | }
|
1421 1434 |
|
1422 1435 | if let Some(cache) = input.identity_cache() {
|