Unverified Commit 446326c5 authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

Add support for BehaviorMajorVersions (#3151)

## Motivation and Context
See [rendered
RFC](https://github.com/awslabs/smithy-rs/blob/df518bfb59c7498ab533fac4256ec0b977cee42c/design/src/rfcs/rfc0039_behavior_major_versions.md)

## Description
This add `BehaviorMajorVersions` to the SDK and wires them in up and
down the stack.

## Testing
- [x] lots of ITs / UTs

## 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._
parent 41286629
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -67,6 +67,35 @@ references = ["smithy-rs#3160"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "jdisanti"

[[aws-sdk-rust]]
message = """Clients now require a `BehaviorMajorVersion` to be provided. For must customers, `latest` is the best choice. This will be enabled automatically if you enable the `behavior-version-latest` cargo feature on `aws-config` or on an SDK crate. For customers that wish to pin to a specific behavior major version, it can be set in `aws-config` or when constructing the service client.

```rust
async fn example() {
    // with aws-config
    let conf = aws_config::from_env_with_version(aws_config::BehaviorMajorVersion::v2023_11_09());

    // when creating a client
    let client = my_service::Client::from_conf(my_service::Config::builder().behavior_major_version(..).<other params>.build());
}
```"""
references = ["smithy-rs#3151"]
author = "rcoh"
meta = { "breaking" = true, "tada" = false, "bug" = false }

[[smithy-rs]]
message = """Clients now require a `BehaviorMajorVersion` to be provided. For must customers, `latest` is the best choice. This will be enabled automatically if you enable the `behavior-version-latest` cargo feature on `aws-config` or on an SDK crate. For customers that wish to pin to a specific behavior major version, it can be set in `aws-config` or when constructing the service client.

```rust
async fn example() {
    // when creating a client
    let client = my_service::Client::from_conf(my_service::Config::builder().behavior_major_version(..).<other params>.build());
}
```"""
references = ["smithy-rs#3151"]
author = "rcoh"
meta = { "breaking" = true, "tada" = false, "bug" = false }

[[aws-sdk-rust]]
message = "Add `ProvideErrorMetadata` impl for service `Error` type."
references = ["aws-sdk-rust#780", "smithy-rs#3189"]
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ The SDK provides one crate per AWS service. You must add [Tokio](https://crates.

    ```toml
    [dependencies]
    aws-config = "{{sdk_version_aws_config}}"
    aws-config = { version= "{{sdk_version_aws_config}}", features = ["behavior-version-latest"] }
    aws-sdk-dynamodb = "{{sdk_version_aws_sdk_dynamodb}}"
    tokio = { version = "1", features = ["full"] }
    ```
+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ license = "Apache-2.0"
repository = "https://github.com/smithy-lang/smithy-rs"

[features]
behavior-version-latest = []
client-hyper = ["aws-smithy-runtime/connector-hyper-0-14-x"]
rustls = ["aws-smithy-runtime/tls-rustls", "client-hyper"]
allow-compilation = [] # our tests use `cargo test --all-features` and native-tls breaks CI
@@ -71,6 +72,7 @@ serde_json = "1"
hyper-rustls = { version = "0.24", features = ["webpki-tokio", "http2", "http1"] }
aws-smithy-async = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-async", features = ["rt-tokio", "test-util"] }


[package.metadata.docs.rs]
all-features = true
targets = ["x86_64-unknown-linux-gnu"]
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ allowed_external_types = [
   "aws_smithy_runtime_api::client::http::SharedHttpClient",
   "aws_smithy_runtime_api::client::identity::ResolveCachedIdentity",
   "aws_smithy_runtime_api::client::identity::ResolveIdentity",
   "aws_smithy_runtime_api::client::behavior_version::BehaviorMajorVersion",
   "aws_smithy_runtime_api::client::orchestrator::HttpResponse",
   "aws_smithy_runtime_api::client::result::SdkError",
   "aws_smithy_types::body::SdkBody",
+2 −1
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ mod tests {
    use crate::profile::profile_file::{ProfileFileKind, ProfileFiles};
    use crate::provider_config::ProviderConfig;
    use crate::test_case::{no_traffic_client, InstantSleep};
    use aws_smithy_runtime_api::client::behavior_version::BehaviorMajorVersion;
    use aws_types::os_shim_internal::{Env, Fs};

    #[tokio::test]
@@ -117,7 +118,7 @@ mod tests {
    #[tokio::test]
    async fn profile_name_override() {
        let fs = Fs::from_slice(&[("test_config", "[profile custom]\nsdk_ua_app_id = correct")]);
        let conf = crate::from_env()
        let conf = crate::from_env_with_version(BehaviorMajorVersion::latest())
            .sleep_impl(InstantSleep)
            .fs(fs)
            .http_client(no_traffic_client())
Loading