Skip to content

Commit

Permalink
update all aws sdks, and update code that the update broke (#114)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #114

X-link: facebook/hhvm#9346

allow-large-files

**What?**

I'm updating all Rust AWS service SDKs to latest (0.24) and all library SDKs to latest (0.54.1), and fixing some code that broke as a result of that

Differential Revision: D43720681

fbshipit-source-id: 8b025dc64f640810e6ebbd384f2a2ac643ce9eeb
  • Loading branch information
Kevin Chang authored and facebook-github-bot committed Mar 7, 2023
1 parent c2f55d5 commit 9fe7c74
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
7 changes: 4 additions & 3 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ hex = "0.3.0"
serde = {version = "1.0.104", features = ["derive"] }
num = "0.2.1"
wasm-timer = "0.2.5"
aws-config = "0.48.0"
aws-sdk-s3 = "0.18.0"
aws-smithy-http = "0.48.0"
aws-config = "0.54.1"
aws-credential-types = "0.54.1"
aws-sdk-s3 = "0.24.0"
aws-smithy-http = "0.54.0"
lazy_static = "1.4.0"
regex = "1.5.4"
tempfile = "3.2.0"
Expand Down
23 changes: 14 additions & 9 deletions common/src/s3_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use std::path::Path;
use std::str::FromStr;
use std::time::Duration;

use aws_config::default_provider::credentials::DefaultCredentialsChain;
use aws_config::default_provider::credentials::default_provider;
use aws_credential_types::cache::CredentialsCache;
use regex::Regex;

lazy_static::lazy_static! {
Expand Down Expand Up @@ -47,12 +48,14 @@ impl S3Path {
}

pub async fn copy_to_local(&self) -> Result<String, std::io::Error> {
let default_provider = DefaultCredentialsChain::builder()
.load_timeout(Duration::from_secs(30))
.build()
.await;
let default_provider = default_provider().await;
let region = aws_sdk_s3::Region::new(self.get_region().clone());
let aws_cfg = aws_config::from_env()
.credentials_cache(
CredentialsCache::lazy_builder()
.load_timeout(Duration::from_secs(30))
.into_credentials_cache(),
)
.credentials_provider(default_provider)
.region(region)
.load()
Expand Down Expand Up @@ -92,13 +95,15 @@ impl S3Path {
}

pub async fn copy_from_local(&self, path: impl AsRef<Path>) -> Result<(), aws_sdk_s3::Error> {
let default_provider = DefaultCredentialsChain::builder()
.load_timeout(Duration::from_secs(30))
.build()
.await;
let default_provider = default_provider().await;
let region = aws_sdk_s3::Region::new(self.get_region().clone());
let aws_cfg = aws_config::from_env()
.region(region)
.credentials_cache(
CredentialsCache::lazy_builder()
.load_timeout(Duration::from_secs(30))
.into_credentials_cache(),
)
.credentials_provider(default_provider)
.load()
.await;
Expand Down

0 comments on commit 9fe7c74

Please sign in to comment.