API for cognitect.aws.credentials
-
Full namespace name:
cognitect.aws.credentials
Overview
Contains credentials providers and helpers for discovering credentials.
Alpha. Subject to change.
Public Variables and Functions
auto-refreshing-credentials
function
Usage: (auto-refreshing-credentials provider)
(auto-refreshing-credentials provider scheduler)
Deprecated. Use cached-credentials-with-auto-refresh
Deprecated since aws-api version true
basic-credentials-provider
function
Usage: (basic-credentials-provider {:keys [access-key-id secret-access-key]})
Given a map with :access-key-id and :secret-access-key,
returns an implementation of CredentialsProvider which returns
those credentials on fetch.
Alpha. Subject to change.
cached-credentials-with-auto-refresh
function
Usage: (cached-credentials-with-auto-refresh provider)
(cached-credentials-with-auto-refresh provider scheduler)
Returns a CredentialsProvider which wraps `provider`, caching
credentials returned by `fetch`, and auto-refreshing the cached
credentials in a background thread when the credentials include a
::ttl.
Call `stop` to cancel future auto-refreshes.
The default ScheduledExecutorService uses a ThreadFactory that
spawns daemon threads. You can override this by providing your own
ScheduledExecutorService.
Alpha. Subject to change.
calculate-ttl
function
Usage: (calculate-ttl {:keys [Expiration]})
Primarily for internal use, returns time to live (ttl, in seconds),
based on `:Expiration` in credentials. If `credentials` contains no
`:Expiration`, defaults to 3600.
`:Expiration` can be a string parsable by java.time.Instant/parse
(returned by ec2/ecs instance credentials), a java.util.Date
(returned from :AssumeRole on aws sts client), a numeric value
representing milliseconds since the epoch of 1970-01-01T00:00:00Z,
or an Instant object.
chain-credentials-provider
function
Usage: (chain-credentials-provider providers)
Returns a credentials-provider which chains together multiple
credentials providers.
`fetch` calls each provider in order until one returns a non-nil
result. This provider is then cached for future calls to `fetch`.
`fetch` returns nil if none of the providers return credentials.
Alpha. Subject to change.
container-credentials-provider
function
Usage: (container-credentials-provider http-client)
For internal use. Do not call directly.
Return credentials from ECS iff one of
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI or
AWS_CONTAINER_CREDENTIALS_FULL_URI is set.
Alpha. Subject to change.
default-credentials-provider
function
Usage: (default-credentials-provider http-client)
Returns a chain-credentials-provider with (in order):
environment-credentials-provider
system-property-credentials-provider
profile-credentials-provider
container-credentials-provider
instance-profile-IMDSv2-credentials-provider
instance-profile-credentials-provider
Alpha. Subject to change.
environment-credentials-provider
function
Usage: (environment-credentials-provider)
Return the credentials from the environment variables.
Look at the following variables:
* AWS_ACCESS_KEY_ID required
* AWS_SECRET_ACCESS_KEY required
* AWS_SESSION_TOKEN optional
Returns nil if any of the required variables is blank.
Logs error if one required variable is blank but the other
is not.
Alpha. Subject to change.
fetch
function
Usage: (fetch provider)
Return the credentials found by this provider, or nil.
Credentials should be a map with the following keys:
:aws/access-key-id string required
:aws/secret-access-key string required
:aws/session-token string optional
:cognitect.aws.credentials/ttl number optional Time-to-live in seconds
fetch-async
function
Usage: (fetch-async provider)
Returns a channel that will produce the result of calling fetch on
the provider.
Alpha. Subject to change.
instance-profile-IMDSv2-credentials-provider
function
Usage: (instance-profile-IMDSv2-credentials-provider http-client)
For internal use. Do not call directly.
Return credentials from IMDS v2 enabled EC2 metadata service iff neither of
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI or
AWS_CONTAINER_CREDENTIALS_FULL_URI
is set.
Alpha. Subject to change.
instance-profile-credentials-provider
function
Usage: (instance-profile-credentials-provider http-client)
For internal use. Do not call directly.
Return credentials from EC2 metadata service iff neither of
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI or
AWS_CONTAINER_CREDENTIALS_FULL_URI
is set.
DEPRECATED use `instance-profile-IMDSv2-credentials-provider`
Alpha. Subject to change.
Deprecated since aws-api version true
profile-credentials-provider
function
Usage: (profile-credentials-provider)
(profile-credentials-provider profile-name)
(profile-credentials-provider profile-name f)
Return credentials in an AWS configuration profile.
Arguments:
profile-name string The name of the profile in the file. (default: default)
f File The profile configuration file. (default: ~/.aws/credentials)
https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html
Parsed properties:
aws_access_key required
aws_secret_access_key required
aws_session_token optional
Alpha. Subject to change.
stop
function
Usage: (stop credentials)
Stop auto-refreshing the credentials.
Alpha. Subject to change.
system-property-credentials-provider
function
Usage: (system-property-credentials-provider)
Return the credentials from the system properties.
Look at the following properties:
* aws.accessKeyId required
* aws.secretKey required
Returns nil if any of the required properties is blank.
Logs error if one of the required properties is blank but
the other is not.
Alpha. Subject to change.