Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrMissingIncomplete = errors.New("missing or incomplete API credentials")
)
var (
ErrNoValidCredentialProviders = errors.New("no valid credential providers")
)
Functions ¶
This section is empty.
Types ¶
type ChainProvider ¶
type ChainProvider struct { Providers []Provider // contains filtered or unexported fields }
A ChainProvider will search for a provider which returns credentials and cache that provider until Retrieve is called again.
func (*ChainProvider) IsExpired ¶
func (c *ChainProvider) IsExpired() bool
IsExpired will returned the expired state of the currently cached provider if there is one. If there is no current provider, true will be returned.
func (*ChainProvider) Retrieve ¶
func (c *ChainProvider) Retrieve() (Value, error)
Retrieve returns the first provider in the chain that succeeds, or error if no provider returned.
If a provider is found it will be cached and any calls to IsExpired() will return the expired state of the cached provider.
type Credentials ¶
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
func NewEnvCredentials ¶
func NewEnvCredentials() *Credentials
func NewFileCredentials ¶
func NewFileCredentials(opts ...FileOpt) *Credentials
func NewStaticCredentials ¶
func NewStaticCredentials(apiKey, apiSecret string) *Credentials
func (*Credentials) Expire ¶
func (c *Credentials) Expire()
func (*Credentials) Get ¶
func (c *Credentials) Get() (Value, error)
func (*Credentials) IsExpired ¶
func (c *Credentials) IsExpired() bool
type EnvProvider ¶
type EnvProvider struct {
// contains filtered or unexported fields
}
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 FileOpt ¶
type FileOpt func(*FileProvider)
func FileOptWithAccount ¶
FileOptWithAccount returns a FileOpt overriding the default account.
func FileOptWithFilename ¶
FileOptWithFilename returns a FileOpt overriding the default filename.
type FileProvider ¶
type FileProvider struct {
// contains filtered or unexported fields
}
func (*FileProvider) IsExpired ¶
func (f *FileProvider) IsExpired() bool
IsExpired returns if the shared credentials have expired.
func (*FileProvider) Retrieve ¶
func (f *FileProvider) Retrieve() (Value, error)
type StaticProvider ¶
type StaticProvider struct {
// contains filtered or unexported fields
}
A StaticProvider is a set of credentials which are set programmatically, and will never expire.
func (*StaticProvider) IsExpired ¶
func (s *StaticProvider) IsExpired() bool
IsExpired returns if the credentials are expired.
For StaticProvider, the credentials never expired.
func (*StaticProvider) Retrieve ¶
func (s *StaticProvider) Retrieve() (Value, error)
Retrieve returns the credentials or error if the credentials are invalid.