pub struct CredentialsProviderChain { /* private fields */ }
Expand description
Credentials provider that checks a series of inner providers
Each provider will be evaluated in order:
- If a provider returns valid
Credentials
they will be returned immediately. No other credential providers will be used. - Otherwise, if a provider returns
CredentialsError::CredentialsNotLoaded
, the next provider will be checked. - Finally, if a provider returns any other error condition, an error will be returned immediately.
§Examples
use aws_config::meta::credentials::CredentialsProviderChain;
use aws_config::environment::credentials::EnvironmentVariableCredentialsProvider;
use aws_config::profile::ProfileFileCredentialsProvider;
let provider = CredentialsProviderChain::first_try("Environment", EnvironmentVariableCredentialsProvider::new())
.or_else("Profile", ProfileFileCredentialsProvider::builder().build());
Implementations§
Source§impl CredentialsProviderChain
impl CredentialsProviderChain
Sourcepub fn first_try(
name: impl Into<Cow<'static, str>>,
provider: impl ProvideCredentials + 'static,
) -> Self
pub fn first_try( name: impl Into<Cow<'static, str>>, provider: impl ProvideCredentials + 'static, ) -> Self
Create a CredentialsProviderChain
that begins by evaluating this provider
Sourcepub fn or_else(
self,
name: impl Into<Cow<'static, str>>,
provider: impl ProvideCredentials + 'static,
) -> Self
pub fn or_else( self, name: impl Into<Cow<'static, str>>, provider: impl ProvideCredentials + 'static, ) -> Self
Add a fallback provider to the credentials provider chain
Sourcepub async fn or_default_provider(self) -> Self
Available on crate feature rustls
only.
pub async fn or_default_provider(self) -> Self
rustls
only.Add a fallback to the default provider chain
Sourcepub async fn default_provider() -> Self
Available on crate feature rustls
only.
pub async fn default_provider() -> Self
rustls
only.Creates a credential provider chain that starts with the default provider
Trait Implementations§
Source§impl Debug for CredentialsProviderChain
impl Debug for CredentialsProviderChain
Source§impl ProvideCredentials for CredentialsProviderChain
impl ProvideCredentials for CredentialsProviderChain
Source§fn provide_credentials<'a>(&'a self) -> ProvideCredentials<'_>where
Self: 'a,
fn provide_credentials<'a>(&'a self) -> ProvideCredentials<'_>where
Self: 'a,
Returns a future that provides credentials.
Source§fn fallback_on_interrupt(&self) -> Option<Credentials>
fn fallback_on_interrupt(&self) -> Option<Credentials>
Returns fallback credentials. Read more
Auto Trait Implementations§
impl Freeze for CredentialsProviderChain
impl !RefUnwindSafe for CredentialsProviderChain
impl Send for CredentialsProviderChain
impl Sync for CredentialsProviderChain
impl Unpin for CredentialsProviderChain
impl !UnwindSafe for CredentialsProviderChain
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.