Skip to main content

CredentialsProvider

Trait CredentialsProvider 

Source
pub trait CredentialsProvider:
    Debug
    + Send
    + Sync {
    // Required methods
    fn credentials_async(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<CredentialsSnapshot>> + Send + '_>>;
    fn credentials_blocking(&self) -> Result<CredentialsSnapshot>;
}
Expand description

Source of credential snapshots for request signing.

Implement this trait when credentials may rotate over time. If the underlying provider performs network calls or expensive refreshes, wrap it in crate::CachedProvider so multiple requests can share cached credentials and coalesce refresh work.

Required Methods§

Source

fn credentials_async( &self, ) -> Pin<Box<dyn Future<Output = Result<CredentialsSnapshot>> + Send + '_>>

Available on crate feature async only.

Returns credentials asynchronously.

Source

fn credentials_blocking(&self) -> Result<CredentialsSnapshot>

Available on crate feature blocking only.

Returns credentials in blocking mode.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<P> CredentialsProvider for CachedProvider<P>

Available on crate features async or blocking only.