Struct aws_config::meta::credentials::CredentialsProviderChain
source · [−]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
sourceimpl 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
pub async fn or_default_provider(self) -> Self
Add a fallback to the default provider chain
sourcepub async fn default_provider() -> Self
pub async fn default_provider() -> Self
Creates a credential provider chain that starts with the default provider
Trait Implementations
sourceimpl Debug for CredentialsProviderChain
impl Debug for CredentialsProviderChain
sourceimpl ProvideCredentials for CredentialsProviderChain
impl ProvideCredentials for CredentialsProviderChain
sourcefn 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.
Auto Trait Implementations
impl !RefUnwindSafe for CredentialsProviderChain
impl Send for CredentialsProviderChain
impl Sync for CredentialsProviderChain
impl Unpin for CredentialsProviderChain
impl !UnwindSafe for CredentialsProviderChain
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more