Documentation
¶
Index ¶
- Constants
- Variables
- func WithInMemoryStore() profileConfigVariadicFunc
- func WithKeyringStore() profileConfigVariadicFunc
- type AuthCredentials
- type AuthCredentialsAccessToken
- type CurrentProfileStore
- type GlobalConfig
- type GlobalStore
- func (p *GlobalStore) AddProfile(profileName string) error
- func (p *GlobalStore) GetDefaultProfile() string
- func (p *GlobalStore) ListProfiles() []string
- func (p *GlobalStore) ProfileExists(profileName string) bool
- func (p *GlobalStore) RemoveProfile(profileName string) error
- func (p *GlobalStore) SetDefaultProfile(profileName string) error
- type KeyringStore
- type MemoryStore
- type NewStoreInterface
- type Profile
- func (p *Profile) AddProfile(profileName string, endpoint string, tlsNoVerify bool, setDefault bool) error
- func (p *Profile) DeleteProfile(profileName string) error
- func (p *Profile) GetCurrentProfile() (*ProfileStore, error)
- func (p *Profile) GetGlobalConfig() *GlobalStore
- func (p *Profile) GetProfile(profileName string) (*ProfileStore, error)
- func (p *Profile) ListProfiles() []string
- func (p *Profile) SetDefaultProfile(profileName string) error
- func (p *Profile) UseDefaultProfile() (*ProfileStore, error)
- func (p *Profile) UseProfile(profileName string) (*ProfileStore, error)
- type ProfileConfig
- type ProfileStore
- func (p *ProfileStore) Delete() error
- func (p *ProfileStore) Get() error
- func (p *ProfileStore) GetAuthCredentials() AuthCredentials
- func (p *ProfileStore) GetEndpoint() string
- func (p *ProfileStore) GetProfileName() string
- func (p *ProfileStore) GetTLSNoVerify() bool
- func (p *ProfileStore) Save() error
- func (p *ProfileStore) SetAuthCredentials(authCredentials AuthCredentials) error
- func (p *ProfileStore) SetEndpoint(endpoint string) error
- func (p *ProfileStore) SetTLSNoVerify(tlsNoVerify bool) error
- type StoreInterface
Constants ¶
View Source
const ( STORE_KEY_PROFILE = "profile" STORE_KEY_GLOBAL = "global" )
View Source
const ( PROFILE_DRIVER_KEYRING = "keyring" PROFILE_DRIVER_IN_MEMORY = "in-memory" PROFILE_DRIVER_DEFAULT = PROFILE_DRIVER_KEYRING )
View Source
const ( PROFILE_AUTH_TYPE_CLIENT_CREDENTIALS = "client-credentials" PROFILE_AUTH_TYPE_ACCESS_TOKEN = "access-token" )
View Source
const PROFILES_VERSION_LATEST = PROFILES_VERSION_v1_0
View Source
const PROFILES_VERSION_v1_0 = "1.0"
This variable is used to store the version of the profiles. Since the profiles structure might change in the future, this variable is used to keep track of the version of the profiles and will be used to determine how to handle migration of the profiles.
Variables ¶
View Source
var ErrDeletingDefaultProfile = errors.New("cannot delete the default profile")
Functions ¶
func WithInMemoryStore ¶
func WithInMemoryStore() profileConfigVariadicFunc
func WithKeyringStore ¶
func WithKeyringStore() profileConfigVariadicFunc
Types ¶
type AuthCredentials ¶
type AuthCredentials struct { AuthType string `json:"authType"` ClientId string `json:"clientId"` // Used for client credentials ClientSecret string `json:"clientSecret,omitempty"` AccessToken AuthCredentialsAccessToken `json:"accessToken,omitempty"` }
type CurrentProfileStore ¶
type CurrentProfileStore struct {
// contains filtered or unexported fields
}
type GlobalConfig ¶
type GlobalStore ¶
type GlobalStore struct {
// contains filtered or unexported fields
}
func LoadGlobalConfig ¶
func LoadGlobalConfig(newStore func(string, string) StoreInterface) (*GlobalStore, error)
load global config or create a new one
func (*GlobalStore) AddProfile ¶
func (p *GlobalStore) AddProfile(profileName string) error
func (*GlobalStore) GetDefaultProfile ¶
func (p *GlobalStore) GetDefaultProfile() string
func (*GlobalStore) ListProfiles ¶
func (p *GlobalStore) ListProfiles() []string
func (*GlobalStore) ProfileExists ¶
func (p *GlobalStore) ProfileExists(profileName string) bool
func (*GlobalStore) RemoveProfile ¶
func (p *GlobalStore) RemoveProfile(profileName string) error
func (*GlobalStore) SetDefaultProfile ¶
func (p *GlobalStore) SetDefaultProfile(profileName string) error
type KeyringStore ¶
type KeyringStore struct {
// contains filtered or unexported fields
}
func (*KeyringStore) Delete ¶
func (k *KeyringStore) Delete() error
func (*KeyringStore) Exists ¶
func (k *KeyringStore) Exists() bool
func (*KeyringStore) Get ¶
func (k *KeyringStore) Get(value interface{}) error
func (*KeyringStore) Set ¶
func (k *KeyringStore) Set(value interface{}) error
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func (*MemoryStore) Delete ¶
func (k *MemoryStore) Delete() error
func (*MemoryStore) Exists ¶
func (k *MemoryStore) Exists() bool
func (*MemoryStore) Get ¶
func (k *MemoryStore) Get(value interface{}) error
func (*MemoryStore) Set ¶
func (k *MemoryStore) Set(value interface{}) error
type NewStoreInterface ¶
type NewStoreInterface func(namespace string, key string) StoreInterface
var NewKeyringStore NewStoreInterface = func(namespace string, key string) StoreInterface { return &KeyringStore{ namespace: namespace, key: key, } }
var NewMemoryStore NewStoreInterface = func(namespace string, key string) StoreInterface { memory := make(map[string]interface{}) return &MemoryStore{ namespace: namespace, key: key, memory: &memory, } }
NewMemoryStore creates a new in-memory store JSON is used to serialize the data to ensure the interface is consistent with other store implementations
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
func (*Profile) AddProfile ¶
func (*Profile) DeleteProfile ¶
func (*Profile) GetCurrentProfile ¶
func (p *Profile) GetCurrentProfile() (*ProfileStore, error)
func (*Profile) GetGlobalConfig ¶
func (p *Profile) GetGlobalConfig() *GlobalStore
func (*Profile) GetProfile ¶
func (p *Profile) GetProfile(profileName string) (*ProfileStore, error)
func (*Profile) ListProfiles ¶
func (*Profile) SetDefaultProfile ¶
func (*Profile) UseDefaultProfile ¶
func (p *Profile) UseDefaultProfile() (*ProfileStore, error)
func (*Profile) UseProfile ¶
func (p *Profile) UseProfile(profileName string) (*ProfileStore, error)
type ProfileConfig ¶
type ProfileConfig struct { Name string `json:"profile"` Endpoint string `json:"endpoint"` TlsNoVerify bool `json:"tlsNoVerify"` AuthCredentials AuthCredentials `json:"authCredentials"` }
type ProfileStore ¶
type ProfileStore struct {
// contains filtered or unexported fields
}
func LoadProfileStore ¶
func LoadProfileStore(newStore NewStoreInterface, profileName string) (*ProfileStore, error)
func NewProfileStore ¶
func NewProfileStore(newStore NewStoreInterface, profileName string, endpoint string, tlsNoVerify bool) (*ProfileStore, error)
func (*ProfileStore) Delete ¶
func (p *ProfileStore) Delete() error
func (*ProfileStore) Get ¶
func (p *ProfileStore) Get() error
func (*ProfileStore) GetAuthCredentials ¶
func (p *ProfileStore) GetAuthCredentials() AuthCredentials
func (*ProfileStore) Save ¶
func (p *ProfileStore) Save() error
func (*ProfileStore) SetAuthCredentials ¶
func (p *ProfileStore) SetAuthCredentials(authCredentials AuthCredentials) error
func (*ProfileStore) SetEndpoint ¶
func (p *ProfileStore) SetEndpoint(endpoint string) error
func (*ProfileStore) SetTLSNoVerify ¶
func (p *ProfileStore) SetTLSNoVerify(tlsNoVerify bool) error
Click to show internal directories.
Click to hide internal directories.