forked from durch/rust-s3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[workspace] | ||
members = [ | ||
"s3", | ||
"aws-region" | ||
"aws-region", | ||
"aws-creds" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
name = "aws-creds" | ||
version = "0.20.0" | ||
authors = ["Drazen Urch"] | ||
description = "Tiny Rust library for working with Amazon IAM credentials, supports `s3` crate" | ||
repository = "https://github.com/durch/rust-s3" | ||
readme = "README.md" | ||
keywords = ["Amazon", "AWS", "S3", "Wasabi", "Minio"] | ||
license = "MIT" | ||
documentation = "https://durch.github.io/rust-s3/" | ||
edition = "2018" | ||
|
||
[lib] | ||
name = "awscreds" | ||
path = "src/lib.rs" | ||
|
||
[dependencies] | ||
simpl = "0.1.0-alpha" | ||
dirs = "2.0.2" | ||
rust-ini = "0.15.2" | ||
tokio = "0.2.13" | ||
reqwest = {version = "0.10.4", features = ["json"]} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
|
||
# Example | ||
|
||
```rust | ||
// AWS access credentials: access key, secret key, and optional token. | ||
# Example | ||
// Loads from the standard AWS credentials file with the given profile name, | ||
// defaults to "default". | ||
use awscreds::Credentials; | ||
|
||
// Load credentials from `[default]` profile | ||
let credentials = Credentials::default(); | ||
// Also loads credentials from `[default]` profile | ||
let credentials = Credentials::new(None, None, None, None); | ||
// Load credentials from `[my-profile]` profile | ||
let credentials = Credentials::new(None, None, None, Some("my-profile".into())); | ||
// Credentials may also be initialized directly or by the following environment variables: | ||
// - `AWS_ACCESS_KEY_ID`, | ||
// - `AWS_SECRET_ACCESS_KEY` | ||
// - `AWS_SESSION_TOKEN` | ||
// The order of preference is arguments, then environment, and finally AWS | ||
// credentials file. | ||
|
||
use s3::credentials::Credentials; | ||
// Load credentials directly | ||
let access_key = String::from("AKIAIOSFODNN7EXAMPLE"); | ||
let secret_key = String::from("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"); | ||
let credentials = Credentials::new(Some(access_key), Some(secret_key), None, None); | ||
// Load credentials from the environment | ||
use std::env; | ||
env::set_var("AWS_ACCESS_KEY_ID", "AKIAIOSFODNN7EXAMPLE"); | ||
env::set_var("AWS_SECRET_ACCESS_KEY", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"); | ||
let credentials = Credentials::new(None, None, None, None); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![allow(unused_imports)] | ||
|
||
simpl::err!(AwsCredsError, { | ||
Utf8@std::str::Utf8Error; | ||
Reqwest@reqwest::Error; | ||
Env@std::env::VarError; | ||
Ini@ini::ini::Error; | ||
}); | ||
|
||
mod credentials; | ||
|
||
pub use credentials::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,3 @@ path = "src/lib.rs" | |
[dependencies] | ||
simpl = "0.1.0-alpha" | ||
|
||
[features] | ||
no-verify-ssl = [] | ||
|