Skip to content

Commit 6f339bb

Browse files
committed
Closes: #375, #366, #362, #351
1 parent 5fde256 commit 6f339bb

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

aws-creds/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "aws-creds"
33
version = "0.37.0"
44
authors = ["Drazen Urch"]
5-
description = "Tiny Rust library for working with Amazon IAM credential,s, supports `s3` crate"
5+
description = "Rust library for working with Amazon IAM credential,s, supports `s3` crate"
66
repository = "https://github.com/durch/rust-s3"
77
readme = "README.md"
88
keywords = ["AWS", "S3", "Wasabi", "Minio", "R2"]

aws-creds/src/credentials.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ impl Credentials {
301301
Credentials::from_sts_env("aws-creds")
302302
.or_else(|_| Credentials::from_env())
303303
.or_else(|_| Credentials::from_profile(profile))
304-
.or_else(|_| Credentials::from_instance_metadata_v2())
305-
.or_else(|_| Credentials::from_instance_metadata())
304+
.or_else(|_| Credentials::from_instance_metadata_v2(false))
305+
.or_else(|_| Credentials::from_instance_metadata(false))
306306
.map_err(|_| CredentialsError::NoCredentials)
307307
}
308308

@@ -331,7 +331,7 @@ impl Credentials {
331331
}
332332

333333
#[cfg(feature = "http-credentials")]
334-
pub fn from_instance_metadata() -> Result<Credentials, CredentialsError> {
334+
pub fn from_instance_metadata(not_ec2: bool) -> Result<Credentials, CredentialsError> {
335335
let resp: CredentialsFromInstanceMetadata =
336336
match env::var("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") {
337337
Ok(credentials_path) => {
@@ -344,7 +344,7 @@ impl Credentials {
344344
.json()?
345345
}
346346
Err(_) => {
347-
if !is_ec2() {
347+
if !not_ec2 && !is_ec2() {
348348
return Err(CredentialsError::NotEc2);
349349
}
350350

@@ -373,8 +373,8 @@ impl Credentials {
373373
}
374374

375375
#[cfg(feature = "http-credentials")]
376-
pub fn from_instance_metadata_v2() -> Result<Credentials, CredentialsError> {
377-
if !is_ec2() {
376+
pub fn from_instance_metadata_v2(not_ec2: bool) -> Result<Credentials, CredentialsError> {
377+
if !not_ec2 && !is_ec2() {
378378
return Err(CredentialsError::NotEc2);
379379
}
380380

s3/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22
name = "rust-s3"
3-
version = "0.35.0-alpha.1"
3+
version = "0.35.0-alpha.2"
44
authors = ["Drazen Urch"]
55
description = "Rust library for working with AWS S3 and compatible object storage APIs"
66
repository = "https://github.com/durch/rust-s3"
77
readme = "README.md"
88
keywords = ["S3", "Wasabi", "Minio", "GCP", "R2"]
99
license = "MIT"
10-
documentation = "https://docs.rs/aws-creds/latest/awscreds/"
10+
documentation = "https://docs.rs/rust-s3/latest/s3/"
1111
edition = "2018"
1212

1313
[lib]

s3/src/bucket.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ pub struct Bucket {
111111

112112
impl Bucket {
113113
#[maybe_async::async_impl]
114+
/// Credential refreshing is done automatically, but can be manually triggered.
114115
pub async fn credentials_refresh(&self) -> Result<(), S3Error> {
115116
Ok(self.credentials.write().await.refresh()?)
116117
}
117118

118119
#[maybe_async::sync_impl]
120+
/// Credential refreshing is done automatically, but can be manually triggered.
119121
pub fn credentials_refresh(&self) -> Result<(), S3Error> {
120122
match self.credentials.write() {
121123
Ok(mut credentials) => Ok(credentials.refresh()?),
@@ -1477,7 +1479,7 @@ impl Bucket {
14771479
#[maybe_async::sync_impl]
14781480
pub fn put_multipart_chunk(
14791481
&self,
1480-
chunk: Vec<u8>,
1482+
chunk: &[u8],
14811483
path: &str,
14821484
part_number: u32,
14831485
upload_id: &str,

0 commit comments

Comments
 (0)