Julio Biason
5 years ago
4 changed files with 1811 additions and 1 deletions
@ -1,2 +1,5 @@ |
|||||||
/target |
/target |
||||||
**/*.rs.bk |
**/*.rs.bk |
||||||
|
|
||||||
|
.idea |
||||||
|
*.sw? |
||||||
|
@ -1,3 +1,34 @@ |
|||||||
|
use std::env; |
||||||
|
|
||||||
|
use rusoto_core::Region; |
||||||
|
use rusoto_s3::S3Client; |
||||||
|
use rusoto_s3::ListObjectsV2Request; |
||||||
|
use rusoto_s3::S3; |
||||||
|
|
||||||
fn main() { |
fn main() { |
||||||
println!("Hello, world!"); |
let region = env::var("NC_REGION").expect("export NC_REGION with the endpoint region"); |
||||||
|
let endpoint = env::var("NC_ENDPOINT").expect("export NC_ENDPOINT with the endpot URL"); |
||||||
|
let bucket = env::var("NC_BUCKET").expect("export NC_BUCKET with the bucket to be accessed"); |
||||||
|
|
||||||
|
println!("Accessing {}::{}", |
||||||
|
region, |
||||||
|
endpoint); |
||||||
|
|
||||||
|
let region = Region::Custom { |
||||||
|
name: region.to_owned(), |
||||||
|
endpoint: endpoint.to_owned() |
||||||
|
}; |
||||||
|
|
||||||
|
let client = S3Client::new(region); |
||||||
|
|
||||||
|
let list_objects_request = ListObjectsV2Request { |
||||||
|
bucket: bucket.to_owned(), |
||||||
|
..Default::default() |
||||||
|
}; |
||||||
|
|
||||||
|
let result = client |
||||||
|
.list_objects_v2(list_objects_request) |
||||||
|
.sync() |
||||||
|
.expect("Can't list contents of buckets"); |
||||||
|
println!("List result: {:?}", result); |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue