Unverified Commit d083c6f2 authored by 82marbag's avatar 82marbag Committed by GitHub
Browse files

remove native-tls (#2675)



* Show how to plug a connector
* For TLS: keep rustls, only

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] 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._

---------

Signed-off-by: default avatarDaniele Ahmed <ahmeddan@amazon.de>
parent 52902411
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -211,8 +211,6 @@ jobs:
      matrix:
        include:
        # We always exclude aws-smithy-http-server-python since the Python framework is experimental.
        # We only build the `native-tls` feature here because `rustls` depends on `ring` which in turn
        # does not support powerpc as a target platform (see https://github.com/briansmith/ring/issues/389)
        - target: i686-unknown-linux-gnu
          build_smithy_rs_features: --all-features
          build_aws_exclude: ''
@@ -221,17 +219,17 @@ jobs:
          test_aws_exclude: ''
          test_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
        - target: powerpc-unknown-linux-gnu
          build_smithy_rs_features: --features native-tls
          build_smithy_rs_features: ''
          build_aws_exclude: --exclude aws-inlineable
          build_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
          test_smithy_rs_features: --features native-tls
          test_smithy_rs_features: ''
          test_aws_exclude: --exclude aws-inlineable
          test_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
        - target: powerpc64-unknown-linux-gnu
          build_smithy_rs_features: --features native-tls
          build_smithy_rs_features: ''
          build_aws_exclude: --exclude aws-inlineable
          build_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
          test_smithy_rs_features: --features native-tls
          test_smithy_rs_features: ''
          test_aws_exclude: --exclude aws-inlineable
          test_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
    env:
+12 −0
Original line number Diff line number Diff line
@@ -11,6 +11,18 @@
# meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"}
# author = "rcoh"

[[aws-sdk-rust]]
message = "Remove native-tls and add a migration guide."
author = "82marbag"
references = ["smithy-rs#2675"]
meta = { "breaking" = true, "tada" = false, "bug" = false }

[[smithy-rs]]
message = "Remove native-tls and add a migration guide."
author = "82marbag"
references = ["smithy-rs#2675"]
meta = { "breaking" = true, "tada" = false, "bug" = false }

[[aws-sdk-rust]]
message = "Fix error message when `credentials-sso` feature is not enabled on `aws-config`. NOTE: if you use `no-default-features`, you will need to manually able `credentials-sso` after 0.55.*"
references = ["smithy-rs#2722", "aws-sdk-rust#703"]
+2 −1
Original line number Diff line number Diff line
@@ -11,7 +11,8 @@ repository = "https://github.com/awslabs/smithy-rs"
[features]
client-hyper = ["aws-smithy-client/client-hyper"]
rustls = ["aws-smithy-client/rustls"]
native-tls = ["aws-smithy-client/native-tls"]
native-tls = []
allow-compilation = [] # our tests use `cargo test --all-features` and native-tls breaks CI
rt-tokio = ["aws-smithy-async/rt-tokio", "tokio/rt"]
credentials-sso = ["dep:aws-sdk-sso", "dep:ring", "dep:hex", "dep:zeroize"]

+6 −13
Original line number Diff line number Diff line
@@ -13,10 +13,13 @@ use std::sync::Arc;
// unused when all crate features are disabled
/// Unwrap an [`Option<DynConnector>`](aws_smithy_client::erase::DynConnector), and panic with a helpful error message if it's `None`
pub(crate) fn expect_connector(connector: Option<DynConnector>) -> DynConnector {
    connector.expect("No HTTP connector was available. Enable the `rustls` or `native-tls` crate feature or set a connector to fix this.")
    connector.expect("No HTTP connector was available. Enable the `rustls` crate feature or set a connector to fix this.")
}

#[cfg(any(feature = "rustls", feature = "native-tls"))]
#[cfg(all(feature = "native-tls", not(feature = "allow-compilation")))]
compile_error!("Feature native-tls has been removed. For upgrade instructions, see: https://awslabs.github.io/smithy-rs/design/transport/connector.html");

#[cfg(feature = "rustls")]
fn base(
    settings: &ConnectorSettings,
    sleep: Option<Arc<dyn AsyncSleep>>,
@@ -41,17 +44,7 @@ pub fn default_connector(
}

/// Given `ConnectorSettings` and an `AsyncSleep`, create a `DynConnector` from defaults depending on what cargo features are activated.
#[cfg(all(not(feature = "rustls"), feature = "native-tls"))]
pub fn default_connector(
    settings: &ConnectorSettings,
    sleep: Option<Arc<dyn AsyncSleep>>,
) -> Option<DynConnector> {
    let hyper = base(settings, sleep).build(aws_smithy_client::conns::native_tls());
    Some(DynConnector::new(hyper))
}

/// Given `ConnectorSettings` and an `AsyncSleep`, create a `DynConnector` from defaults depending on what cargo features are activated.
#[cfg(not(any(feature = "rustls", feature = "native-tls")))]
#[cfg(not(feature = "rustls"))]
pub fn default_connector(
    _settings: &ConnectorSettings,
    _sleep: Option<Arc<dyn AsyncSleep>>,
+3 −3
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ use crate::meta::credentials::CredentialsProviderChain;
use crate::meta::region::ProvideRegion;
use crate::provider_config::ProviderConfig;

#[cfg(any(feature = "rustls", feature = "native-tls"))]
#[cfg(feature = "rustls")]
/// Default Credentials Provider chain
///
/// The region from the default region provider will be used
@@ -170,8 +170,8 @@ impl Builder {
    /// Creates a `DefaultCredentialsChain`
    ///
    /// ## Panics
    /// This function will panic if no connector has been set and neither `rustls` and `native-tls`
    /// features have both been disabled.
    /// This function will panic if no connector has been set or the `rustls`
    /// feature has been disabled.
    pub async fn build(self) -> DefaultCredentialsChain {
        let region = match self.region_override {
            Some(provider) => provider.region().await,
Loading