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

Make BehaviorVersion as future-proof as the documentation and RFC specify #3513

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,15 @@ message = "Clients now enforce that the Content-Length sent by the server matche
references = ["smithy-rs#3491", "aws-sdk-rust#1079"]
meta = { "breaking" = false, "bug" = true, "tada" = false }
author = "rcoh"

[[aws-sdk-rust]]
message = "Make `BehaviorVersion` be future-proof by disallowing it to be constructed via the `BehaviorVersion {}` syntax."
references = ["aws-sdk-rust#1111", "smithy-rs#3513"]
meta = { "breaking" = true, "tada" = false, "bug" = true }
author = "Ten0"

[[smithy-rs]]
message = "Make `BehaviorVersion` be future-proof by disallowing it to be constructed via the `BehaviorVersion {}` syntax."
references = ["aws-sdk-rust#1111", "smithy-rs#3513"]
meta = { "breaking" = true, "tada" = false, "bug" = true, "target" = "client" }
author = "Ten0"
1 change: 1 addition & 0 deletions design/src/rfcs/rfc0040_behavior_versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ In order to implement this feature, we need to create a `BehaviorVersion` struct
#[derive(Debug, Clone)]
pub struct BehaviorVersion {
// currently there is only 1 MV so we don't actually need anything in here.
_private: (),
}
```

Expand Down
2 changes: 1 addition & 1 deletion rust-runtime/aws-smithy-runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aws-smithy-runtime-api"
version = "1.2.0"
version = "1.3.0"
authors = ["AWS Rust SDK Team <[email protected]>", "Zelda Hessler <[email protected]>"]
description = "Smithy runtime types."
edition = "2021"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,42 @@

/// Behavior major-version of the client
///
/// Over time, new best-practice behaviors are introduced. However, these behaviors might not be backwards
/// compatible. For example, a change which introduces new default timeouts or a new retry-mode for
/// all operations might be the ideal behavior but could break existing applications.
#[derive(Debug, Clone)]
pub struct BehaviorVersion {}
/// Over time, new best-practice behaviors are introduced. However, these behaviors might not be
/// backwards compatible. For example, a change which introduces new default timeouts or a new
/// retry-mode for all operations might be the ideal behavior but could break existing applications.
#[derive(Clone)]
pub struct BehaviorVersion {
// currently there is only 1 MV so we don't actually need anything in here.
_private: (),
}

impl BehaviorVersion {
/// This method will always return the latest major version.
///
/// This is the recommend choice for customers who aren't reliant on extremely specific behavior
/// characteristics. For example, if you are writing a CLI app, the latest behavior major version
/// is probably the best setting for you.
/// characteristics. For example, if you are writing a CLI app, the latest behavior major
/// version is probably the best setting for you.
///
/// If, however, you're writing a service that is very latency sensitive, or that has written
/// code to tune Rust SDK behaviors, consider pinning to a specific major version.
///
/// The latest version is currently [`BehaviorVersion::v2023_11_09`]
pub fn latest() -> Self {
Self {}
Self::v2023_11_09()
}

/// This method returns the behavior configuration for November 9th, 2023
///
/// When a new behavior major version is released, this method will be deprecated.
pub fn v2023_11_09() -> Self {
Self {}
Self { _private: () }
}
}

impl std::fmt::Debug for BehaviorVersion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("BehaviorVersion")
.field("name", &"v2023_11_09")
.finish()
}
}
Loading