rusty_oss/lib.rs
1//! A simple, pure Rust Aliyun OSS client following a Sans-IO approach
2//!
3//! The rusty-oss crate provides a convenient API for signing, building
4//! and parsing Aliyun OSS 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_oss::{Bucket, Credentials, OSSAction, UrlStyle};
15//! # env::set_var("ALIYUN_OSS_ACCESS_KEY", "key");
16//! # env::set_var("ALIYUN_OSS_ACCESS_SECRET", "secret");
17//!
18//! // setting up a bucket
19//! let endpoint = "https://oss-cn-hangzhou.aliyuncs.com".parse().expect("endpoint is a valid Url");
20//! let path_style = UrlStyle::VirtualHost;
21//! let name = "examplebucket";
22//! let region = "cn-hangzhou";
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("ALIYUN_OSS_ACCESS_KEY").expect("ALIYUN_OSS_ACCESS_KEY is set and a valid String");
27//! let secret = env::var("ALIYUN_OSS_ACCESS_SECRET").expect("ALIYUN_OSS_ACCESS_SECRET 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::OSSAction;
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;
69pub(crate) mod time_;