Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrConfigNotFound = errors.New("config did not exist")
ErrConfigNotFound is returned if there is no Config in a ConfigStore.
var ErrMissingToken = errors.New("could not find token")
var ErrTokenNotFound = errors.New("token does not exist")
ErrTokenNotFound is returned if there is no Token in a ConfigStore.
Functions ¶
func PutToken ¶ added in v0.1.0
func PutToken(t Token, ss SecretStore) error
func RemoveToken ¶ added in v0.1.0
func RemoveToken(name string, ss SecretStore) error
func SetCurrentToken ¶
func SetCurrentToken(name string, cs ConfigStore, ss SecretStore) error
SetCurrentToken is a convenient way to set the CurrentToken field in a the current config.
Types ¶
type ConfigStore ¶
ConfigStore is anything that can persistently store a Config.
type JSONConfigStore ¶ added in v0.1.0
type JSONConfigStore struct {
ConfigPath string
}
JSONConfigStore implements a ConfigStore that stores its Config in a JSON file at the provided ConfigPath.
func (JSONConfigStore) Get ¶ added in v0.1.0
func (s JSONConfigStore) Get() (Config, error)
Get parses a Config from the filesystem.
func (JSONConfigStore) Put ¶ added in v0.1.0
func (s JSONConfigStore) Put(cfg Config) error
Put overwrites a Config on the filesystem.
type KeychainSecretStore ¶ added in v0.1.0
type KeychainSecretStore struct { ConfigPath string // contains filtered or unexported fields }
func (*KeychainSecretStore) Get ¶ added in v0.1.0
func (k *KeychainSecretStore) Get() (Secrets, error)
func (*KeychainSecretStore) Put ¶ added in v0.1.0
func (k *KeychainSecretStore) Put(s Secrets) error
type SecretStore ¶ added in v0.1.0
type Token ¶
type Token struct { Name string Endpoint string APIToken string Insecure *bool NoVerifyCA *bool CACert []byte }
func CurrentToken ¶
func CurrentToken(cs ConfigStore, ss SecretStore) (Token, error)
CurrentToken is convenient way to obtain the CurrentToken field from the current Config.
func DefaultToken ¶
func DefaultToken(overrideEndpoint, overrideAPIToken string, cs ConfigStore, ss SecretStore) (Token, error)
DefaultToken creates a Token from input, filling any missing values in with the current context's defaults.