Skip to main content

rusty_s3/
lib.rs

1//! A simple, pure Rust AWS S3 client following a Sans-IO approach
2//!
3//! The rusty-s3 crate provides a convenient API for signing, building
4//! and parsing AWS S3 requests and responses.
5//! It follows a Sans-IO approach, meaning that the library itself doesn't
6//! send any of the requests. It's the reposibility of the user to choose an
7//! HTTP client, be it synchronous or asynchronous, and use it to send the requests.
8//!
9//! ## Basic getting started example
10//!
11//! ```rust
12//! use std::env;
13//! use std::time::Duration;
14//! use rusty_s3::{Bucket, Credentials, S3Action, UrlStyle};
15//! # unsafe {
16//! #     env::set_var("AWS_ACCESS_KEY_ID", "key");
17//! #     env::set_var("AWS_SECRET_ACCESS_KEY", "secret");
18//! # }
19//!
20//! // setting up a bucket
21//! let endpoint = "https://s3.dualstack.eu-west-1.amazonaws.com".parse().expect("endpoint is a valid Url");
22//! let path_style = UrlStyle::VirtualHost;
23//! let name = "rusty-s3";
24//! let region = "eu-west-1";
25//! let bucket = Bucket::new(endpoint, path_style, name, region).expect("Url has a valid scheme and host");
26//!
27//! // setting up the credentials
28//! let key = env::var("AWS_ACCESS_KEY_ID").expect("AWS_ACCESS_KEY_ID is set and a valid String");
29//! let secret = env::var("AWS_SECRET_ACCESS_KEY").expect("AWS_SECRET_ACCESS_KEY is set and a valid String");
30//! let credentials = Credentials::new(key, secret);
31//!
32//! // signing a request
33//! let presigned_url_duration = Duration::from_secs(60 * 60);
34//! let action = bucket.get_object(Some(&credentials), "duck.jpg");
35//! println!("GET {}", action.sign(presigned_url_duration));
36//! ```
37
38#![deny(
39    missing_debug_implementations,
40    missing_copy_implementations,
41    rust_2018_idioms,
42    rustdoc::broken_intra_doc_links
43)]
44#![cfg_attr(not(test), forbid(unsafe_code))]
45
46pub use self::actions::S3Action;
47pub use self::bucket::{Bucket, BucketError, UrlStyle};
48pub use self::credentials::Credentials;
49pub use self::map::Map;
50pub use self::method::Method;
51
52pub mod actions;
53#[cfg(feature = "full")]
54pub(crate) mod base64;
55mod bucket;
56pub mod credentials;
57pub(crate) mod hex;
58mod map;
59mod method;
60pub mod signing;
61pub(crate) mod sorting_iter;
62mod time;