Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support compiling to webassembly #2254

Merged
merged 48 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ffa9923
feat(aws-config): define default feature for sso
eduardomourar Jan 25, 2023
91a8dcc
chore(aws): disable unused features
eduardomourar Jan 25, 2023
1fbd97b
chore(rust-runtime): disable unused features
eduardomourar Jan 25, 2023
06a62b7
chore: add missing tokio fs feature
eduardomourar Jan 26, 2023
a725e0c
chore: disable spawn blocking on wasm
eduardomourar Jan 26, 2023
cae60ef
chore: fix sso feature
eduardomourar Jan 26, 2023
ef00e01
chore: allow unused variables when not sso
eduardomourar Jan 26, 2023
497c4b9
chore: remove unnecessary dependency filter for wasm
eduardomourar Jan 26, 2023
59791df
chore: add integration test for wasm
eduardomourar Jan 26, 2023
7478507
chore: ensure test-util feature is applied to dev dependencies
eduardomourar Jan 26, 2023
56b7b33
chore: disable retry config
eduardomourar Jan 26, 2023
d8fcf49
chore: simplify features as suggested
eduardomourar Jan 26, 2023
86a5689
chore: no default features for aws types
eduardomourar Jan 26, 2023
c0d61ed
chore: rename credentials-sso feature
eduardomourar Jan 26, 2023
a5b6316
Revert "chore: simplify features as suggested"
eduardomourar Jan 27, 2023
f2d47b5
chore: set right name in default features
eduardomourar Jan 27, 2023
df4ab9e
chore: create smithy client test util in runtime types
eduardomourar Jan 27, 2023
154342f
Update aws/rust-runtime/aws-types/Cargo.toml
eduardomourar Jan 27, 2023
937022c
Update aws/rust-runtime/aws-inlineable/Cargo.toml
eduardomourar Jan 27, 2023
08df0df
Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs
eduardomourar Jan 27, 2023
98d336e
Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs
eduardomourar Jan 27, 2023
45cae40
Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs
eduardomourar Jan 27, 2023
1687bbc
Update aws/rust-runtime/aws-config/src/lib.rs
eduardomourar Jan 27, 2023
14e23fb
chore: use hardcoded credentials feature
eduardomourar Jan 30, 2023
be22904
chore: make wasm example for s3 instead
eduardomourar Jan 30, 2023
6a578ec
chore: fix formatting
eduardomourar Jan 30, 2023
1406d42
Merge remote-tracking branch 'origin/main' into feat/support-wasm
eduardomourar Jan 30, 2023
25c8fd3
chore: fix kotlin formatting
eduardomourar Jan 30, 2023
4791b46
chore: fix kotlin unit tests
eduardomourar Jan 30, 2023
40136bd
chore: use timeout config from smithy types
eduardomourar Jan 30, 2023
00234f2
Merge branch 'main' into feat/support-wasm
eduardomourar Feb 1, 2023
40da289
Merge branch 'main' into feat/support-wasm
eduardomourar Mar 15, 2023
2755357
chore: move tests into main file
eduardomourar Mar 16, 2023
5fc3dfd
chore: add vscode setttings to target wasi by default
eduardomourar Mar 16, 2023
0506f75
chore: fix test-util feature for smithy client
eduardomourar Mar 16, 2023
bc4f686
chore: separate adapter into own module
eduardomourar Mar 22, 2023
d353ac3
Merge branch 'main' into feat/support-wasm
eduardomourar Mar 22, 2023
0beea87
chore: fix test with no default features
eduardomourar Mar 22, 2023
0d52a87
Merge branch 'main' into feat/support-wasm
eduardomourar Mar 24, 2023
ffe83ea
Fix typo
jdisanti Mar 24, 2023
0ec8283
Update changelog
jdisanti Mar 24, 2023
01f106c
Check compilation of `aws-config` against `wasm32` in CI
jdisanti Mar 24, 2023
bc2fe6c
Merge remote-tracking branch 'origin/main' into support-wasm
jdisanti Mar 24, 2023
ba00b09
Fix Dockerfile issue and use correct cargo-wasi command
jdisanti Mar 24, 2023
04c7094
Small Dockerfile fix
jdisanti Mar 24, 2023
7e90fb3
Add missing `tar` binary to Docker image
jdisanti Mar 24, 2023
4bfd4e4
Merge branch 'main' into feat/support-wasm
jdisanti Mar 24, 2023
5e63eec
Merge branch 'main' into feat/support-wasm
rcoh Mar 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions aws/rust-runtime/aws-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ client-hyper = ["aws-smithy-client/client-hyper"]
rustls = ["aws-smithy-client/rustls"]
native-tls = ["aws-smithy-client/native-tls"]
rt-tokio = ["aws-smithy-async/rt-tokio", "tokio/rt"]
credentials-sso = ["dep:aws-sdk-sso", "dep:ring", "dep:hex", "dep:zeroize"]

default = ["client-hyper", "rustls", "rt-tokio"]
default = ["client-hyper", "rustls", "rt-tokio", "credentials-sso"]

[dependencies]
aws-credential-types = { path = "../../sdk/build/aws-sdk/sdk/aws-credential-types" }
aws-http = { path = "../../sdk/build/aws-sdk/sdk/aws-http" }
aws-sdk-sso = { path = "../../sdk/build/aws-sdk/sdk/sso", default-features = false }
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 }
Expand All @@ -33,15 +33,16 @@ time = { version = "0.3.4", features = ["parsing"] }
tokio = { version = "1.8.4", features = ["sync"] }
tracing = { version = "0.1" }

# implementation detail of SSO credential caching
ring = "0.16"
hex = "0.4.3"
zeroize = "1"

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 }
ring = { version = "0.16", optional = true }
hex = { version = "0.4.3", optional = true }
zeroize = { version = "1", optional = true }

[dev-dependencies]
futures-util = "0.3.16"
tracing-test = "0.2.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

use crate::provider_config::ProviderConfig;
use aws_sdk_sso::config::timeout::TimeoutConfig;
use aws_sdk_sts::config::timeout::TimeoutConfig;
use std::time::Duration;

const SDK_DEFAULT_CONNECT_TIMEOUT: Duration = Duration::from_millis(3100);
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-config/src/ecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,15 @@ async fn validate_full_uri(
}
}

#[cfg(not(feature = "rt-tokio"))]
#[cfg(any(not(feature = "rt-tokio"), target_family = "wasm"))]
fn tokio_dns() -> Option<DnsService> {
None
}

