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
impl AWSCredentials
Sourcepub fn new<P: AsRef<Path>>(path: P) -> AWSCredentials
pub fn new<P: AsRef<Path>>(path: P) -> AWSCredentials
Creates a new AWSCredentials instance.
Sourcepub fn get_profile(&self, profile: &str) -> Option<Credentials>
pub fn get_profile(&self, profile: &str) -> Option<Credentials>
Gets the credentials for the specified profile.
Sourcepub fn get_profile_mut(&mut self, profile: &str) -> Option<&mut Credentials>
pub fn get_profile_mut(&mut self, profile: &str) -> Option<&mut Credentials>
Gets a mutable reference to the credentials for the specified profile.
Sourcepub fn set_profile(&mut self, profile: &str, credentials: &Credentials)
pub fn set_profile(&mut self, profile: &str, credentials: &Credentials)
Sets the credentials for the specified profile.
Sourcepub fn with_profile(&mut self, profile: &str) -> CredentialsSetter<'_>
pub fn with_profile(&mut self, profile: &str) -> CredentialsSetter<'_>
Returns a profiles credentials setter, if the profile does not exist, it will be created.
Sourcepub fn remove_profile(&mut self, profile: &str) -> Option<Credentials>
pub fn remove_profile(&mut self, profile: &str) -> Option<Credentials>
Removes the specified profile.
Sourcepub fn load() -> Result<AWSCredentials, Error>
pub fn load() -> Result<AWSCredentials, Error>
Load credentials from the default AWS credentials file location (~/.aws/credentials
).
Sourcepub fn load_from(file_path: &str) -> Result<AWSCredentials, Error>
pub fn load_from(file_path: &str) -> Result<AWSCredentials, Error>
Load credentials from the specified file path.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AWSCredentials
impl RefUnwindSafe for AWSCredentials
impl Send for AWSCredentials
impl Sync for AWSCredentials
impl Unpin for AWSCredentials
impl UnwindSafe for AWSCredentials
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more