Unverified Commit 48b45063 authored by AWS SDK Rust Bot's avatar AWS SDK Rust Bot Committed by GitHub
Browse files

Merge smithy-rs-release-1.x.y back into main (#3280)

parents 85d2621b 6f442794
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
<!-- Do not manually edit this file. Use the `changelogger` tool. -->
December 1st, 2023
==================
**New this release:**
- (client, [smithy-rs#3278](https://github.com/smithy-lang/smithy-rs/issues/3278)) `RuntimeComponentsBuilder::push_identity_resolver` is now deprecated since it does not replace the existing identity resolver of a given auth scheme ID. Use `RuntimeComponentsBuilder::set_identity_resolver` instead.


November 27th, 2023
===================
**New this release:**
+28 −97
Original line number Diff line number Diff line
@@ -6,21 +6,7 @@
  "smithy-rs": [],
  "aws-sdk-rust": [
    {
      "message": "Add configurable stalled-stream protection for downloads.\n\nWhen making HTTP calls,\nit's possible for a connection to 'stall out' and emit no more data due to server-side issues.\nIn the event this happens, it's desirable for the stream to error out as quickly as possible.\nWhile timeouts can protect you from this issue, they aren't adaptive to the amount of data\nbeing sent and so must be configured specifically for each use case. When enabled, stalled-stream\nprotection will ensure that bad streams error out quickly, regardless of the amount of data being\ndownloaded.\n\nProtection is enabled by default for all clients but can be configured or disabled.\nSee [this discussion](https://github.com/awslabs/aws-sdk-rust/discussions/956) for more details.\n",
      "meta": {
        "bug": false,
        "breaking": true,
        "tada": true
      },
      "author": "Velfi",
      "references": [
        "smithy-rs#3202"
      ],
      "since-commit": "f66f9246bccc376462ef47aec5707569fca214f5",
      "age": 5
    },
    {
      "message": "Make certain types for EMR Serverless optional. Previously, they defaulted to 0, but this created invalid requests.",
      "message": "Make properties of S3Control PublicAccessBlockConfiguration optional. Previously, they defaulted to false, but this created invalid requests.",
      "meta": {
        "bug": true,
        "breaking": true,
@@ -28,13 +14,13 @@
      },
      "author": "milesziemer",
      "references": [
        "smithy-rs#3217"
        "smithy-rs#3246"
      ],
      "since-commit": "f66f9246bccc376462ef47aec5707569fca214f5",
      "since-commit": "e155c3048b9989fe406ef575d461ea01dfaf294c",
      "age": 5
    },
    {
      "message": "Prevent multiplication overflow in backoff computation",
      "message": "Allow `--` to be used in bucket names for S3",
      "meta": {
        "bug": true,
        "breaking": false,
@@ -42,70 +28,28 @@
      },
      "author": "rcoh",
      "references": [
        "smithy-rs#3229",
        "aws-sdk-rust#960"
      ],
      "since-commit": "f66f9246bccc376462ef47aec5707569fca214f5",
      "age": 5
    },
    {
      "message": "Make some types for various services optional. Previously, they defaulted to 0, but this created invalid requests.",
      "meta": {
        "bug": true,
        "breaking": true,
        "tada": false
      },
      "author": "milesziemer",
      "references": [
        "smithy-rs#3228"
      ],
      "since-commit": "f66f9246bccc376462ef47aec5707569fca214f5",
      "age": 5
    },
    {
      "message": "Types/functions that were deprecated in previous releases were removed. Unfortunately, some of these deprecations\nwere ignored by the Rust compiler (we found out later that `#[deprecated]` on `pub use` doesn't work). See\nthe [deprecations removal list](https://github.com/smithy-lang/smithy-rs/discussions/3223) for more details.\n",
      "meta": {
        "bug": false,
        "breaking": true,
        "tada": false
      },
      "author": "jdisanti",
      "references": [
        "smithy-rs#3222"
      ],
      "since-commit": "f66f9246bccc376462ef47aec5707569fca214f5",
      "age": 5
    },
    {
      "message": "Add `Display` impl for `DateTime`.",
      "meta": {
        "bug": false,
        "breaking": false,
        "tada": true
      },
      "author": "HakanVardarr",
      "references": [
        "smithy-rs#3183"
        "smithy-rs#3253"
      ],
      "since-commit": "f66f9246bccc376462ef47aec5707569fca214f5",
      "age": 5
      "since-commit": "48e3c95a3f10eebd5a637f8e7670c4232cdabbe4",
      "age": 4
    },
    {
      "message": "Types/functions that were previously `#[doc(hidden)]` in `aws-config`, `aws-inlineable`, `aws-types`, and the SDK crates are now visible. For those that are not intended to be used directly, they are called out in their docs as such.",
      "message": "Retry additional classes of H2 errors (H2 GoAway & H2 ResetStream)",
      "meta": {
        "bug": false,
        "breaking": false,
        "tada": false
      },
      "author": "ysaito1001",
      "author": "rcoh",
      "references": [
        "smithy-rs#3226"
        "aws-sdk-rust#738",
        "aws-sdk-rust#858"
      ],
      "since-commit": "f66f9246bccc376462ef47aec5707569fca214f5",
      "age": 5
      "since-commit": "88970ba88ef45266aade152c7c1da8e90b24c0d7",
      "age": 2
    },
    {
      "message": "Make properties of S3Control PublicAccessBlockConfiguration optional. Previously, they defaulted to false, but this created invalid requests.",
      "message": "Make some properties for IoT types optional. Previously, they defaulted to false, but that isn't how the service actual works.",
      "meta": {
        "bug": true,
        "breaking": true,
@@ -113,52 +57,39 @@
      },
      "author": "milesziemer",
      "references": [
        "smithy-rs#3246"
        "smithy-rs#3256"
      ],
      "since-commit": "e155c3048b9989fe406ef575d461ea01dfaf294c",
      "age": 4
      "since-commit": "88970ba88ef45266aade152c7c1da8e90b24c0d7",
      "age": 2
    },
    {
      "message": "Allow `--` to be used in bucket names for S3",
      "message": "Fix `config::Builder::set_credentials_provider` to override a credentials provider previously set.",
      "meta": {
        "bug": true,
        "breaking": false,
        "tada": false
      },
      "author": "rcoh",
      "author": "ysaito1001",
      "references": [
        "smithy-rs#3253"
        "aws-sdk-rust#973",
        "smithy-rs#3278"
      ],
      "since-commit": "48e3c95a3f10eebd5a637f8e7670c4232cdabbe4",
      "age": 3
      "since-commit": "529b3f03e2b945ea2e5e879183ccfd8e74b7377c",
      "age": 1
    },
    {
      "message": "Retry additional classes of H2 errors (H2 GoAway & H2 ResetStream)",
      "message": "`config::Config::credentials_provider` has been broken since `release-2023-11-15` and is now marked as `deprecated` explicitly.",
      "meta": {
        "bug": false,
        "breaking": false,
        "tada": false
      },
      "author": "rcoh",
      "references": [
        "aws-sdk-rust#738",
        "aws-sdk-rust#858"
      ],
      "since-commit": "88970ba88ef45266aade152c7c1da8e90b24c0d7",
      "age": 1
    },
    {
      "message": "Make some properties for IoT types optional. Previously, they defaulted to false, but that isn't how the service actual works.",
      "meta": {
        "bug": true,
        "breaking": true,
        "tada": false
      },
      "author": "milesziemer",
      "author": "ysaito1001",
      "references": [
        "smithy-rs#3256"
        "smithy-rs#3251",
        "smithy-rs#3278"
      ],
      "since-commit": "88970ba88ef45266aade152c7c1da8e90b24c0d7",
      "since-commit": "529b3f03e2b945ea2e5e879183ccfd8e74b7377c",
      "age": 1
    }
  ],
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ import software.amazon.smithy.rust.codegen.core.smithy.RuntimeConfig
import software.amazon.smithy.rust.codegen.core.smithy.crateLocation

fun RuntimeConfig.awsRuntimeCrate(name: String, features: Set<String> = setOf()): CargoDependency =
    CargoDependency(name, awsRoot().crateLocation(null), features = features)
    CargoDependency(name, awsRoot().crateLocation(name), features = features)

object AwsCargoDependency {
    fun awsConfig(runtimeConfig: RuntimeConfig) = runtimeConfig.awsRuntimeCrate("aws-config")
+5 −4
Original line number Diff line number Diff line
@@ -81,9 +81,10 @@ class CredentialProviderConfig(private val codegenContext: ClientCodegenContext)
            ServiceConfig.ConfigImpl -> {
                rustTemplate(
                    """
                    /// Returns the credentials provider for this service
                    /// This function was intended to be removed, and has been broken since release-2023-11-15 as it always returns a `None`. Do not use.
                    ##[deprecated(note = "This function was intended to be removed, and has been broken since release-2023-11-15 as it always returns a `None`. Do not use.")]
                    pub fn credentials_provider(&self) -> Option<#{SharedCredentialsProvider}> {
                        self.config.load::<#{SharedCredentialsProvider}>().cloned()
                        #{None}
                    }
                    """,
                    *codegenScope,
@@ -118,13 +119,13 @@ class CredentialProviderConfig(private val codegenContext: ClientCodegenContext)
                        if (codegenContext.serviceShape.supportedAuthSchemes().contains("sigv4a")) {
                            featureGateBlock("sigv4a") {
                                rustTemplate(
                                    "self.runtime_components.push_identity_resolver(#{SIGV4A_SCHEME_ID}, credentials_provider.clone());",
                                    "self.runtime_components.set_identity_resolver(#{SIGV4A_SCHEME_ID}, credentials_provider.clone());",
                                    *codegenScope,
                                )
                            }
                        }
                        rustTemplate(
                            "self.runtime_components.push_identity_resolver(#{SIGV4_SCHEME_ID}, credentials_provider);",
                            "self.runtime_components.set_identity_resolver(#{SIGV4_SCHEME_ID}, credentials_provider);",
                            *codegenScope,
                        )
                    }
+68 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ internal class CredentialProviderConfigTest {
                    val moduleName = ctx.moduleUseName()
                    rustTemplate(
                        """
                        let (http_client, _rx) = #{capture_request}(None);
                        let (http_client, _rx) = #{capture_request}(#{None});
                        let client_config = $moduleName::Config::builder()
                            .http_client(http_client)
                            .build();
@@ -62,4 +62,71 @@ internal class CredentialProviderConfigTest {
            }
        }
    }

    @Test
    fun `configuring credentials provider on builder should replace what was previously set`() {
        awsSdkIntegrationTest(SdkCodegenIntegrationTest.model) { ctx, rustCrate ->
            val rc = ctx.runtimeConfig
            val codegenScope = arrayOf(
                *RuntimeType.preludeScope,
                "capture_request" to RuntimeType.captureRequest(rc),
                "Credentials" to AwsRuntimeType.awsCredentialTypesTestUtil(rc)
                    .resolve("Credentials"),
                "Region" to AwsRuntimeType.awsTypes(rc).resolve("region::Region"),
                "SdkConfig" to AwsRuntimeType.awsTypes(rc).resolve("sdk_config::SdkConfig"),
                "SharedCredentialsProvider" to AwsRuntimeType.awsCredentialTypes(rc)
                    .resolve("provider::SharedCredentialsProvider"),
            )
            rustCrate.integrationTest("credentials_provider") {
                // per https://github.com/awslabs/aws-sdk-rust/issues/973
                tokioTest("configuring_credentials_provider_on_builder_should_replace_what_was_previously_set") {
                    val moduleName = ctx.moduleUseName()
                    rustTemplate(
                        """
                        let (http_client, rx) = #{capture_request}(#{None});

                        let replace_me = #{Credentials}::new(
                            "replace_me",
                            "replace_me",
                            #{None},
                            #{None},
                            "replace_me",
                        );
                        let sdk_config = #{SdkConfig}::builder()
                            .credentials_provider(
                                #{SharedCredentialsProvider}::new(replace_me),
                            )
                            .region(#{Region}::new("us-west-2"))
                            .build();

                        let expected = #{Credentials}::new(
                            "expected_credential",
                            "expected_credential",
                            #{None},
                            #{None},
                            "expected_credential",
                        );
                        let conf = $moduleName::config::Builder::from(&sdk_config)
                            .http_client(http_client)
                            .credentials_provider(expected)
                            .build();

                        let client = $moduleName::Client::from_conf(conf);

                        let _ = client
                            .some_operation()
                            .send()
                            .await
                            .expect("success");

                        let req = rx.expect_request();
                        let auth_header = req.headers().get("AUTHORIZATION").unwrap();
                        assert!(auth_header.contains("expected_credential"), "{auth_header}");
                        """,
                        *codegenScope,
                    )
                }
            }
        }
    }
}
Loading