credentials

package
v0.79.0-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2022 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// EksctlGlobalEnableCachingEnvName defines an environment property to enable the cache globally.
	EksctlGlobalEnableCachingEnvName = "EKSCTL_ENABLE_CREDENTIAL_CACHE"
	// EksctlCacheFilenameEnvName defines an environment property to configure where the cache file should live.
	EksctlCacheFilenameEnvName = "EKSCTL_CREDENTIAL_CACHE_FILENAME"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
}

Clock implements Now to return the current time.

type FileCacheProvider

type FileCacheProvider struct {
	// contains filtered or unexported fields
}

FileCacheProvider is a file based AWS Credentials Provider implementing expiry and retrieve.

func NewFileCacheProvider

func NewFileCacheProvider(profile string, creds *credentials.Credentials, clock Clock) (FileCacheProvider, error)

NewFileCacheProvider creates a new filesystem based AWS credential cache. The cache uses Expiry provided by the AWS Go SDK for providers. It wraps the configured credential provider into a file based cache provider. If the provider does not support caching ( I.e.: it doesn't implement IsExpired ) then this file based caching system is ignored and the default credential provider is used. Caches are per profile.

func (*FileCacheProvider) ExpiresAt

func (f *FileCacheProvider) ExpiresAt() time.Time

ExpiresAt implements the Expirer interface, and gives access to the expiration time of the credential

func (*FileCacheProvider) IsExpired

func (f *FileCacheProvider) IsExpired() bool

IsExpired implements the Provider interface, deferring to the cached credential first, but fall back to the underlying Provider if it is expired.

func (*FileCacheProvider) Retrieve

func (f *FileCacheProvider) Retrieve() (credentials.Value, error)

Retrieve implements the Provider interface, returning the cached credential if is not expired, otherwise fetching the credential from the underlying Provider and caching the results on disk with an expiration time.

type RealClock

type RealClock struct{}

RealClock defines a clock using time.Now()

func (*RealClock) Now

func (r *RealClock) Now() time.Time

Now returns the current time.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL