Struct AWSCredentials

Source
pub struct AWSCredentials { /* private fields */ }
Expand description

Contains a mapping of profiles to AWS credentials. Provides methods to load from, and save to, the default AWS credentials file.

Implementations§

Source§

impl AWSCredentials

Source

pub fn new<P: AsRef<Path>>(path: P) -> AWSCredentials

Creates a new AWSCredentials instance.

Source

pub fn get_profile(&self, profile: &str) -> Option<Credentials>

Gets the credentials for the specified profile.

Source

pub fn get_profile_mut(&mut self, profile: &str) -> Option<&mut Credentials>

Gets a mutable reference to the credentials for the specified profile.

Source

pub fn set_profile(&mut self, profile: &str, credentials: &Credentials)

Sets the credentials for the specified profile.

Source

pub fn with_profile(&mut self, profile: &str) -> CredentialsSetter<'_>

Returns a profiles credentials setter, if the profile does not exist, it will be created.

Source

pub fn exists(&self, profile: &str) -> bool

Checks if the specified profile exists.

Source

pub fn remove_profile(&mut self, profile: &str) -> Option<Credentials>

Removes the specified profile.

Source

pub fn load() -> Result<AWSCredentials, Error>

Load credentials from the default AWS credentials file location (~/.aws/credentials).

Source

pub fn load_from(file_path: &str) -> Result<AWSCredentials, Error>

Load credentials from the specified file path.

Source

pub fn write(&self) -> Result<(), Error>

Write credentials to the default AWS credentials file location (~/.aws/credentials).

Source

pub fn write_to<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>

Write credentials to the specified file path.

Trait Implementations§

Source§

impl Debug for AWSCredentials

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.