Struct: aws.CredentialsCache
Overview
CredentialsCache provides caching and concurrency safe credentials retrieval via the provider’s retrieve method.
CredentialsCache will look for optional interfaces on the Provider to adjust how the credential cache handles credentials caching.
-
HandleFailRefreshCredentialsCacheStrategy - Allows provider to handle credential refresh failures. This could return an updated Credentials value, or attempt another means of retrieving credentials.
-
AdjustExpiresByCredentialsCacheStrategy - Allows provider to adjust how credentials Expires is modified. This could modify how the Credentials Expires is adjusted based on the CredentialsCache ExpiryWindow option. Such as providing a floor not to reduce the Expires below.
Implemented Interfaces
types.AnalyticsFilter, CredentialProviderSource, CredentialsProvider, v4.HTTPPresigner, s3.HTTPPresignerV4, types.MetricsFilter, s3.PresignPost, customizations.S3ExpressCredentialsProvider, arn.S3ObjectLambdaARN, types.SelectObjectContentEventStream
Method Summary collapse
-
func (p *CredentialsCache) Invalidate()
Invalidate will invalidate the cached credentials.
-
func (p *CredentialsCache) IsCredentialsProvider(target CredentialsProvider) bool
IsCredentialsProvider returns whether credential provider wrapped by CredentialsCache matches the target provider type.
-
func (p *CredentialsCache) ProviderSources() []CredentialSource
ProviderSources returns a list of where the underlying credential provider has been sourced, if available.
-
func (p *CredentialsCache) Retrieve(ctx context.Context) (Credentials, error)
Retrieve returns the credentials.
Method Details
func (p *CredentialsCache) Invalidate()
Invalidate will invalidate the cached credentials. The next call to Retrieve will cause the provider’s Retrieve method to be called.
187 188 189 |
// File 'aws/credential_cache.go', line 187
|
func (p *CredentialsCache) IsCredentialsProvider(target CredentialsProvider) bool
IsCredentialsProvider returns whether credential provider wrapped by CredentialsCache matches the target provider type.
193 194 195 |
// File 'aws/credential_cache.go', line 193
|
func (p *CredentialsCache) ProviderSources() []CredentialSource
ProviderSources returns a list of where the underlying credential provider has been sourced, if available. Returns empty if the provider doesn’t implement the interface
177 178 179 180 181 182 183 |
// File 'aws/credential_cache.go', line 177
|
func (p *CredentialsCache) Retrieve(ctx context.Context) (Credentials, error)
Retrieve returns the credentials. If the credentials have already been retrieved, and not expired the cached credentials will be returned. If the credentials have not been retrieved yet, or expired the provider’s Retrieve method will be called.
Returns and error if the provider’s retrieve method returns an error.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
// File 'aws/credential_cache.go', line 97
|