Skip to content

Commit

Permalink
Replace DynConnector and HttpConnector with HttpClient
Browse files Browse the repository at this point in the history
This PR removes the last usages of `DynConnector` and `HttpClient` from
the `aws_smithy_client` crate.
  • Loading branch information
jdisanti committed Sep 29, 2023
1 parent 398ad9e commit 0af7920
Show file tree
Hide file tree
Showing 145 changed files with 2,496 additions and 1,898 deletions.
15 changes: 5 additions & 10 deletions aws/rust-runtime/aws-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ license = "Apache-2.0"
repository = "https://github.com/awslabs/smithy-rs"

[features]
client-hyper = ["aws-smithy-client/client-hyper", "aws-smithy-runtime/connector-hyper"]
rustls = ["aws-smithy-client/rustls", "client-hyper"]
native-tls = []
client-hyper = ["aws-smithy-runtime/connector-hyper-0-14-x"]
rustls = ["aws-smithy-runtime/tls-rustls", "client-hyper"]
allow-compilation = [] # our tests use `cargo test --all-features` and native-tls breaks CI
rt-tokio = ["aws-smithy-async/rt-tokio", "tokio/rt"]
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-runtime/rt-tokio", "tokio/rt"]
credentials-sso = ["dep:aws-sdk-sso", "dep:ring", "dep:hex", "dep:zeroize"]

default = ["client-hyper", "rustls", "rt-tokio", "credentials-sso"]
Expand All @@ -23,9 +22,7 @@ aws-credential-types = { path = "../../sdk/build/aws-sdk/sdk/aws-credential-type
aws-http = { path = "../../sdk/build/aws-sdk/sdk/aws-http" }
aws-sdk-sts = { path = "../../sdk/build/aws-sdk/sdk/sts", default-features = false }
aws-smithy-async = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-async" }
aws-smithy-client = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-client", default-features = false }
aws-smithy-http = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-http" }
aws-smithy-http-tower = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-http-tower" }
aws-smithy-json = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-json" }
aws-smithy-runtime = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-runtime", features = ["client"] }
aws-smithy-runtime-api = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-runtime-api", features = ["client"] }
Expand All @@ -42,7 +39,6 @@ fastrand = "2.0.0"

bytes = "1.1.0"
http = "0.2.4"
tower = { version = "0.4.8" }

# implementation detail of SSO credential caching
aws-sdk-sso = { path = "../../sdk/build/aws-sdk/sdk/sso", default-features = false, optional = true }
Expand All @@ -51,7 +47,7 @@ hex = { version = "0.4.3", optional = true }
zeroize = { version = "1", optional = true }

[dev-dependencies]
aws-smithy-runtime = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util"] }
aws-smithy-runtime = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "connector-hyper-0-14-x", "test-util"] }
futures-util = { version = "0.3.16", default-features = false }
tracing-test = "0.2.1"
tracing-subscriber = { version = "0.3.16", features = ["fmt", "json"] }
Expand All @@ -66,11 +62,10 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"

aws-credential-types = { path = "../../sdk/build/aws-sdk/sdk/aws-credential-types", features = ["test-util"] }
aws-smithy-client = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-client", features = ["test-util", "rt-tokio", "client-hyper"] }

# used for a usage example
hyper-rustls = { version = "0.24", features = ["webpki-tokio", "http2", "http1"] }
aws-smithy-async = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-async", features = ["test-util"] }
aws-smithy-async = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-async", features = ["rt-tokio", "test-util"] }

[package.metadata.docs.rs]
all-features = true
Expand Down
11 changes: 5 additions & 6 deletions aws/rust-runtime/aws-config/external-types.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ allowed_external_types = [
"aws_credential_types::provider::SharedCredentialsProvider",
"aws_sdk_sts::types::_policy_descriptor_type::PolicyDescriptorType",
"aws_smithy_async::rt::sleep::AsyncSleep",
"aws_smithy_async::rt::sleep::SharedAsyncSleep",
"aws_smithy_async::time::SharedTimeSource",
"aws_smithy_async::time::TimeSource",
"aws_smithy_client::bounds::SmithyConnector",
"aws_smithy_client::conns::default_connector::default_connector",
"aws_smithy_client::erase::DynConnector",
"aws_smithy_client::erase::boxclone::BoxCloneService",
"aws_smithy_client::http_connector::ConnectorSettings",
"aws_smithy_client::http_connector::HttpConnector",
"aws_smithy_http::body::SdkBody",
"aws_smithy_http::endpoint",
"aws_smithy_http::endpoint::error::InvalidEndpointError",
"aws_smithy_http::result::SdkError",
"aws_smithy_runtime_api::client::dns::SharedDnsResolver",
"aws_smithy_runtime_api::client::http::SharedHttpClient",
"aws_smithy_runtime_api::shared::IntoShared",
"aws_smithy_types::retry",
"aws_smithy_types::retry::*",
"aws_smithy_types::timeout",
Expand Down
32 changes: 0 additions & 32 deletions aws/rust-runtime/aws-config/src/connector.rs

This file was deleted.

10 changes: 5 additions & 5 deletions aws/rust-runtime/aws-config/src/default_provider/app_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ mod tests {
use super::*;
use crate::profile::profile_file::{ProfileFileKind, ProfileFiles};
use crate::provider_config::ProviderConfig;
use crate::test_case::{no_traffic_connector, InstantSleep};
use crate::test_case::{no_traffic_client, InstantSleep};
use aws_types::os_shim_internal::{Env, Fs};

#[tokio::test]
Expand All @@ -105,7 +105,7 @@ mod tests {
&ProviderConfig::no_configuration()
.with_fs(fs)
.with_env(env)
.with_http_connector(no_traffic_connector()),
.with_http_client(no_traffic_client()),
)
.app_name()
.await;
Expand All @@ -120,7 +120,7 @@ mod tests {
let conf = crate::from_env()
.sleep_impl(InstantSleep)
.fs(fs)
.http_connector(no_traffic_connector())
.http_client(no_traffic_client())
.profile_name("custom")
.profile_files(
ProfileFiles::builder()
Expand All @@ -141,7 +141,7 @@ mod tests {
&ProviderConfig::empty()
.with_fs(fs)
.with_env(env)
.with_http_connector(no_traffic_connector()),
.with_http_client(no_traffic_client()),
)
.app_name()
.await;
Expand All @@ -158,7 +158,7 @@ mod tests {
&ProviderConfig::empty()
.with_fs(fs)
.with_env(env)
.with_http_connector(no_traffic_connector()),
.with_http_client(no_traffic_client()),
)
.app_name()
.await;
Expand Down
16 changes: 8 additions & 8 deletions aws/rust-runtime/aws-config/src/default_provider/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ mod test {
/// make_test!(live: test_name)
/// ```
macro_rules! make_test {
($name: ident $(#[$m:meta])*) => {
($name:ident $(#[$m:meta])*) => {
make_test!($name, execute, $(#[$m])*);
};
(update: $name:ident) => {
Expand All @@ -235,13 +235,13 @@ mod test {
(live: $name:ident) => {
make_test!($name, execute_from_live_traffic);
};
($name: ident, $func: ident, $(#[$m:meta])*) => {
($name:ident, $func:ident, $(#[$m:meta])*) => {
make_test!($name, $func, std::convert::identity $(, #[$m])*);
};
($name: ident, builder: $provider_config_builder: expr) => {
($name:ident, builder: $provider_config_builder:expr) => {
make_test!($name, execute, $provider_config_builder);
};
($name: ident, $func: ident, $provider_config_builder: expr $(, #[$m:meta])*) => {
($name:ident, $func:ident, $provider_config_builder:expr $(, #[$m:meta])*) => {
$(#[$m])*
#[tokio::test]
async fn $name() {
Expand Down Expand Up @@ -332,14 +332,14 @@ mod test {
use crate::provider_config::ProviderConfig;
use aws_credential_types::provider::error::CredentialsError;
use aws_smithy_async::rt::sleep::TokioSleep;
use aws_smithy_client::erase::boxclone::BoxCloneService;
use aws_smithy_client::never::NeverConnected;
use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;
use aws_smithy_runtime::client::http::test_util::NeverTcpConnector;

tokio::time::pause();
let conf = ProviderConfig::no_configuration()
.with_tcp_connector(BoxCloneService::new(NeverConnected::new()))
.with_http_client(HyperClientBuilder::new().build(NeverTcpConnector::new()))
.with_time_source(StaticTimeSource::new(UNIX_EPOCH))
.with_sleep(TokioSleep::new());
.with_sleep_impl(TokioSleep::new());
let provider = DefaultCredentialsChain::builder()
.configure(conf)
.build()
Expand Down
Loading

0 comments on commit 0af7920

Please sign in to comment.