Documentation ¶
Index ¶
- Constants
- func ContextExists(name string) (bool, error)
- func CreateContext(name string) error
- func GetApiKey() string
- func GetAuthProviderName() string
- func GetConfigPath(subdirOrFile string) (string, error)
- func GetContext() string
- func GetRootCAs() string
- func GetServer() string
- func GetServerNameOverride() string
- func Init(flags *pflag.FlagSet) error
- func ListContexts() ([]string, error)
- func SetApiKey(apiKey string) error
- func SetAuthProvider(authProvider *AuthProvider) error
- func SetCaCert(cert string) error
- func SetCurrentContext(ctxName string) error
- func SetServerAddress(server string) error
- func SetServerNameOverride(name string) error
- type ApiKeyConfig
- type AuthProvider
- type Config
- type OIDCConfig
Constants ¶
const ( ProviderOIDC = "oidc" ProviderApiKey = "apikey" )
Variables ¶
This section is empty.
Functions ¶
func ContextExists ¶
ContextExists checks if a context exists.
func GetAuthProviderName ¶
func GetAuthProviderName() string
GetAuthProviderName returns the authentication provider name.
func GetConfigPath ¶
GetConfigPath returns the full path of a config directory or config file.
func SetAuthProvider ¶
func SetAuthProvider(authProvider *AuthProvider) error
SetAuthProvider sets the authentication provider.
func SetCurrentContext ¶
SetCurrentContext sets the current context.
func SetServerAddress ¶
SetServerAddress sets the server address.
func SetServerNameOverride ¶
SetServerNameOverride sets the server name override.
Types ¶
type ApiKeyConfig ¶
type ApiKeyConfig struct {
ApiKey string `yaml:"api-key,omitempty" mapstructure:"api-key"`
}
ApiKeyConfig is the configuration for the apikey authentication provider.
func GetApiKeyConfig ¶
func GetApiKeyConfig() (*ApiKeyConfig, error)
GetApiKeyConfig returns the apikey configuration.
type AuthProvider ¶
type AuthProvider struct { // Name is the type of authentication provider. Name string `yaml:"name" mapstructure:"name"` // Config is the configuration for the authentication provider. Config any `yaml:"config" mapstructure:"config"` }
AuthProvider is the authentication provider configuration.
func GetAuthProvider ¶
func GetAuthProvider() *AuthProvider
GetAuthProvider returns the authentication provider.
type Config ¶
type Config struct { Server string `yaml:"server,omitempty" mapstructure:"server"` RootCAs string `yaml:"certificate-authority-data,omitempty" mapstructure:"certificate-authority-data"` ServerNameOverride string `yaml:"server-name-override,omitempty" mapstructure:"server-name-override"` AuthProvider *AuthProvider `yaml:"auth-provider,omitempty" mapstructure:"auth-provider"` }
Config represents the persistent configuration.
type OIDCConfig ¶
type OIDCConfig struct { ClientID string `yaml:"client-id" mapstructure:"client-id"` ClientSecret string `yaml:"client-secret,omitempty" mapstructure:"client-secret"` IdToken string `yaml:"id-token" mapstructure:"id-token"` RefreshToken string `yaml:"refresh-token,omitempty" mapstructure:"refresh-token"` IdpIssuerUrl string `yaml:"idp-issuer-url" mapstructure:"idp-issuer-url"` }
OIDCConfig is the configuration for the oidc authentication provider.
func GetOIDCConfig ¶
func GetOIDCConfig() (*OIDCConfig, error)
GetOIDCConfig returns the oidc configuration.