Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
rust-s3
Tiny Rust library for working with Amazon S3
Rust nightly required because of compile time configuration, will likely create a stable branch...
Increasingly more loosly based on crates.io implementation.
Intro
Very modest interface towards Amazon S3.
Supports put
, get
and list
, with delete
on the roadmap and will be done eventually,
probably around the time I discover I need it in some other project :).
What is cool
The main (and probably only) cool feature is that put
commands return a presigned link to the file you uploaded.
This means you can upload to s3, and give the link to select people without having to worry about publicly accessible files on S3.
Configuration
Compile time configuration is done using Config.toml,
curtosy of confy. You don't really have to touch anything there, maybe amz-expire
,
it is configured for one week which is the maximum Amazon allows ATM.
Usage
In your Cargo.toml
[dependencies]
rust-s3 = '0.2.0'
Example
extern crate rust-s3;
use rust-s3::{Bucket, put_s3, get_s3, list_s3};
const S3_BUCKET: &'static str = "bucket_name";
const AWS_ACCESS: &'static str = "access_key";
const AWS_SECRET: &'static str = "secret_key";
fn main () {
// Bucket instance
let bucket = Bucket::new(S3_BUCKET.to_string(),
None,
AWS_ACCESS.to_string(),
AWS_SECRET.to_string(),
&"https");
// Put
let put_me = "I want to go to S3".to_string();
let url = put_s3(&bucket,
&"/",
&put_me.as_bytes());
println!("{}", url);
// List
let bytes = list_s3(&bucket,
&"/",
&"/",
&"/");
let string = String::from_utf8_lossy(&bytes);
println!("{}", string);
// Get
let path = &"test_file";
let mut buffer = match File::create(path) {
Ok(x) => x,
Err(e) => panic!("{:?}, {}", e, path)
};
let bytes = get_s3(&bucket, Some(&path));
match buffer.write(&bytes) {
Ok(_) => {} // info!("Written {} bytes from {}", x, path),
Err(e) => panic!("{:?}", e)
}
}