Documentation ¶
Index ¶
Constants ¶
View Source
const ProviderName = "EC2RoleProvider"
ProviderName provides a name of EC2Role provider
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct { aws.SafeCredentialsProvider // contains filtered or unexported fields }
A Provider retrieves credentials from the EC2 service, and keeps track if those credentials are expired.
The New function must be used to create the Provider.
p := &ec2rolecreds.New(ec2metadata.New(options)) // Expire the credentials 10 minutes before IAM states they should. Proactivily // refreshing the credentials. p.ExpiryWindow = 10 * time.Minute
func New ¶ added in v0.23.2
func New(client *ec2metadata.Client, options ...func(*ProviderOptions)) *Provider
New returns an initialized Provider value configured to retrieve credentials from EC2 Instance Metadata service.
type ProviderOptions ¶ added in v0.23.2
type ProviderOptions struct { // ExpiryWindow will allow the credentials to trigger refreshing prior to // the credentials actually expiring. This is beneficial so race conditions // with expiring credentials do not cause request to fail unexpectedly // due to ExpiredTokenException exceptions. // // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true // 10 seconds before the credentials are actually expired. // // If ExpiryWindow is 0 or less it will be ignored. ExpiryWindow time.Duration }
ProviderOptions is a list of user settable options for setting the behavior of the Provider.
Click to show internal directories.
Click to hide internal directories.