Skip to main content

remotefs_aws_s3/
lib.rs

1#![crate_name = "remotefs_aws_s3"]
2#![crate_type = "lib"]
3
4//! # remotefs-aws-s3
5//!
6//! remotefs-aws-s3 is a client implementation for [remotefs](https://github.com/remotefs-rs/remotefs-rs), providing support for the Aws S3 protocol.
7//!
8//! ## Get started
9//!
10//! First of all you need to add **remotefs** and the client to your project dependencies:
11//!
12//! ```toml
13//! remotefs = "^0.3"
14//! remotefs-aws-s3 = "^0.4"
15//! ```
16//!
17//! these features are supported:
18//!
19//! - `find`: enable `find()` method for RemoteFs. (*enabled by default*)
20//! - `no-log`: disable logging. By default, this library will log via the `log` crate.
21//!
22//!
23//! ### Aws s3 client
24//!
25//! ```rust,ignore
26//! use remotefs::RemoteFs;
27//! use remotefs_aws_s3::AwsS3Fs;
28//! use std::path::Path;
29//!
30//! let mut client = AwsS3Fs::new("test-bucket", &Arc::new(tokio::runtime::Runtime::new().unwrap()))
31//!     .region("eu-west-1")
32//!     .profile("default")
33//!     .access_key("AKIAxxxxxxxxxxxx")
34//!     .secret_access_key("****************");
35//! // connect
36//! assert!(client.connect().is_ok());
37//! // get working directory
38//! println!("Wrkdir: {}", client.pwd().ok().unwrap().display());
39//! // change working directory
40//! assert!(client.change_dir(Path::new("/tmp")).is_ok());
41//! // disconnect
42//! assert!(client.disconnect().is_ok());
43//! ```
44//!
45//! ### MinIO client
46//!
47//! ```rust,ignore
48//! use remotefs::RemoteFs;
49//! use remotefs_aws_s3::AwsS3Fs;
50//! use std::path::Path;
51//!
52//! let mut client = AwsS3Fs::new("test-bucket", &Arc::new(tokio::runtime::Runtime::new().unwrap()))
53//!     .endpoint("http://localhost:9000")
54//!     .new_path_style(true) // required for MinIO
55//!     .access_key("minioadmin")
56//!     .secret_access_key("minioadmin");
57//! // connect
58//! assert!(client.connect().is_ok());
59//! // get working directory
60//! println!("Wrkdir: {}", client.pwd().ok().unwrap().display());
61//! // change working directory
62//! assert!(client.change_dir(Path::new("/tmp")).is_ok());
63//! // disconnect
64//! assert!(client.disconnect().is_ok());
65//! ```
66//!
67
68#![doc(html_playground_url = "https://play.rust-lang.org")]
69#![doc(
70    html_favicon_url = "https://raw.githubusercontent.com/remotefs-rs/remotefs-rs/main/assets/logo-128.png"
71)]
72#![doc(
73    html_logo_url = "https://raw.githubusercontent.com/remotefs-rs/remotefs-rs/main/assets/logo.png"
74)]
75
76// -- crates
77#[macro_use]
78extern crate log;
79
80pub mod client;
81pub use client::AwsS3Fs;
82
83// -- object
84pub(crate) mod object;
85// -- utils
86pub(crate) mod utils;
87// -- mock
88#[cfg(test)]
89pub(crate) mod mock;