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

Update rust-runtime to rustls 0.22 #3458

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

djc
Copy link

@djc djc commented Mar 4, 2024

Motivation and Context

Would be nice to avoid duplicate dependencies in downstream projects and generally keep up with dependencies offering their latest and (supposedly) greatest versions. While rustls 0.23 has since been released (a few days ago -- there's no compatible tokio-rustls or hyper-rustls releases yet), the 0.22 release made quite some changes that will be necessary for 0.23, so I think it still makes sense to make this upgrade.

(Note that hyper-rustls has since upgraded to hyper 1, so we'll probably need #1925 before we can upgrade to the hyper-rustls release that is compatible with rustls 0.23.)

Description

I've attempted to update rustls and related crates in the rust-runtime. So far I have not touched the tls-stub in ci-resources because I'm unable to compile it for reasons that aren't clear to me:

djc-2021 rustls-0.22 tls-stub $ cargo c
error: failed to get `aws-config` as a dependency of package `stub v0.1.0 (/Users/djc/src/smithy-rs/tools/ci-resources/tls-stub)`

Caused by:
  failed to load source for dependency `aws-config`

Caused by:
  Unable to update /Users/djc/src/smithy-rs/aws/sdk/build/aws-sdk/sdk/aws-config

Caused by:
  failed to read `/Users/djc/src/smithy-rs/aws/sdk/build/aws-sdk/sdk/aws-config/Cargo.toml`

Caused by:
  No such file or directory (os error 2)

I also haven't touched the examples yet.

Testing

No testing so far other than just compiling.

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@djc djc requested review from a team as code owners March 4, 2024 15:50
@djc djc changed the title Rustls 0.22 Update rust-runtime to rustls 0.22 Mar 4, 2024
@jdisanti
Copy link
Collaborator

jdisanti commented Mar 4, 2024

failed to load source for dependency aws-config

The aws-config runtime crate depends on some of the code generated crates, so you have to generate a SDK in order for some stuff to compile successfully. You can do this by running ./gradlew aws:sdk:assemble.

@rcoh
Copy link
Collaborator

rcoh commented Mar 5, 2024

This is awesome! And Hyper 1.0 is coming soon: #3461!

Looks like one compilation failure in CI: https://github.com/smithy-lang/smithy-rs/actions/runs/8143069068/job/22260899311?pr=3458#step:3:1112

@djc
Copy link
Author

djc commented Mar 5, 2024

@rcoh if you're working on that PR, is it still useful for me to consider pushing this through?

@djc
Copy link
Author

djc commented Mar 7, 2024

@rcoh if you're working on that PR, is it still useful for me to consider pushing this through?

@rcoh do you have some more context on your plans for landing Hyper 1 support? I skimmed the changes in #3461, but given the creation of an "experimental" crate I'm wondering how you're planning to roll this out -- mainly to determine whether it's useful to continue pushing on this PR.

@rcoh
Copy link
Collaborator

rcoh commented Mar 7, 2024

Yeah I think it is useful. I don't know our exact timeline for stabilizing hyper 1.0 — depends on the balance between community demand and any stability issues that come up

@Velfi
Copy link
Contributor

Velfi commented May 10, 2024

@djc If you'd like to be an early adopter of the hyper 1.0 client, here's a quick example:

use aws_smithy_experimental::hyper_1_0::{ CryptoMode, HyperClientBuilder };
use aws_smithy_runtime_api::client::behavior_version::BehaviorVersion;

#[tokio::main]
async fn main() {
    let http_client = HyperClientBuilder::default()
        // Here is were we choose a crypto mode.
        //
        // Our choices are:
        //
        // - `CryptoMode::Ring`
        // - `CryptoMode::AwsLc`
        // - `CryptoMode::AwsLcFips`
        //
        // In this example, we've chosen `ring` as the crypto provider.   
        .crypto_mode(CryptoMode::Ring)
        .build_https();
    let conf = aws_config::defaults(BehaviorVersion::latest())
        // Once we've built our client, all we need to do is set it
        // on either the shared config struct or the service config struct.
        .http_client(http_client)
        .load()
        .await;
    let client = aws_sdk_s3::Client::new(&conf);
    let buckets = client
        .list_buckets()
        .send()
        .await
        .expect("failed to list buckets");
    for bucket in buckets.buckets() {
        println!("{}", bucket.name().unwrap());
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants