Skip to content

Commit

Permalink
Merge branch 'main' into harryb/scoped-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
hlbarber committed Jun 14, 2023
2 parents f96e6ab + 312d190 commit 4613440
Show file tree
Hide file tree
Showing 111 changed files with 1,593 additions and 1,231 deletions.
14 changes: 14 additions & 0 deletions .cargo-deny-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ name = "ring"
expression = "MIT AND ISC AND OpenSSL"
license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }]

[[licenses.clarify]]
name = "webpki"
expression = "ISC"
license-files = [
{ path = "LICENSE", hash = 0x001c7e6c },
]

[[licenses.clarify]]
name = "rustls-webpki"
expression = "ISC"
license-files = [
{ path = "LICENSE", hash = 0x001c7e6c },
]

# This section is considered when running `cargo deny check bans`.
# More documentation about the 'bans' section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html
Expand Down
4 changes: 4 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build]
# Share one `target` directory at the project root for all Cargo projects and workspaces in smithy-rs
target-dir = "target"

# TODO(https://github.com/awslabs/smithy-rs/issues/2766): The sparse registry config can be removed when upgrading to Rust 1.70
[registries.crates-io]
protocol = "sparse"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
required: false

env:
rust_version: 1.67.1
rust_version: 1.68.2
rust_toolchain_components: clippy,rustfmt
ENCRYPTED_DOCKER_PASSWORD: ${{ secrets.ENCRYPTED_DOCKER_PASSWORD }}
DOCKER_LOGIN_TOKEN_PASSPHRASE: ${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/claim-crate-names.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true

env:
rust_version: 1.67.1
rust_version: 1.68.2

name: Claim unpublished crate names on crates.io
run-name: ${{ github.workflow }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
name: Update GitHub Pages

env:
rust_version: 1.67.1
rust_version: 1.68.2

# Allow only one doc pages build to run at a time for the entire smithy-rs repo
concurrency:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ concurrency:

env:
java_version: 11
rust_version: 1.67.1
rust_version: 1.68.2
rust_toolchain_components: clippy,rustfmt
apt_dependencies: libssl-dev gnuplot jq

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true

env:
rust_version: 1.67.1
rust_version: 1.68.2

name: Release smithy-rs
run-name: ${{ github.workflow }} ${{ inputs.semantic_version }} (${{ inputs.commit_sha }}) - ${{ inputs.dry_run && 'Dry run' || 'Production run' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-sdk-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.67.1
toolchain: 1.68.2
- name: Delete old SDK
run: |
- name: Generate a fresh SDK
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ references = ["smithy-rs#2742"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "ysaito1001"

[[aws-sdk-rust]]
message = "Update MSRV to Rust 1.68.2"
references = ["smithy-rs#2745"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "jdisanti"

[[smithy-rs]]
message = "Update MSRV to Rust 1.68.2"
references = ["smithy-rs#2745"]
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all"}
author = "jdisanti"

[[smithy-rs]]
message = """`ShapeId` is the new structure used to represent a shape, with its absolute name, namespace and name.
`OperationExtension`'s members are replaced by the `ShapeId` and operations' names are now replced by a `ShapeId`.
Expand Down
6 changes: 3 additions & 3 deletions aws/rust-runtime/aws-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ aws-smithy-http-tower = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-http-to
aws-smithy-json = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-json" }
aws-smithy-types = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-types" }
aws-types = { path = "../../sdk/build/aws-sdk/sdk/aws-types" }
hyper = { version = "0.14.25", default-features = false }
hyper = { version = "0.14.26", default-features = false }
time = { version = "0.3.4", features = ["parsing"] }
tokio = { version = "1.13.1", features = ["sync"] }
tracing = { version = "0.1" }
Expand All @@ -55,7 +55,7 @@ tracing-subscriber = { version = "0.3.16", features = ["fmt", "json"] }
tokio = { version = "1.23.1", features = ["full", "test-util"] }

# used for fuzzing profile parsing
arbitrary = "=1.1.3" # 1.1.4 requires Rust 1.63 to compile
arbitrary = "1.3"

# used for test case deserialization
serde = { version = "1", features = ["derive"] }
Expand All @@ -65,7 +65,7 @@ aws-credential-types = { path = "../../sdk/build/aws-sdk/sdk/aws-credential-type
aws-smithy-client = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-client", features = ["test-util"] }

# used for a usage example
hyper-rustls = { version = "0.23.0", features = ["webpki-tokio", "http2", "http1"] }
hyper-rustls = { version = "0.24", features = ["webpki-tokio", "http2", "http1"] }

[package.metadata.docs.rs]
all-features = true
Expand Down
1 change: 0 additions & 1 deletion aws/rust-runtime/aws-config/src/profile/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ async fn build_provider_chain(

#[cfg(test)]
mod test {

use crate::profile::credentials::Builder;
use crate::test_case::TestEnvironment;

Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-credential-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async-trait = "0.1.51"
env_logger = "0.9.0"

tokio = { version = "1.23.1", features = ["full", "test-util", "rt"] }
tracing-test = "0.2.1"
tracing-test = "0.2.4"
# TODO(https://github.com/awslabs/smithy-rs/issues/2619): Remove this
# workaround once the fixed is upstreamed.
regex = { version = "1.0", features = ["unicode-case", "unicode-perl"] }
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ aws-smithy-protocol-test = { path = "../../../rust-runtime/aws-smithy-protocol-t
bytes-utils = "0.1.2"
env_logger = "0.9"
tokio = { version = "1.23.1", features = ["macros", "rt", "rt-multi-thread", "test-util", "time"] }
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
proptest = "1"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
proptest = "1.2"
serde = { version = "1", features = ["derive"]}
serde_json = "1"

Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-inlineable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ aws-credential-types = { path = "../aws-credential-types", features = ["test-uti
aws-smithy-client = { path = "../../../rust-runtime/aws-smithy-client", features = ["test-util"] }
aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http", features = ["rt-tokio"] }
aws-smithy-runtime = { path = "../../../rust-runtime/aws-smithy-runtime" }
tempfile = "3.2.0"
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
tempfile = "3.6.0"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async", features = ["test-util"] }

[package.metadata.docs.rs]
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-inlineable/src/glacier_checksums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fn compute_hash_tree(mut hashes: Vec<Digest>) -> Digest {
"even an empty file will produce a digest. this function assumes that hashes is non-empty"
);
while hashes.len() > 1 {
let next = hashes.chunks(2).into_iter().map(|chunk| match *chunk {
let next = hashes.chunks(2).map(|chunk| match *chunk {
[left, right] => {
let mut ctx = Context::new(&SHA256);
ctx.update(left.as_ref());
Expand Down
9 changes: 5 additions & 4 deletions aws/rust-runtime/aws-inlineable/src/glacier_interceptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use aws_smithy_runtime_api::client::interceptors::{
BeforeSerializationInterceptorContextMut, BeforeTransmitInterceptorContextMut, BoxError,
Interceptor,
};
use aws_smithy_runtime_api::client::orchestrator::LoadedRequestBody;
use aws_smithy_runtime_api::client::orchestrator::{ConfigBagAccessors, LoadedRequestBody};
use aws_smithy_types::config_bag::ConfigBag;
use bytes::Bytes;
use http::header::{HeaderName, HeaderValue};
Expand Down Expand Up @@ -119,7 +119,8 @@ impl Interceptor for GlacierTreeHashHeaderInterceptor {
) -> Result<(), BoxError> {
// Request the request body to be loaded into memory immediately after serialization
// so that it can be checksummed before signing and transmit
cfg.put(LoadedRequestBody::Requested);
cfg.interceptor_state()
.set_loaded_request_body(LoadedRequestBody::Requested);
Ok(())
}

Expand All @@ -139,7 +140,7 @@ impl Interceptor for GlacierTreeHashHeaderInterceptor {
.clone();
signing_config.signing_options.payload_override =
Some(SignableBody::Precomputed(content_sha256));
cfg.put(signing_config);
cfg.interceptor_state().put(signing_config);
} else {
return Err(
"the request body wasn't loaded into memory before the retry loop, \
Expand Down Expand Up @@ -215,7 +216,7 @@ fn compute_hash_tree(mut hashes: Vec<Digest>) -> Digest {
"even an empty file will produce a digest. this function assumes that hashes is non-empty"
);
while hashes.len() > 1 {
let next = hashes.chunks(2).into_iter().map(|chunk| match *chunk {
let next = hashes.chunks(2).map(|chunk| match *chunk {
[left, right] => {
let mut ctx = Context::new(&SHA256);
ctx.update(left.as_ref());
Expand Down
33 changes: 16 additions & 17 deletions aws/rust-runtime/aws-inlineable/src/presigning_interceptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use aws_smithy_runtime_api::client::interceptors::{
};
use aws_smithy_runtime_api::client::orchestrator::ConfigBagAccessors;
use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
use aws_smithy_types::config_bag::ConfigBag;
use aws_smithy_types::config_bag::{ConfigBag, FrozenLayer, Layer};

/// Interceptor that tells the SigV4 signer to add the signature to query params,
/// and sets the request expiration time from the presigning config.
Expand All @@ -40,14 +40,15 @@ impl Interceptor for SigV4PresigningInterceptor {
_context: &mut BeforeSerializationInterceptorContextMut<'_>,
cfg: &mut ConfigBag,
) -> Result<(), BoxError> {
cfg.put::<HeaderSerializationSettings>(
cfg.interceptor_state().put::<HeaderSerializationSettings>(
HeaderSerializationSettings::new()
.omit_default_content_length()
.omit_default_content_type(),
);
cfg.set_request_time(SharedTimeSource::new(StaticTimeSource::new(
self.config.start_time(),
)));
cfg.interceptor_state()
.set_request_time(SharedTimeSource::new(StaticTimeSource::new(
self.config.start_time(),
)));
Ok(())
}

Expand All @@ -61,7 +62,8 @@ impl Interceptor for SigV4PresigningInterceptor {
config.signing_options.signature_type = HttpSignatureType::HttpRequestQueryParams;
config.signing_options.payload_override =
Some(aws_sigv4::http_request::SignableBody::UnsignedPayload);
cfg.put::<SigV4OperationSigningConfig>(config);
cfg.interceptor_state()
.put::<SigV4OperationSigningConfig>(config);
Ok(())
} else {
Err(
Expand All @@ -87,18 +89,15 @@ impl SigV4PresigningRuntimePlugin {
}

impl RuntimePlugin for SigV4PresigningRuntimePlugin {
fn configure(
&self,
cfg: &mut ConfigBag,
interceptors: &mut InterceptorRegistrar,
) -> Result<(), BoxError> {
// Disable some SDK interceptors that shouldn't run for presigning
cfg.put(disable_interceptor::<InvocationIdInterceptor>("presigning"));
cfg.put(disable_interceptor::<RequestInfoInterceptor>("presigning"));
cfg.put(disable_interceptor::<UserAgentInterceptor>("presigning"));
fn config(&self) -> Option<FrozenLayer> {
let mut layer = Layer::new("Presigning");
layer.put(disable_interceptor::<InvocationIdInterceptor>("presigning"));
layer.put(disable_interceptor::<RequestInfoInterceptor>("presigning"));
layer.put(disable_interceptor::<UserAgentInterceptor>("presigning"));
Some(layer.freeze())
}

// Register the presigning interceptor
fn interceptors(&self, interceptors: &mut InterceptorRegistrar) {
interceptors.register(self.interceptor.clone());
Ok(())
}
}
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async", features =
aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types", features = ["test-util"] }
aws-smithy-protocol-test = { path = "../../../rust-runtime/aws-smithy-protocol-test" }
aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["test-util"] }
proptest = "1"
proptest = "1.2"
serde = { version = "1", features = ["derive"]}
serde_json = "1"
tracing-test = "0.2.1"
tracing-test = "0.2.4"

[package.metadata.docs.rs]
all-features = true
Expand Down
19 changes: 14 additions & 5 deletions aws/rust-runtime/aws-runtime/src/auth/sigv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,18 @@ impl SigV4HttpRequestSigner {
.get::<SigV4OperationSigningConfig>()
.ok_or(SigV4SigningError::MissingOperationSigningConfig)?;

let signing_region = config_bag.get::<SigningRegion>();
let signing_service = config_bag.get::<SigningService>();

let EndpointAuthSchemeConfig {
signing_region_override,
signing_service_override,
} = Self::extract_endpoint_auth_scheme_config(auth_scheme_endpoint_config)?;

match (signing_region_override, signing_service_override) {
match (
signing_region_override.or_else(|| signing_region.cloned()),
signing_service_override.or_else(|| signing_service.cloned()),
) {
(None, None) => Ok(Cow::Borrowed(operation_config)),
(region, service) => {
let mut operation_config = operation_config.clone();
Expand Down Expand Up @@ -500,6 +506,7 @@ mod tests {
use super::*;
use aws_credential_types::Credentials;
use aws_sigv4::http_request::SigningSettings;
use aws_smithy_types::config_bag::Layer;
use aws_types::region::SigningRegion;
use aws_types::SigningService;
use std::collections::HashMap;
Expand Down Expand Up @@ -550,8 +557,8 @@ mod tests {

#[test]
fn endpoint_config_overrides_region_and_service() {
let mut cfg = ConfigBag::base();
cfg.put(SigV4OperationSigningConfig {
let mut layer = Layer::new("test");
layer.put(SigV4OperationSigningConfig {
region: Some(SigningRegion::from(Region::new("override-this-region"))),
service: Some(SigningService::from_static("override-this-service")),
signing_options: Default::default(),
Expand All @@ -571,6 +578,7 @@ mod tests {
});
let config = AuthSchemeEndpointConfig::new(Some(&config));

let cfg = ConfigBag::of_layers(vec![layer]);
let result =
SigV4HttpRequestSigner::extract_operation_config(config, &cfg).expect("success");

Expand All @@ -587,12 +595,13 @@ mod tests {

#[test]
fn endpoint_config_supports_fallback_when_region_or_service_are_unset() {
let mut cfg = ConfigBag::base();
cfg.put(SigV4OperationSigningConfig {
let mut layer = Layer::new("test");
layer.put(SigV4OperationSigningConfig {
region: Some(SigningRegion::from(Region::new("us-east-1"))),
service: Some(SigningService::from_static("qldb")),
signing_options: Default::default(),
});
let cfg = ConfigBag::of_layers(vec![layer]);
let config = AuthSchemeEndpointConfig::empty();

let result =
Expand Down
3 changes: 2 additions & 1 deletion aws/rust-runtime/aws-runtime/src/invocation_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ impl Interceptor for InvocationIdInterceptor {
.map(|gen| gen.generate())
.transpose()?
.flatten();
cfg.put::<InvocationId>(id.unwrap_or_default());
cfg.interceptor_state()
.put::<InvocationId>(id.unwrap_or_default());

Ok(())
}
Expand Down
9 changes: 5 additions & 4 deletions aws/rust-runtime/aws-runtime/src/request_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ mod tests {
use crate::request_info::RequestPairs;
use aws_smithy_http::body::SdkBody;
use aws_smithy_runtime_api::client::interceptors::{Interceptor, InterceptorContext};
use aws_smithy_types::config_bag::ConfigBag;
use aws_smithy_types::config_bag::{ConfigBag, Layer};
use aws_smithy_types::retry::RetryConfig;
use aws_smithy_types::timeout::TimeoutConfig;
use aws_smithy_types::type_erasure::TypeErasedBox;
Expand All @@ -190,13 +190,14 @@ mod tests {
context.enter_serialization_phase();
context.set_request(http::Request::builder().body(SdkBody::empty()).unwrap());

let mut config = ConfigBag::base();
config.put(RetryConfig::standard());
config.put(
let mut layer = Layer::new("test");
layer.put(RetryConfig::standard());
layer.put(
TimeoutConfig::builder()
.read_timeout(Duration::from_secs(30))
.build(),
);
let mut config = ConfigBag::of_layers(vec![layer]);

let _ = context.take_input();
context.enter_before_transmit_phase();
Expand Down
Loading

0 comments on commit 4613440

Please sign in to comment.