Documentation ¶
Index ¶
Constants ¶
const EnvProviderName = "EnvProvider"
Variables ¶
var ( ErrUsernameNotFound = errors.New("ATLAS_USERNAME not found in environment") ErrAccessKeyNotFound = errors.New("ATLAS_ACCESS_KEY not found in environment") )
var (
ErrNoValidProvidersFoundInChain = errors.New(`no valid providers in chain`)
)
var (
)Functions ¶
func SharedCredentialsFilename ¶
func SharedCredentialsFilename() string
SharedCredentialsFilename returns the SDK's default file path for the shared credentials file.
func UserHomeDir ¶
func UserHomeDir() string
UserHomeDir returns the home directory for the user the process is running under.
Types ¶
type ChainProvider ¶
type ChainProvider struct { Providers []Provider VerboseErrors bool // contains filtered or unexported fields }
A ChainProvider will search for a provider which returns credentials.
func (*ChainProvider) IsExpired ¶
func (c *ChainProvider) IsExpired() bool
IsExpired will returned the expired state of the currently cached provider if there is one.
func (*ChainProvider) Retrieve ¶
func (c *ChainProvider) Retrieve() (Value, error)
Retrieve returns the credentials value or error if no provider returned without error.
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
A Credentials provides synchronous safe retrieval of credentials Value.
func NewChainCredentials ¶
func NewChainCredentials(providers []Provider) *Credentials
NewChainCredentials returns a pointer to a new Credentials object wrapping a chain of providers.
func NewCredentials ¶
func NewCredentials(provider Provider) *Credentials
NewCredentials returns a pointer to a new Credentials with the provider set.
func NewEnvCredentials ¶
func NewEnvCredentials() *Credentials
NewEnvCredentials returns a pointer to a new Credentials object wrapping the environment variable provider.
func NewSharedCredentials ¶
func NewSharedCredentials(filename, profile string) *Credentials
NewSharedCredentials returns a pointer to a new Credentials object wrapping the Profile file provider.
func (*Credentials) Expire ¶
func (c *Credentials) Expire()
Expire expires the credentials and forces them to be retrieved on the next call to Get().
func (*Credentials) Get ¶
func (c *Credentials) Get() (Value, error)
Get returns the credentials value, or error if the credentials Value failed to be retrieved.
func (*Credentials) IsExpired ¶
func (c *Credentials) IsExpired() bool
IsExpired returns if the credentials are no longer valid, and need to be retrieved.
type EnvProvider ¶
type EnvProvider struct {
// contains filtered or unexported fields
}
A EnvProvider retrieves credentials from the environment variables of the running process. Environment credentials never expire.
func (*EnvProvider) IsExpired ¶
func (e *EnvProvider) IsExpired() bool
IsExpired returns if the credentials have been retrieved.
func (*EnvProvider) Retrieve ¶
func (e *EnvProvider) Retrieve() (Value, error)
Retrieve retrieves the keys from the environment.
type ErrorProvider ¶
An ErrorProvider is a stub credentials provider that always returns an error.
func (ErrorProvider) IsExpired ¶
func (p ErrorProvider) IsExpired() bool
IsExpired will always return not expired.
func (ErrorProvider) Retrieve ¶
func (p ErrorProvider) Retrieve() (Value, error)
Retrieve will always return the error that the ErrorProvider was created with.
type Expiry ¶
A Expiry provides shared expiration logic to be used by credentials providers to implement expiry functionality.
type SharedCredentialsProvider ¶
type SharedCredentialsProvider struct { // contains filtered or unexported fields }
A SharedCredentialsProvider retrieves credentials from the current user's home directory, and keeps track if those credentials are expired.
Profile ini file example: $HOME/.atlas/credentials
func (*SharedCredentialsProvider) IsExpired ¶
func (p *SharedCredentialsProvider) IsExpired() bool
IsExpired returns if the shared credentials have expired.
func (*SharedCredentialsProvider) Retrieve ¶
func (p *SharedCredentialsProvider) Retrieve() (Value, error)
Retrieve reads and extracts the shared credentials from the current users home directory.