aws_credentials

Values

pub fn force_refresh(
  ,
) -> Result(
  option.Option(types.Credentials),
  types.CredentialError,
)

Force a refresh of the credentials

This triggers an immediate fetch of new credentials from the configured providers, bypassing any cached values.

Returns:

  • Ok(Some(credentials)) if new credentials were fetched
  • Ok(None) if no credentials could be found
  • Error(reason) if an error occurred during fetch
pub fn force_refresh_with_options(
  options: types.RefreshOptions,
) -> Result(
  option.Option(types.Credentials),
  types.CredentialError,
)

Force a refresh of the credentials with custom options

This allows passing provider-specific options to customize the credential fetching behavior.

pub fn get_credentials(
  ,
) -> Result(
  option.Option(types.Credentials),
  types.CredentialError,
)

Get the current AWS credentials

Returns the cached credentials if available. The credentials are automatically refreshed in the background when they expire.

Returns:

  • Ok(Some(credentials)) if credentials are available
  • Ok(None) if no credentials could be found
  • Error(ServiceNotStarted) if the service is not running
pub fn has_credentials() -> Bool

Check if credentials are available

This is a convenience function that returns True if valid credentials can be fetched, False otherwise.

pub fn require_credentials(
  ,
) -> Result(types.Credentials, types.CredentialError)

Get credentials or fail with an error

This is a convenience function for cases where you want to fail fast if credentials are not available.

pub fn start() -> Result(Nil, types.CredentialError)

Start the AWS credentials service

This starts the underlying gen_server that manages credential fetching and automatic refresh. The service will automatically fetch credentials from the configured providers (environment variables, files, ECS, EC2, etc.)

pub fn stop() -> Nil

Stop the AWS credentials service

This cleanly shuts down the credentials service.

Search Document