|
|
|
@ -3,7 +3,7 @@ use std::env;
|
|
|
|
|
use rusoto_core::Region; |
|
|
|
|
use rusoto_credential::StaticProvider; |
|
|
|
|
use rusoto_core::request::HttpClient; |
|
|
|
|
use rusoto_s3::ListObjectsV2Request; |
|
|
|
|
use rusoto_s3::ListObjectsRequest; |
|
|
|
|
use rusoto_s3::S3; |
|
|
|
|
use rusoto_s3::S3Client; |
|
|
|
|
|
|
|
|
@ -29,14 +29,27 @@ fn main() {
|
|
|
|
|
region |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
let list_objects_request = ListObjectsV2Request { |
|
|
|
|
let mut truncated = Some(true); |
|
|
|
|
let mut start_at = None; |
|
|
|
|
|
|
|
|
|
while truncated.unwrap_or(false) { |
|
|
|
|
let list_objects_request = ListObjectsRequest { |
|
|
|
|
bucket: bucket.to_owned(), |
|
|
|
|
marker: start_at, |
|
|
|
|
..Default::default() |
|
|
|
|
}; |
|
|
|
|
println!("Request: {:?}", list_objects_request); |
|
|
|
|
|
|
|
|
|
let result = client |
|
|
|
|
.list_objects_v2(list_objects_request) |
|
|
|
|
.list_objects(list_objects_request) |
|
|
|
|
.sync() |
|
|
|
|
.expect("Can't list contents of buckets"); |
|
|
|
|
println!("List result: {:?}", result); |
|
|
|
|
truncated = result.is_truncated; |
|
|
|
|
start_at = result.next_marker; |
|
|
|
|
|
|
|
|
|
result.contents |
|
|
|
|
.expect("Didn't get any objects") |
|
|
|
|
.iter() |
|
|
|
|
.for_each(|item| { println!("{}", item.key.as_ref().unwrap()); }); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|