1521 1521 | .freeze(),
|
1522 1522 | components,
|
1523 1523 | }
|
1524 1524 | }
|
1525 1525 | }
|
1526 1526 |
|
1527 1527 | impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ConfigOverrideRuntimePlugin {
|
1528 1528 | fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
|
1529 1529 | Some(self.config.clone())
|
1530 1530 | }
|
1531 1531 |
|
1532 1532 | fn runtime_components(
|
1533 1533 | &self,
|
1534 1534 | _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
|
1535 1535 | ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
|
1536 1536 | ::std::borrow::Cow::Borrowed(&self.components)
|
1537 1537 | }
|
1538 1538 | }
|
1539 1539 |
|
1540 1540 | pub use ::aws_smithy_runtime::client::identity::IdentityCache;
|
1541 1541 | pub use ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
|
1542 1542 | pub use ::aws_smithy_types::config_bag::ConfigBag;
|
1543 1543 |
|
1544 1544 | pub use ::aws_credential_types::Credentials;
|
1545 1545 |
|
1546 1546 | impl From<&::aws_types::sdk_config::SdkConfig> for Builder {
|
1547 1547 | fn from(input: &::aws_types::sdk_config::SdkConfig) -> Self {
|
1548 1548 | let mut builder = Builder::default();
|
1549 1549 | builder.set_credentials_provider(input.credentials_provider());
|
1550 1550 | builder = builder.region(input.region().cloned());
|
1551 + | // Track endpoint override metric if endpoint URL is configured from any source
|
1552 + | let has_global_endpoint = input.endpoint_url().is_some();
|
1553 + | let has_service_specific_endpoint = input
|
1554 + | .service_config()
|
1555 + | .and_then(|conf| conf.load_config(service_config_key("S3", "AWS_ENDPOINT_URL", "endpoint_url")))
|
1556 + | .is_some();
|
1557 + |
|
1558 + | if has_global_endpoint || has_service_specific_endpoint {
|
1559 + | builder.push_runtime_plugin(::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin::new(
|
1560 + | ::aws_runtime::endpoint_override::EndpointOverrideRuntimePlugin::new_with_feature_flag(),
|
1561 + | ));
|
1562 + | }
|
1551 1563 | builder.set_request_checksum_calculation(input.request_checksum_calculation());
|
1552 1564 | builder.set_response_checksum_validation(input.response_checksum_validation());
|
1553 1565 | builder.set_use_fips(input.use_fips());
|
1554 1566 | builder.set_use_dual_stack(input.use_dual_stack());
|
1555 1567 | if input.get_origin("endpoint_url").is_client_config() {
|
1556 1568 | builder.set_endpoint_url(input.endpoint_url().map(|s| s.to_string()));
|
1557 1569 | } else {
|
1558 1570 | builder.set_endpoint_url(
|
1559 1571 | input
|
1560 1572 | .service_config()
|
1561 1573 | .and_then(|conf| {
|
1562 1574 | conf.load_config(service_config_key("S3", "AWS_ENDPOINT_URL", "endpoint_url"))
|
1563 1575 | .map(|it| it.parse().unwrap())
|
1564 1576 | })
|
1565 1577 | .or_else(|| input.endpoint_url().map(|s| s.to_string())),
|
1566 1578 | );
|
1567 1579 | }
|
1568 1580 | // resiliency
|
1569 1581 | builder.set_retry_config(input.retry_config().cloned());
|
1570 1582 | builder.set_timeout_config(input.timeout_config().cloned());
|
1571 1583 | builder.set_sleep_impl(input.sleep_impl());
|
1572 1584 |
|
1573 1585 | builder.set_http_client(input.http_client());
|
1574 1586 | builder.set_time_source(input.time_source());
|
1575 1587 | builder.set_behavior_version(input.behavior_version());
|
1576 1588 | builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
|
1577 1589 | // setting `None` here removes the default
|
1578 1590 | if let Some(config) = input.stalled_stream_protection() {
|
1579 1591 | builder.set_stalled_stream_protection(Some(config));
|
1580 1592 | }
|