config

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileName        = "config.yaml"
	HistoryFileName = "cli.hist"

	Usw2a1 = "usw2a1"
	Use1a1 = "use1a1"
	Euc1a1 = "euc1a1"
	Apt2a1 = "apt2a1"
)

Variables

View Source
var (
	NoSelectionErr         = errors.New("no context selected")
	NotFoundErr            = errors.New("context not found")
	ContextAlreadyExistErr = errors.New("context already exists")
	TokenExpiredErr        = errors.New("token expired")
)
View Source
var Clusters = []string{Usw2a1, Use1a1, Euc1a1, Apt2a1}
View Source
var File string

Functions

func Client added in v0.0.22

func Client(cmd *cobra.Command, version string) (*rockset.RockClient, error)

func HistoryFile

func HistoryFile() (string, error)

func Store

func Store(cfg Config) error

func StoreFile

func StoreFile(cfg Config, cfgPath string) error

Types

type APIKey

type APIKey struct {
	Key    string `yaml:"apikey"`
	Server string `yaml:"apiserver"`
}

func (APIKey) APIServer added in v0.0.10

func (a APIKey) APIServer() string

type Config

type Config struct {
	Current string            `yaml:"current"`
	Keys    map[string]APIKey `yaml:"keys"`
	Tokens  map[string]Token  `yaml:"tokens"`
}

func Load

func Load() (Config, error)

Load loads the CLI configuration, and if the config doesn't exist, it returns an empty config.

func LoadFile

func LoadFile(cfgPath string) (Config, error)

func New

func New() Config

func (*Config) AddKey

func (c *Config) AddKey(name string, key APIKey) error

func (*Config) AddToken

func (c *Config) AddToken(name string, token Token) error

func (*Config) AsOptions

func (c *Config) AsOptions(override string) ([]rockset.RockOption, error)

func (*Config) DeleteContext added in v0.0.14

func (c *Config) DeleteContext(name string) error

func (*Config) Use

func (c *Config) Use(name string) error

type Token

type Token struct {
	Token      string    `yaml:"token"`
	Org        string    `yaml:"org"`
	Server     string    `yaml:"apiserver"`
	Expiration time.Time `yaml:"expiration"`
}

func (Token) APIServer added in v0.0.10

func (t Token) APIServer() string

Jump to

Keyboard shortcuts

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