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§
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>
Creates a shared type from an unshared type.