1430 1430 | .freeze(),
|
1431 1431 | components,
|
1432 1432 | }
|
1433 1433 | }
|
1434 1434 | }
|
1435 1435 |
|
1436 1436 | impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ConfigOverrideRuntimePlugin {
|
1437 1437 | fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
|
1438 1438 | Some(self.config.clone())
|
1439 1439 | }
|
1440 1440 |
|
1441 1441 | fn runtime_components(
|
1442 1442 | &self,
|
1443 1443 | _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
|
1444 1444 | ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
|
1445 1445 | ::std::borrow::Cow::Borrowed(&self.components)
|
1446 1446 | }
|
1447 1447 | }
|
1448 1448 |
|
1449 1449 | pub use ::aws_smithy_runtime::client::identity::IdentityCache;
|
1450 1450 | pub use ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
|
1451 1451 | pub use ::aws_smithy_types::config_bag::ConfigBag;
|
1452 1452 |
|
1453 1453 | pub use ::aws_credential_types::Credentials;
|
1454 1454 |
|
1455 1455 | impl From<&::aws_types::sdk_config::SdkConfig> for Builder {
|
1456 1456 | fn from(input: &::aws_types::sdk_config::SdkConfig) -> Self {
|
1457 1457 | let mut builder = Builder::default();
|
1458 1458 | builder.set_credentials_provider(input.credentials_provider());
|
1459 1459 | builder = builder.region(input.region().cloned());
|
1460 + | // Track endpoint override metric if endpoint URL is configured from any source
|
1461 + | let has_global_endpoint = input.endpoint_url().is_some();
|
1462 + | let has_service_specific_endpoint = input
|
1463 + | .service_config()
|
1464 + | .and_then(|conf| conf.load_config(service_config_key("Bedrock Runtime", "AWS_ENDPOINT_URL", "endpoint_url")))
|
1465 + | .is_some();
|
1466 + |
|
1467 + | if has_global_endpoint || has_service_specific_endpoint {
|
1468 + | builder.push_runtime_plugin(::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin::new(
|
1469 + | ::aws_runtime::endpoint_override::EndpointOverrideRuntimePlugin::new_with_feature_flag(),
|
1470 + | ));
|
1471 + | }
|
1460 1472 | builder.set_use_fips(input.use_fips());
|
1461 1473 | builder.set_use_dual_stack(input.use_dual_stack());
|
1462 1474 | if input.get_origin("endpoint_url").is_client_config() {
|
1463 1475 | builder.set_endpoint_url(input.endpoint_url().map(|s| s.to_string()));
|
1464 1476 | } else {
|
1465 1477 | builder.set_endpoint_url(
|
1466 1478 | input
|
1467 1479 | .service_config()
|
1468 1480 | .and_then(|conf| {
|
1469 1481 | conf.load_config(service_config_key("Bedrock Runtime", "AWS_ENDPOINT_URL", "endpoint_url"))
|
1470 1482 | .map(|it| it.parse().unwrap())
|
1471 1483 | })
|
1472 1484 | .or_else(|| input.endpoint_url().map(|s| s.to_string())),
|
1473 1485 | );
|
1474 1486 | }
|
1475 1487 | // resiliency
|
1476 1488 | builder.set_retry_config(input.retry_config().cloned());
|
1477 1489 | builder.set_timeout_config(input.timeout_config().cloned());
|
1478 1490 | builder.set_sleep_impl(input.sleep_impl());
|
1479 1491 |
|
1480 1492 | builder.set_http_client(input.http_client());
|
1481 1493 | builder.set_time_source(input.time_source());
|
1482 1494 | builder.set_behavior_version(input.behavior_version());
|
1483 1495 | builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
|
1484 1496 | // setting `None` here removes the default
|
1485 1497 | if let Some(config) = input.stalled_stream_protection() {
|
1486 1498 | builder.set_stalled_stream_protection(Some(config));
|
1487 1499 | }
|
1488 1500 |
|
1489 1501 | if let Some(cache) = input.identity_cache() {
|