Documentation
¶
Index ¶
- Constants
- Variables
- func AccessToken() string
- func Clear() error
- func ClientId() string
- func ClientIdOrFlag() string
- func ClientSecret() string
- func ClientSecretOrFlag() string
- func CombineConfigContext(context Context) error
- func Debug() bool
- func Init()
- func Load() error
- func Login(ctx context.Context, token string) error
- func LoginWithAPIEndpoint(ctx context.Context, token, apiEndpoint string) error
- func LoginWithAPIEndpointOidc(ctx context.Context, clientID, clientSecret, apiEndpoint string) error
- func LoginWithAccessToken(ctx context.Context, accessToken, apiEndpoint string) error
- func Logout() error
- func Organisation() string
- func PersonalAccessToken() string
- func Save() error
- func Server() string
- func Set(name string) error
- type API
- type Config
- type ConfigManager
- type Context
- type ContextRef
- type ContextReference
- type Servers
- type User
- type Users
Constants ¶
View Source
const ( DefaultConfigFilename = ".tcloud" DefaultAPIURL = "https://api.thalassa.cloud" )
View Source
const ( ThalassaConfigEnvVar = "THALASSA_CONFIG" ThalassaCConfigEnvVar = "THALASSACONFIG" ThalassaAccessTokenEnvVar = "THALASSA_ACCESS_TOKEN" ThalassaPersonalAccessTokenEnvVar = "THALASSA_PERSONAL_ACCESS_TOKEN" ThalassaOIDCClientIDEnvVar = "THALASSA_CLIENT_ID" ThalassaOIDCClientSecretEnvVar = "THALASSA_CLIENT_SECRET" ThalassaOrganisationIDEnvVar = "THALASSA_ORGANISATION_ID" ThalassaAPIEndpointEnvVar = "THALASSA_API_ENDPOINT" )
Variables ¶
View Source
var ( OrganisationFlag string EndpointFlag string PersonalAccessTokenFlag string AccessTokenFlag string OidcClientIDFlag string OidcClientSecretFlag string DebugFlag bool ContextFlag string )
View Source
var (
ErrContextNotFound = errors.New("context not found")
)
Functions ¶
func AccessToken ¶ added in v0.9.0
func AccessToken() string
func ClientIdOrFlag ¶ added in v0.2.0
func ClientIdOrFlag() string
func ClientSecret ¶ added in v0.2.0
func ClientSecret() string
func ClientSecretOrFlag ¶ added in v0.2.0
func ClientSecretOrFlag() string
func CombineConfigContext ¶
func LoginWithAPIEndpoint ¶
func LoginWithAPIEndpointOidc ¶ added in v0.2.0
func LoginWithAccessToken ¶ added in v0.9.1
func Organisation ¶
func Organisation() string
func PersonalAccessToken ¶ added in v0.9.0
func PersonalAccessToken() string
Types ¶
type Config ¶
type Config struct {
ConfigVersion string `yaml:"configVersion"`
Contexts []ContextReference `yaml:"contexts"`
CurrentContext string `yaml:"current-context"`
Servers []Servers `yaml:"servers"`
Users []Users `yaml:"users"`
}
type ConfigManager ¶
type ConfigManager interface {
// Get returns the current context.
// It returns an error if there is an issue retrieving the context.
Get() (Context, error)
// Set sets the current context to the one specified by name.
// It returns an error if there is an issue setting the context.
Set(name string) error
// AddOrMergeContext adds a new context or merges it with an existing one.
// It returns an error if there is an issue adding or merging the context.
AddOrMergeContext(context Context) error
// Load loads the context configuration from a persistent storage.
// It returns an error if there is an issue loading the configuration.
Load() error
// Save saves the current context configuration to a persistent storage.
// It returns an error if there is an issue saving the configuration.
Save() error
// RemoveContext removes a context from the configuration.
// It returns an error if there is an issue removing the context.
RemoveContext(name string) error
// RemoveContextUser removes a user from the configuration.
// It returns an error if there is an issue removing the user.
RemoveContextUser(name string) error
// RemoveContextServer removes a server from the configuration.
// It returns an error if there is an issue removing the server.
RemoveContextServer(name string) error
// Config returns the current configuration.
Config() Config
}
ConfigManager defines an interface for managing contexts within the application. It provides methods to get, set, and manipulate contexts, as well as to load and save configurations.
func GlobalConfigManager ¶
func GlobalConfigManager() ConfigManager
func NewConfigFileContextManager ¶
func NewConfigFileContextManager(filename string) ConfigManager
NewConfigFileContextManager creates a new context manager with the given filename.
type ContextRef ¶
type ContextReference ¶
type ContextReference struct {
Name string `yaml:"name"`
Context ContextRef `yaml:"context"`
}
Click to show internal directories.
Click to hide internal directories.