/// DNS resolver that uses tokio::spawn_blocking
///
/// DNS resolution is required to validate that provided URIs point to the loopback interface
#[cfg(feature = "rt-tokio")]
#[cfg(all(feature = "rt-tokio", not(target_family = "wasm")))]
fn tokio_dns() -> Option<DnsService> {
use aws_smithy_client::erase::boxclone::BoxFuture;
use std::io::ErrorKind;
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-config/src/imds/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::imds::client::token::TokenMiddleware;
use crate::provider_config::ProviderConfig;
use crate::PKG_VERSION;
use aws_http::user_agent::{ApiMetadata, AwsUserAgent, UserAgentStage};
use aws_sdk_sso::config::timeout::TimeoutConfig;
use aws_sdk_sts::config::timeout::TimeoutConfig;
use aws_smithy_client::http_connector::ConnectorSettings;
use aws_smithy_client::{erase::DynConnector, SdkSuccess};
use aws_smithy_client::{retry, SdkError};
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-config/src/imds/client/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::imds::client::ImdsResponseRetryClassifier;
use aws_credential_types::cache::ExpiringCache;
use aws_credential_types::time_source::TimeSource;
use aws_http::user_agent::UserAgentStage;
use aws_sdk_sso::config::timeout::TimeoutConfig;
use aws_sdk_sts::config::timeout::TimeoutConfig;
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_client::erase::DynConnector;
use aws_smithy_client::retry;
Expand Down
1 change: 1 addition & 0 deletions aws/rust-runtime/aws-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ pub mod meta;
pub mod profile;
pub mod provider_config;
pub mod retry;
#[cfg(feature = "credentials-sso ")]
eduardomourar marked this conversation as resolved.
Show resolved Hide resolved
pub mod sso;
pub(crate) mod standard_property;
pub mod sts;
Expand Down
25 changes: 18 additions & 7 deletions aws/rust-runtime/aws-config/src/profile/credentials/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use super::repr::{self, BaseProvider};
use crate::credential_process::CredentialProcessProvider;
use crate::profile::credentials::ProfileFileError;
use crate::provider_config::ProviderConfig;
#[cfg(feature = "credentials-sso ")]
eduardomourar marked this conversation as resolved.
Show resolved Hide resolved
use crate::sso::{SsoConfig, SsoCredentialsProvider};
use crate::sts;
use crate::web_identity_token::{StaticConfiguration, WebIdentityTokenCredentialsProvider};
Expand Down Expand Up @@ -121,19 +122,29 @@ impl ProviderChain {
.build();
Arc::new(provider)
}
#[allow(unused_variables)]
BaseProvider::Sso {
sso_account_id,
sso_region,
sso_role_name,
sso_start_url,
} => {
let sso_config = SsoConfig {
account_id: sso_account_id.to_string(),
role_name: sso_role_name.to_string(),
start_url: sso_start_url.to_string(),
region: Region::new(sso_region.to_string()),
};
Arc::new(SsoCredentialsProvider::new(provider_config, sso_config))
#[cfg(feature = "credentials-sso ")]
eduardomourar marked this conversation as resolved.
Show resolved Hide resolved
{
let sso_config = SsoConfig {
account_id: sso_account_id.to_string(),
role_name: sso_role_name.to_string(),
start_url: sso_start_url.to_string(),
region: Region::new(sso_region.to_string()),
};
Arc::new(SsoCredentialsProvider::new(provider_config, sso_config))
}
#[cfg(not(feature = "credentials-sso "))]
eduardomourar marked this conversation as resolved.
Show resolved Hide resolved
{
Err(ProfileFileError::UnknownProvider {
name: "sso".to_string(),
})?
}
}
};
tracing::info!(base = ?repr.base(), "first credentials will be loaded from {:?}", repr.base());
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-inlineable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ aws-endpoint = { path = "../aws-endpoint" }
aws-http = { path = "../aws-http" }
aws-sig-auth = { path = "../aws-sig-auth" }
aws-smithy-checksums = { path = "../../../rust-runtime/aws-smithy-checksums" }
aws-smithy-client = { path = "../../../rust-runtime/aws-smithy-client" }
aws-smithy-client = { path = "../../../rust-runtime/aws-smithy-client", default-features = false }
eduardomourar marked this conversation as resolved.
Show resolved Hide resolved
aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" }
aws-smithy-http-tower= { path = "../../../rust-runtime/aws-smithy-http-tower" }
aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types" }
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ repository = "https://github.com/awslabs/smithy-rs"

[features]
# This feature is to be used only for doc comments
examples = ["aws-smithy-client/client-hyper", "aws-smithy-client/rustls", "hyper-rustls"]
examples = ["dep:hyper-rustls", "aws-smithy-client/client-hyper", "aws-smithy-client/rustls"]

[dependencies]
aws-credential-types = { path = "../aws-credential-types" }
aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async" }
aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types" }
aws-smithy-client = { path = "../../../rust-runtime/aws-smithy-client" }
aws-smithy-client = { path = "../../../rust-runtime/aws-smithy-client", default-features = false }
eduardomourar marked this conversation as resolved.
Show resolved Hide resolved
aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" }
tracing = "0.1"
http = "0.2.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ import software.amazon.smithy.rust.codegen.core.rustlang.rust
import software.amazon.smithy.rust.codegen.core.rustlang.rustBlock
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
import software.amazon.smithy.rust.codegen.core.rustlang.writable
import software.amazon.smithy.rust.codegen.core.rustlang.DependencyScope
import software.amazon.smithy.rust.codegen.core.smithy.PublicImportSymbolProvider
import software.amazon.smithy.rust.codegen.core.smithy.RustCrate
import software.amazon.smithy.rust.codegen.core.smithy.generators.setterName
import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType
import software.amazon.smithy.rust.codegen.core.testutil.integrationTest
import software.amazon.smithy.rust.codegen.core.testutil.tokioTest
import software.amazon.smithy.rust.codegen.core.util.dq
Expand Down Expand Up @@ -146,8 +148,8 @@ class OperationInputTestGenerator(_ctx: ClientCodegenContext, private val test:
let _result = dbg!(#{invoke_operation});
#{assertion}
""",
"capture_request" to CargoDependency.smithyClient(runtimeConfig)
.withFeature("test-util").toType().resolve("test_connection::capture_request"),
"capture_request" to RuntimeType.smithyClientTestUtil(runtimeConfig)
.resolve("test_connection::capture_request"),
"conf" to config(testOperationInput),
"invoke_operation" to operationInvocation(testOperationInput),
"assertion" to writable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ package software.amazon.smithy.rustsdk
import org.junit.jupiter.api.Test
import software.amazon.smithy.rust.codegen.core.rustlang.CargoDependency
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
import software.amazon.smithy.rust.codegen.core.rustlang.DependencyScope
import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType
import software.amazon.smithy.rust.codegen.core.testutil.asSmithyModel
import software.amazon.smithy.rust.codegen.core.testutil.integrationTest
import software.amazon.smithy.rust.codegen.core.testutil.tokioTest
Expand Down Expand Up @@ -96,10 +98,10 @@ class EndpointsCredentialsTest {
let auth_header = req.headers().get("AUTHORIZATION").unwrap().to_str().unwrap();
assert!(auth_header.contains("/us-west-2/foobaz/aws4_request"), "{}", auth_header);
""",
"capture_request" to CargoDependency.smithyClient(context.runtimeConfig)
.withFeature("test-util").toType().resolve("test_connection::capture_request"),
"Credentials" to AwsCargoDependency.awsCredentialTypes(context.runtimeConfig)
.withFeature("test-util").toType().resolve("Credentials"),
"capture_request" to RuntimeType.smithyClientTestUtil(runtimeConfig)
.resolve("test_connection::capture_request"),
"Credentials" to AwsRuntimeType.awsCredentialTypesTestUtil
.resolve("Credentials"),
"Region" to AwsRuntimeType.awsTypes(context.runtimeConfig).resolve("region::Region"),
)
}
Expand All @@ -120,10 +122,10 @@ class EndpointsCredentialsTest {
let auth_header = req.headers().get("AUTHORIZATION").unwrap().to_str().unwrap();
assert!(auth_header.contains("/region-custom-auth/name-custom-auth/aws4_request"), "{}", auth_header);
""",
"capture_request" to CargoDependency.smithyClient(context.runtimeConfig)
.withFeature("test-util").toType().resolve("test_connection::capture_request"),
"Credentials" to AwsCargoDependency.awsCredentialTypes(context.runtimeConfig)
.withFeature("test-util").toType().resolve("Credentials"),
"capture_request" to RuntimeType.smithyClientTestUtil(runtimeConfig)
.resolve("test_connection::capture_request"),
"Credentials" to AwsRuntimeType.awsCredentialTypesTestUtil
.resolve("Credentials"),
"Region" to AwsRuntimeType.awsTypes(context.runtimeConfig).resolve("region::Region"),
)
}
Expand Down
1 change: 1 addition & 0 deletions aws/sdk/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ members = [
"s3control",
"sts",
"transcribestreaming",
"webassembly",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some prerequisite work to do before this will run in CI. I'll see if I can get around to that today.

Copy link
Contributor Author

@eduardomourar eduardomourar Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our best option is to install cargo-wasi then run cargo wasi test -- --nocapture

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That aspect of it didn't even cross my mind yet 😅

I did the prerequisite work to actually include the tests in the first place in #2255.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the tokio crate, they have a nice a setup for testing against the different webassembly targets: https://github.com/tokio-rs/tokio/blob/06f1a601bb05b1aba9f95020a7fa7572899c588f/.github/workflows/ci.yml#L529-L590

]
2 changes: 2 additions & 0 deletions aws/sdk/integration-tests/webassembly/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "wasm32-wasi"
23 changes: 23 additions & 0 deletions aws/sdk/integration-tests/webassembly/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This Cargo.toml is unused in generated code. It exists solely to enable these tests to compile in-situ
[package]
name = "webassembly"
version = "0.1.0"
authors = ["Eduardo Rodrigues <[email protected]>"]
description = """
These tests ensure that things will fail (or not fail) as expected
when target is set to wasm32-wasi for all SDK and runtime crates.
"""
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
aws-config = { path = "../../build/aws-sdk/sdk/aws-config", default-features = false, features = ["rt-tokio"]}
aws-credential-types = { path = "../../build/aws-sdk/sdk/aws-credential-types" }
aws-sdk-lambda = { path = "../../build/aws-sdk/sdk/lambda", default-features = false }
aws-smithy-client = { path = "../../build/aws-sdk/sdk/aws-smithy-client", default-features = false }
aws-smithy-http = { path = "../../build/aws-sdk/sdk/aws-smithy-http" }
aws-smithy-types = { path = "../../build/aws-sdk/sdk/aws-smithy-types" }
http = "0.2.8"
tokio = { version = "1.24.2", features = ["macros", "rt"] }
tower = "0.4.13"
75 changes: 75 additions & 0 deletions aws/sdk/integration-tests/webassembly/tests/test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

use aws_config::retry::RetryConfig;
use aws_credential_types::Credentials;
use aws_sdk_lambda::{Client, Region};
use aws_smithy_client::erase::DynConnector;
use aws_smithy_http::body::SdkBody;
use aws_smithy_types::timeout::TimeoutConfig;

fn get_default_config() -> impl std::future::Future<Output = aws_config::SdkConfig> {
aws_config::from_env()
.region(Region::from_static("us-west-2"))
.credentials_provider(Credentials::new(
"access_key",
"secret_key",
Some("session_token".to_string()),
None,
"provider_name",
))
.timeout_config(TimeoutConfig::disabled())
.retry_config(RetryConfig::disabled())
.http_connector(DynConnector::new(Adapter::default()))
.load()
}

#[tokio::test]
async fn test_clients_from_service_config() {
let shared_config = get_default_config().await;
let client = Client::new(&shared_config);
assert_eq!(client.conf().region().unwrap().to_string(), "us-west-2")
}

#[tokio::test]
async fn test_clients_list_functions() {
let shared_config = get_default_config().await;
let client = Client::new(&shared_config);
let result = client.list_functions().send().await.unwrap();
assert_eq!(result.functions().unwrap().len(), 1)
}

#[derive(Default, Debug, Clone)]
struct Adapter {}

impl tower::Service<http::Request<SdkBody>> for Adapter {
type Response = http::Response<SdkBody>;

type Error = aws_smithy_http::result::ConnectorError;

#[allow(clippy::type_complexity)]
type Future = std::pin::Pin<
Box<dyn std::future::Future<Output = Result<Self::Response, Self::Error>> + Send + 'static>,
>;

fn poll_ready(&mut self, _cx: &mut std::task::Context<'_>) -> std::task::Poll<Result<(), Self::Error>> {
std::task::Poll::Ready(Ok(()))
}

fn call(&mut self, _req: http::Request<SdkBody>) -> Self::Future {
// Consumers here would pass the HTTP request to
// the Wasm host in order to get the response back
let body = "{
\"Functions\": [
{
\"FunctionName\": \"name\"
}
]
}";
let res = http::Response::new(SdkBody::from(body));

Box::pin(async move { Ok(res) })
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import software.amazon.smithy.rust.codegen.core.rustlang.rust
import software.amazon.smithy.rust.codegen.core.rustlang.rustBlock
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
import software.amazon.smithy.rust.codegen.core.rustlang.writable
import software.amazon.smithy.rust.codegen.core.rustlang.DependencyScope
import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext
import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType
import software.amazon.smithy.rust.codegen.core.util.PANIC
Expand All @@ -48,8 +49,8 @@ internal class EndpointTestGenerator(
"Error" to types.resolveEndpointError,
"Document" to RuntimeType.document(runtimeConfig),
"HashMap" to RuntimeType.HashMap,
"capture_request" to CargoDependency.smithyClient(runtimeConfig)
.withFeature("test-util").toType().resolve("test_connection::capture_request"),
"capture_request" to RuntimeType.smithyClientTestUtil(runtimeConfig)
.resolve("test_connection::capture_request"),
)

private val instantiator = clientInstantiator(codegenContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ data class RuntimeType(val path: String, val dependency: RustDependency? = null)
fun smithyAsync(runtimeConfig: RuntimeConfig) = CargoDependency.smithyAsync(runtimeConfig).toType()
fun smithyChecksums(runtimeConfig: RuntimeConfig) = CargoDependency.smithyChecksums(runtimeConfig).toType()
fun smithyClient(runtimeConfig: RuntimeConfig) = CargoDependency.smithyClient(runtimeConfig).toType()
fun smithyClientTestUtil(runtimeConfig: RuntimeConfig) = CargoDependency.smithyClient(runtimeConfig)
.copy(features = setOf("test-util"), scope = DependencyScope.Dev).toType()
fun smithyEventStream(runtimeConfig: RuntimeConfig) = CargoDependency.smithyEventStream(runtimeConfig).toType()
fun smithyHttp(runtimeConfig: RuntimeConfig) = CargoDependency.smithyHttp(runtimeConfig).toType()
fun smithyJson(runtimeConfig: RuntimeConfig) = CargoDependency.smithyJson(runtimeConfig).toType()
Expand Down
2 changes: 1 addition & 1 deletion rust-runtime/aws-smithy-async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rt-tokio = ["tokio/time"]
[dependencies]
pin-project-lite = "0.2"
tokio = { version = "1.8.4", features = ["sync"] }
tokio-stream = "0.1.5"
tokio-stream = { version = "0.1.5", default-features = false }
futures-util = "0.3.16"

[dev-dependencies]
Expand Down
10 changes: 5 additions & 5 deletions rust-runtime/aws-smithy-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ repository = "https://github.com/awslabs/smithy-rs"

[features]
rt-tokio = ["aws-smithy-async/rt-tokio"]
test-util = ["aws-smithy-protocol-test", "serde/derive", "rustls"]
native-tls = ["client-hyper", "hyper-tls", "rt-tokio"]
rustls = ["client-hyper", "hyper-rustls", "rt-tokio", "lazy_static"]
client-hyper = ["hyper"]
hyper-webpki-doctest-only = ["hyper-rustls/webpki-roots"]
test-util = ["dep:aws-smithy-protocol-test", "dep:serde", "serde?/derive", "rustls"]
eduardomourar marked this conversation as resolved.
Show resolved Hide resolved
native-tls = ["dep:hyper-tls", "client-hyper", "rt-tokio"]
rustls = ["dep:hyper-rustls", "dep:lazy_static", "client-hyper", "rt-tokio"]
client-hyper = ["dep:hyper"]
hyper-webpki-doctest-only = ["dep:hyper-rustls", "hyper-rustls?/webpki-roots"]
eduardomourar marked this conversation as resolved.
Show resolved Hide resolved

[dependencies]
aws-smithy-async = { path = "../aws-smithy-async" }
Expand Down
2 changes: 1 addition & 1 deletion rust-runtime/aws-smithy-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ license = "Apache-2.0"
repository = "https://github.com/awslabs/smithy-rs"

[features]
rt-tokio = ["tokio/rt", "tokio/fs", "tokio/io-util", "tokio-util/io"]
rt-tokio = ["dep:tokio-util", "dep:tokio", "tokio?/rt", "tokio?/fs", "tokio?/io-util", "tokio-util?/io"]
eduardomourar marked this conversation as resolved.
Show resolved Hide resolved
event-stream = ["aws-smithy-eventstream"]

[dependencies]
Expand Down