cmd_config

package
v1.5.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigInit

func ConfigInit(cfg *Config) error

func CreateContext

func CreateContext(cfg *Config, name, url string) error

func CreateDefaultContext added in v1.2.0

func CreateDefaultContext(cfg *Config) error

func SelectContext

func SelectContext(cfg *Config) error

func UseContext

func UseContext(cfg *Config, name string) error

Types

type Auth

type Auth struct {
	UserID       uuid.UUID `yaml:"user_id,omitempty"`
	AccessToken  string    `yaml:"access_token,omitempty"`
	RefreshToken string    `yaml:"refresh_token,omitempty"`
}

type Config

type Config struct {
	Contexts []*Context `yaml:"contexts"`

	Services []*Service `yaml:"services"`

	Users []*User `yaml:"users"`

	CurrentContextName string `yaml:"current_context"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(cfgPath string) (*Config, error)

func (*Config) GetCurrentAuth

func (cfg *Config) GetCurrentAuth() *Auth

func (*Config) GetCurrentContext

func (cfg *Config) GetCurrentContext() *Context

func (*Config) GetCurrentService

func (cfg *Config) GetCurrentService() *Service

func (Config) Save

func (cfg Config) Save() error

type Context

type Context struct {
	Name        string `yaml:"name"`
	ServiceName string `yaml:"service"`
	UserName    string `yaml:"user"`
	Project     struct {
		ProjectID    string `yaml:"project_id"`
		ProjectToken string `yaml:"project_token"`
	} `yaml:"project"`
	// contains filtered or unexported fields
}

func (*Context) GetAuth

func (c *Context) GetAuth() *Auth

func (*Context) GetService

func (c *Context) GetService() *Service

func (*Context) SetAuth

func (c *Context) SetAuth(a *Auth)

func (*Context) SetService

func (c *Context) SetService(s *Service)

type Service

type Service struct {
	Name   string `yaml:"name,omitempty"`
	Server string `yaml:"server,omitempty"`
}

type User

type User struct {
	Name string `yaml:"name,omitempty"`
	Auth *Auth  `yaml:"auth,omitempty"`
}

Jump to

Keyboard shortcuts

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