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//! # env::set_var("AWS_ACCESS_KEY_ID", "key");
16//! # env::set_var("AWS_SECRET_ACCESS_KEY", "secret");
17//!
18//! // setting up a bucket
19//! let endpoint = "https://s3.dualstack.eu-west-1.amazonaws.com".parse().expect("endpoint is a valid Url");
20//! let path_style = UrlStyle::VirtualHost;
21//! let name = "rusty-s3";
22//! let region = "eu-west-1";
23//! let bucket = Bucket::new(endpoint, path_style, name, region).expect("Url has a valid scheme and host");
24//!
25//! // setting up the credentials
26//! let key = env::var("AWS_ACCESS_KEY_ID").expect("AWS_ACCESS_KEY_ID is set and a valid String");
27//! let secret = env::var("AWS_SECRET_ACCESS_KEY").expect("AWS_SECRET_ACCESS_KEY is set and a valid String");
28//! let credentials = Credentials::new(key, secret);
29//!
30//! // signing a request
31//! let presigned_url_duration = Duration::from_secs(60 * 60);
32//! let action = bucket.get_object(Some(&credentials), "duck.jpg");
33//! println!("GET {}", action.sign(presigned_url_duration));
34//! ```
35
36#![warn(
37    clippy::all,
38    clippy::correctness,
39    clippy::style,
40    clippy::pedantic,
41    clippy::perf,
42    clippy::complexity,
43    clippy::nursery,
44    clippy::cargo
45)]
46#![deny(
47    missing_debug_implementations,
48    missing_copy_implementations,
49    rust_2018_idioms,
50    rustdoc::broken_intra_doc_links
51)]
52#![forbid(unsafe_code)]
53
54pub use self::actions::S3Action;
55pub use self::bucket::{Bucket, BucketError, UrlStyle};
56pub use self::credentials::Credentials;
57pub use self::map::Map;
58pub use self::method::Method;
59
60pub mod actions;
61#[cfg(feature = "full")]
62pub(crate) mod base64;
63mod bucket;
64pub mod credentials;
65mod map;
66mod method;
67pub mod signing;
68pub(crate) mod sorting_iter;
69mod time;