Unverified Commit e8449bd1 authored by Aaron Todd's avatar Aaron Todd Committed by GitHub
Browse files

behavior version 2024-03-28 (#3617)

## Motivation and Context
This PR is the combination of two previously reviewed PRs that both
enable new behaviors behind a new Behavior Major Version (BMV):
* https://github.com/smithy-lang/smithy-rs/pull/3527
* https://github.com/smithy-lang/smithy-rs/pull/3578



## Description
* Enables stalled stream protection by default on latest behavior
version.
* Enables creation of a default identity cache.

## Testing
All testing done on prior PRs. See for details.

## 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._

---------

Co-authored-by: default avatarJohn DiSanti <jdisanti@amazon.com>
Co-authored-by: default avatarysaito1001 <awsaito@amazon.com>
parent 6aec38f1
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -10,7 +10,28 @@
# references = ["smithy-rs#920"]
# meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"}
# author = "rcoh"
[[aws-sdk-rust]]
message = """
`aws-config::loader::ConfigLoader` now creates an `IdentityCache` by default when using `BehaviorVersion::v2024_03_28()`
or newer. If you're using `BehaviorVersion::latest()`, you will get this change automatically when updating. This
allows clients created from `SdkConfig` to use the same cache instance by default resulting in fewer cache misses
when using multiple clients.
"""
references = ["smithy-rs#3427"]
meta = { "breaking" = false, "tada" = true, "bug" = false }
author = "aajtodd"

[[smithy-rs]]
message = "Stalled stream protection on uploads is now enabled by default behind `BehaviorVersion::v2024_03_28()`. If you're using `BehaviorVersion::latest()`, you will get this change automatically by running `cargo update`."
references = ["smithy-rs#3527"]
meta = { "breaking" = true, "tada" = true, "bug" = false }
authors = ["jdisanti"]

[[aws-sdk-rust]]
message = "Stalled stream protection on uploads is now enabled by default behind `BehaviorVersion::v2024_03_28()`. If you're using `BehaviorVersion::latest()`, you will get this change automatically by running `cargo update`. Updating your SDK is not necessary, this change will happen when a new version of the client libraries are consumed."
references = ["smithy-rs#3527"]
meta = { "breaking" = true, "tada" = true, "bug" = false }
author = "jdisanti"

[[smithy-rs]]
message = "Implement Debug for DateTime"
+1 −1
Original line number Diff line number Diff line
[package]
name = "aws-config"
version = "1.3.0"
version = "1.4.0"
authors = [
    "AWS Rust SDK Team <aws-sdk-rust@amazon.com>",
    "Russell Cohen <rcoh@amazon.com>",
+42 −15
Original line number Diff line number Diff line
@@ -214,6 +214,7 @@ mod loader {
    use aws_credential_types::Credentials;
    use aws_smithy_async::rt::sleep::{default_async_sleep, AsyncSleep, SharedAsyncSleep};
    use aws_smithy_async::time::{SharedTimeSource, TimeSource};
    use aws_smithy_runtime::client::identity::IdentityCache;
    use aws_smithy_runtime_api::client::behavior_version::BehaviorVersion;
    use aws_smithy_runtime_api::client::http::HttpClient;
    use aws_smithy_runtime_api::client::identity::{ResolveCachedIdentity, SharedIdentityCache};
@@ -238,14 +239,14 @@ mod loader {
    use crate::provider_config::ProviderConfig;

    #[derive(Default, Debug)]
    enum CredentialsProviderOption {
        /// No provider was set by the user. We can set up the default credentials provider chain.
    enum TriStateOption<T> {
        /// No option was set by the user. We can set up the default.
        #[default]
        NotSet,
        /// The credentials provider was explicitly unset. Do not set up a default chain.
        /// The option was explicitly unset. Do not set up a default.
        ExplicitlyUnset,
        /// Use the given credentials provider.
        Set(SharedCredentialsProvider),
        /// Use the given user provided option.
        Set(T),
    }

    /// Load a cross-service [`SdkConfig`] from the environment
@@ -258,7 +259,7 @@ mod loader {
    pub struct ConfigLoader {
        app_name: Option<AppName>,
        identity_cache: Option<SharedIdentityCache>,
        credentials_provider: CredentialsProviderOption,
        credentials_provider: TriStateOption<SharedCredentialsProvider>,
        token_provider: Option<SharedTokenProvider>,
        endpoint_url: Option<String>,
        region: Option<Box<dyn ProvideRegion>>,
@@ -464,9 +465,8 @@ mod loader {
            mut self,
            credentials_provider: impl ProvideCredentials + 'static,
        ) -> Self {
            self.credentials_provider = CredentialsProviderOption::Set(
                SharedCredentialsProvider::new(credentials_provider),
            );
            self.credentials_provider =
                TriStateOption::Set(SharedCredentialsProvider::new(credentials_provider));
            self
        }

@@ -492,7 +492,7 @@ mod loader {
        /// # }
        /// ```
        pub fn no_credentials(mut self) -> Self {
            self.credentials_provider = CredentialsProviderOption::ExplicitlyUnset;
            self.credentials_provider = TriStateOption::ExplicitlyUnset;
            self
        }

@@ -781,14 +781,14 @@ mod loader {
            timeout_config.take_defaults_from(&base_config);

            let credentials_provider = match self.credentials_provider {
                CredentialsProviderOption::Set(provider) => Some(provider),
                CredentialsProviderOption::NotSet => {
                TriStateOption::Set(provider) => Some(provider),
                TriStateOption::NotSet => {
                    let mut builder =
                        credentials::DefaultCredentialsChain::builder().configure(conf.clone());
                    builder.set_region(region.clone());
                    Some(SharedCredentialsProvider::new(builder.build().await))
                }
                CredentialsProviderOption::ExplicitlyUnset => None,
                TriStateOption::ExplicitlyUnset => None,
            };

            let token_provider = match self.token_provider {
@@ -851,7 +851,18 @@ mod loader {
            builder.set_behavior_version(self.behavior_version);
            builder.set_http_client(self.http_client);
            builder.set_app_name(app_name);
            builder.set_identity_cache(self.identity_cache);

            let identity_cache = match self.identity_cache {
                None => match self.behavior_version {
                    Some(bv) if bv.is_at_least(BehaviorVersion::v2024_03_28()) => {
                        Some(IdentityCache::lazy().build())
                    }
                    _ => None,
                },
                Some(user_cache) => Some(user_cache),
            };

            builder.set_identity_cache(identity_cache);
            builder.set_credentials_provider(credentials_provider);
            builder.set_token_provider(token_provider);
            builder.set_sleep_impl(sleep_impl);
@@ -1055,10 +1066,26 @@ mod loader {
                .no_credentials()
                .load()
                .await;
            assert!(config.identity_cache().is_none());
            assert!(config.credentials_provider().is_none());
        }

        #[cfg(feature = "rustls")]
        #[tokio::test]
        async fn identity_cache_defaulted() {
            let config = defaults(BehaviorVersion::latest()).load().await;

            assert!(config.identity_cache().is_some());
        }

        #[cfg(feature = "rustls")]
        #[allow(deprecated)]
        #[tokio::test]
        async fn identity_cache_old_behavior_version() {
            let config = defaults(BehaviorVersion::v2023_11_09()).load().await;

            assert!(config.identity_cache().is_none());
        }

        #[tokio::test]
        async fn connector_is_shared() {
            let num_requests = Arc::new(AtomicUsize::new(0));
+1 −1
Original line number Diff line number Diff line
@@ -544,7 +544,7 @@ pub(crate) mod identity_provider {
            config_bag: &'a ConfigBag,
        ) -> Result<SessionCredentials, BoxError> {
            let mut config_builder = crate::config::Builder::from_config_bag(config_bag)
                .behavior_version(self.behavior_version.clone());
                .behavior_version(self.behavior_version);

            // inherits all runtime components from a current S3 operation but clears out
            // out interceptors configured for that operation
+1 −1
Original line number Diff line number Diff line
[package]
name = "aws-types"
version = "1.2.0"
version = "1.2.1"
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Russell Cohen <rcoh@amazon.com>"]
description = "Cross-service types for the AWS SDK."
edition = "2021"
Loading