[−][src]Struct awscreds::Credentials
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, None); // Load credentials from `[my-profile]` profile let credentials = Credentials::new(None, None, None, None, Some("my-profile".into()));
// Use anonymous credentials for public objects let credentials = Credentials::anonymous();
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 awscreds::Credentials; // Load credentials directly let access_key = "AKIAIOSFODNN7EXAMPLE"; let secret_key = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"; let credentials = Credentials::new(Some(access_key), Some(secret_key), None, 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, None);
Fields
access_key: Option<String>
AWS public access key.
secret_key: Option<String>
AWS secret key.
security_token: Option<String>
Temporary token issued by AWS service.
session_token: Option<String>
Implementations
impl Credentials
[src]
pub fn new_blocking(
access_key: Option<&str>,
secret_key: Option<&str>,
security_token: Option<&str>,
session_token: Option<&str>,
profile: Option<&str>
) -> Result<Credentials>
[src]
access_key: Option<&str>,
secret_key: Option<&str>,
security_token: Option<&str>,
session_token: Option<&str>,
profile: Option<&str>
) -> Result<Credentials>
pub async fn default() -> Result<Credentials>
[src]
pub fn default_blocking() -> Result<Credentials>
[src]
pub fn anonymous() -> Result<Credentials>
[src]
pub async fn new<'_, '_, '_, '_, '_>(
access_key: Option<&'_ str>,
secret_key: Option<&'_ str>,
security_token: Option<&'_ str>,
session_token: Option<&'_ str>,
profile: Option<&'_ str>
) -> Result<Credentials>
[src]
access_key: Option<&'_ str>,
secret_key: Option<&'_ str>,
security_token: Option<&'_ str>,
session_token: Option<&'_ str>,
profile: Option<&'_ str>
) -> Result<Credentials>
Initialize Credentials directly with key ID, secret key, and optional token.
pub fn from_env_specific(
access_key_var: Option<&str>,
secret_key_var: Option<&str>,
security_token_var: Option<&str>,
session_token_var: Option<&str>
) -> Result<Credentials>
[src]
access_key_var: Option<&str>,
secret_key_var: Option<&str>,
security_token_var: Option<&str>,
session_token_var: Option<&str>
) -> Result<Credentials>
pub fn from_env() -> Result<Credentials>
[src]
pub fn from_profile(section: Option<&str>) -> Result<Credentials>
[src]
Trait Implementations
impl Clone for Credentials
[src]
fn clone(&self) -> Credentials
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Credentials
[src]
impl Eq for Credentials
[src]
impl PartialEq<Credentials> for Credentials
[src]
fn eq(&self, other: &Credentials) -> bool
[src]
fn ne(&self, other: &Credentials) -> bool
[src]
impl StructuralEq for Credentials
[src]
impl StructuralPartialEq for Credentials
[src]
Auto Trait Implementations
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnwindSafe for Credentials
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,