Documentation ¶
Index ¶
- func CurrentProfile() string
- func GetString(k *koanf.Koanf, key, env string, flag *pflag.Flag) string
- func LoadFromFile(defaultFile, customFile string) (string, error)
- func ProfileList() []string
- func ReadUserInput(prompt, key, profile string, validate ...Validator)
- func RegisterAuthMethod(name string, method AuthMethod)
- func SetProfileCommand(defaultConfig string) *cobra.Command
- func SetupConfigFlags(command *cobra.Command)
- func SetupEndpointFlags(command *cobra.Command, service string, ...)
- func SupportedAuthMethods() []string
- func SwitchProfile(profile string) error
- func WriteToFile(customFile string) error
- type AuthMethod
- type AuthMethodFlag
- type EndpointAuth
- type EndpointConfig
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentProfile ¶
func CurrentProfile() string
func LoadFromFile ¶
func ProfileList ¶
func ProfileList() []string
func ReadUserInput ¶
func RegisterAuthMethod ¶
func RegisterAuthMethod(name string, method AuthMethod)
func SetProfileCommand ¶
func SetupConfigFlags ¶
func SetupEndpointFlags ¶
func SupportedAuthMethods ¶
func SupportedAuthMethods() []string
func SwitchProfile ¶
func WriteToFile ¶
Types ¶
type AuthMethod ¶
type AuthMethod func(*cobra.Command, *koanf.Koanf, string) EndpointAuth
type AuthMethodFlag ¶
type AuthMethodFlag string
func (*AuthMethodFlag) Set ¶
func (e *AuthMethodFlag) Set(v string) error
func (*AuthMethodFlag) String ¶
func (e *AuthMethodFlag) String() string
func (*AuthMethodFlag) Type ¶
func (e *AuthMethodFlag) Type() string
type EndpointAuth ¶
type EndpointAuth interface {
TlsCertificates() []tls.Certificate
}
type EndpointConfig ¶
type EndpointConfig struct { Endpoint string CaFile string Auth EndpointAuth }
func LoadEndpointConfig ¶
func LoadEndpointConfig(command *cobra.Command, service, configFile string) EndpointConfig
type Validator ¶
var ( ValidateURL Validator = func(s string) error { u, err := url.Parse(s) if err != nil { return err } if _, err = net.ResolveIPAddr("ip", u.Hostname()); err != nil { return err } return nil } ValidateFileExists Validator = func(s string) error { inf, err := os.Stat(s) if err != nil { return err } if inf.IsDir() { return errors.New("Must be a file but is a directory") } return nil } ValidateTCPAddr Validator = func(s string) error { _, err := net.ResolveTCPAddr("tcp", s) return err } )
func (Validator) AllowEmpty ¶
Click to show internal directories.
Click to hide internal directories.