pub struct ProfileProvider { /* private fields */ }
Expand description
Provides AWS credentials from a profile in a credentials file, or from a credential process.
§Warning
This provider allows the credential_process
option, a method of
sourcing credentials from an external process. This can potentially be dangerous, so proceed
with caution. Other credential providers should be preferred if at all possible. If using this
option, you should make sure that the config file is as locked down as possible using security
best practices for your operating system.
Implementations§
Source§impl ProfileProvider
impl ProfileProvider
Sourcepub fn new() -> Result<ProfileProvider, CredentialsError>
pub fn new() -> Result<ProfileProvider, CredentialsError>
Create a new ProfileProvider
for the default credentials file path and profile name.
Sourcepub fn with_configuration<F, P>(file_path: F, profile: P) -> ProfileProvider
pub fn with_configuration<F, P>(file_path: F, profile: P) -> ProfileProvider
Create a new ProfileProvider
for the credentials file at the given path, using
the given profile.
Sourcepub fn with_default_configuration<F>(file_path: F) -> ProfileProvider
pub fn with_default_configuration<F>(file_path: F) -> ProfileProvider
Create a new ProfileProvider
for the credentials file at the given path, using
the profile name from environment variable AWS_PROFILE
or fall-back to "default"
if AWS_PROFILE
is not set.
Sourcepub fn with_default_credentials<P>(
profile: P,
) -> Result<ProfileProvider, CredentialsError>
pub fn with_default_credentials<P>( profile: P, ) -> Result<ProfileProvider, CredentialsError>
Create a new ProfileProvider
for the default credentials file path using
the given profile.
Sourcepub fn region() -> Result<Option<String>, CredentialsError>
pub fn region() -> Result<Option<String>, CredentialsError>
Attempts to resolve a region value associated with the current default profile from
~/.aws/config
or the file associated with the AWS_CONFIG_FILE
environment variable.
As these fields do not require a region field to be defined, an Option
type is returned
For a the ful region resolution chain, use the Default
impl for rusoto_core::Region
Sourcepub fn region_from_profile(&self) -> Result<Option<String>, CredentialsError>
pub fn region_from_profile(&self) -> Result<Option<String>, CredentialsError>
Attempts to resolve the region value associated with the current ProfileProvider
s
config file path (ProfileProvider.file_path
) and profile (ProfileProvider.profile
).
As these fields do not require a region field to be defined, an Option
type is returned
Sourcepub fn set_file_path<F>(&mut self, file_path: F)
pub fn set_file_path<F>(&mut self, file_path: F)
Set the credentials file path.
Sourcepub fn set_profile<P>(&mut self, profile: P)
pub fn set_profile<P>(&mut self, profile: P)
Set the profile name.
Trait Implementations§
Source§impl Clone for ProfileProvider
impl Clone for ProfileProvider
Source§fn clone(&self) -> ProfileProvider
fn clone(&self) -> ProfileProvider
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ProfileProvider
impl Debug for ProfileProvider
Source§impl ProvideAwsCredentials for ProfileProvider
impl ProvideAwsCredentials for ProfileProvider
Source§fn credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AwsCredentials, CredentialsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AwsCredentials, CredentialsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
AwsCredentials
future.