Skip to content

Commit

Permalink
feat: use list_buckets instead of get_bucket_accelerate_configuration (
Browse files Browse the repository at this point in the history
  • Loading branch information
Cluas authored Aug 14, 2022
1 parent 3c5aaf2 commit b1ec9be
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions replibyte/src/datastore/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,19 @@ fn create_bucket<'a, S: AsRef<str>>(

let cfg = cfg.build();

if let Ok(_) = block_on(
client
.get_bucket_accelerate_configuration()
.bucket(bucket)
.send(),
) {
info!("bucket {} exists", bucket);
return Ok(());
if let Ok(output) = block_on(client.list_buckets().send()) {
if let Some(buckets) = output.buckets {
if buckets.iter().any(|b| {
if let Some(name) = &b.name {
name == bucket
} else {
false
}
}) {
info!("bucket {} exists", bucket);
return Ok(());
}
}
}

let result = block_on(
Expand Down

0 comments on commit b1ec9be

Please sign in to comment.