profiles

package
v3.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BulkCheck

func BulkCheck(s Store, all []string) []string

BulkCheck checks which of a slice of profiles exist in the store

Types

type KeyringStore

type KeyringStore struct {
	Name string
}

KeyringStore fetches credentials from the system keyring

func (*KeyringStore) Check

func (k *KeyringStore) Check(profile string) bool

Check returns if the credentials are cached in the keyring

func (*KeyringStore) Delete

func (k *KeyringStore) Delete(profile string) error

Delete removes a profile from the keyring

func (*KeyringStore) Lookup

func (k *KeyringStore) Lookup(profile string) (credentials.Value, error)

Lookup checks the keyring for credentials

func (*KeyringStore) Write

func (k *KeyringStore) Write(profile string, creds credentials.Value) error

Write caches the credentials for the user

type MultiStore

type MultiStore struct {
	Backends []Store
}

MultiStore is a storage backend which tries a series of backends

func (*MultiStore) Check

func (m *MultiStore) Check(profile string) bool

Check returns true if any backend has the credentials cached

func (*MultiStore) Delete

func (m *MultiStore) Delete(profile string) error

Delete removes a profile from all backends

func (*MultiStore) Lookup

func (m *MultiStore) Lookup(profile string) (credentials.Value, error)

Lookup looks up creds from the list of backends

func (*MultiStore) Write

func (m *MultiStore) Write(s string, c credentials.Value) error

type PromptStore

type PromptStore struct{}

PromptStore is a storage backend which asks the user for input

func (*PromptStore) Check

func (p *PromptStore) Check(_ string) bool

Check is always false, because user input is never cached

func (*PromptStore) Delete

func (p *PromptStore) Delete(_ string) error

Delete is a no-op, as Prompt never stores credentials

func (*PromptStore) Lookup

func (p *PromptStore) Lookup(profile string) (credentials.Value, error)

Lookup asks the user for credentials

type Store

type Store interface {
	Lookup(string) (credentials.Value, error)
	Check(string) bool
	Delete(string) error
}

Store is an object which can look up credentials

func NewDefaultStore

func NewDefaultStore() Store

NewDefaultStore returns the default backend set

type WritableStore

type WritableStore interface {
	Write(string, credentials.Value) error
}

WritableStore defines a backend which can save credentials

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL