pub struct DefaultCredentialsChain { /* private fields */ }
Expand description
Default AWS Credential Provider Chain
Resolution order:
- Environment variables:
EnvironmentVariableCredentialsProvider
- Shared config (
~/.aws/config
,~/.aws/credentials
):SharedConfigCredentialsProvider
- Web Identity Tokens
- ECS (IAM Roles for Tasks) & General HTTP credentials:
ecs
- EC2 IMDSv2
The outer provider is wrapped in a refreshing cache.
More providers are a work in progress.
§Examples
Create a default chain with a custom region:
use aws_types::region::Region;
use aws_config::default_provider::credentials::DefaultCredentialsChain;
let credentials_provider = DefaultCredentialsChain::builder()
.region(Region::new("us-west-1"))
.build();
Create a default chain with no overrides:
use aws_config::default_provider::credentials::DefaultCredentialsChain;
let credentials_provider = DefaultCredentialsChain::builder().build();
Create a default chain that uses a different profile:
use aws_config::default_provider::credentials::DefaultCredentialsChain;
let credentials_provider = DefaultCredentialsChain::builder()
.profile_name("otherprofile")
.build();
Implementations§
Trait Implementations§
Source§impl Debug for DefaultCredentialsChain
impl Debug for DefaultCredentialsChain
Source§impl ProvideCredentials for DefaultCredentialsChain
impl ProvideCredentials for DefaultCredentialsChain
Source§fn provide_credentials<'a>(&'a self) -> ProvideCredentials<'a>where
Self: 'a,
fn provide_credentials<'a>(&'a self) -> ProvideCredentials<'a>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 DefaultCredentialsChain
impl !RefUnwindSafe for DefaultCredentialsChain
impl Send for DefaultCredentialsChain
impl Sync for DefaultCredentialsChain
impl Unpin for DefaultCredentialsChain
impl !UnwindSafe for DefaultCredentialsChain
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.