From 1ab1af7b5df9502a236d906e9c1874888d7d6ff2 Mon Sep 17 00:00:00 2001 From: Pete Tummillo Date: Wed, 7 Aug 2024 04:57:08 -0700 Subject: [PATCH] Upgrade the Rust aws-sdk-gamelift crate to latest (1.38.0) and upgrade the rest of the AWS crates to the versions that were released alongside it Summary: [release-2024-07-29](https://github.com/awslabs/aws-sdk-rust/releases/tag/release-2024-07-29) is the aws-sdk-rust release that the other crates' versions were pulled from. **Why?** I need [CreateFleet](https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateFleet.html)'s [InstanceRoleCredentialsProvider](https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateFleet.html#gamelift-CreateFleet-request-InstanceRoleCredentialsProvider) parameter. **Changes** * The new AWS SDK requires ring 0.17.5 or later, so ring was upgraded from 0.17.3 to 0.17.8 and I had to add fixups to get it building for Windows. * [aws-smithy-client](https://crates.io/crates/aws-smithy-client) was replaced by [aws-smithy-runtime](https://crates.io/crates/aws-smithy-runtime) and [aws-smithy-runtime-api](https://crates.io/crates/aws-smithy-runtime-api). * ```aws_smithy_http::body``` was moved to ```aws_smithy_types::body```. * ```aws_smithy_http::byte_stream``` was moved to ```aws_smithy_types::byte_stream```. * Struct members modeled as required are no longer wrapped in ```Option```s [when possible](https://smithy.io/2.0/spec/aggregate-types.html#structure-member-optionality). allow-large-files bypass_size_limit Approved commit size limit bypass request: https://fb.workplace.com/groups/scm/permalink/7831552160227669/ Reviewed By: dtolnay Differential Revision: D60582035 fbshipit-source-id: 81bf9f3ec41abed20a6a6fa109d0509c447227fa --- common/src/s3_path.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/common/src/s3_path.rs b/common/src/s3_path.rs index 615d75d..cecf6f2 100644 --- a/common/src/s3_path.rs +++ b/common/src/s3_path.rs @@ -9,7 +9,8 @@ use std::str::FromStr; use std::time::Duration; use aws_config::default_provider::credentials::default_provider; -use aws_credential_types::cache::CredentialsCache; +use aws_config::BehaviorVersion; +use aws_sdk_s3::config::IdentityCache; use regex::Regex; lazy_static::lazy_static! { @@ -50,11 +51,11 @@ impl S3Path { pub async fn copy_to_local(&self) -> Result { let default_provider = default_provider().await; let region = aws_sdk_s3::config::Region::new(self.get_region().clone()); - let aws_cfg = aws_config::from_env() - .credentials_cache( - CredentialsCache::lazy_builder() + let aws_cfg = aws_config::defaults(BehaviorVersion::latest()) + .identity_cache( + IdentityCache::lazy() .load_timeout(Duration::from_secs(30)) - .into_credentials_cache(), + .build(), ) .credentials_provider(default_provider) .region(region) @@ -97,12 +98,12 @@ impl S3Path { pub async fn copy_from_local(&self, path: impl AsRef) -> Result<(), aws_sdk_s3::Error> { let default_provider = default_provider().await; let region = aws_sdk_s3::config::Region::new(self.get_region().clone()); - let aws_cfg = aws_config::from_env() + let aws_cfg = aws_config::defaults(BehaviorVersion::latest()) .region(region) - .credentials_cache( - CredentialsCache::lazy_builder() + .identity_cache( + IdentityCache::lazy() .load_timeout(Duration::from_secs(30)) - .into_credentials_cache(), + .build(), ) .credentials_provider(default_provider) .load() @@ -149,7 +150,7 @@ impl S3Path { let byte_stream = aws_sdk_s3::primitives::ByteStream::read_from() .path(path.as_ref()) .offset(i * chunk_size) - .length(aws_smithy_http::byte_stream::Length::Exact(length)) + .length(aws_smithy_types::byte_stream::Length::Exact(length)) .build() .await; let upload = client