utils

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ShipyardctlConfigDir name of the config file directory for shipyardctl
	ShipyardctlConfigDir = ".shipyardctl"
	// ShipyardctlConfigFileName name of the config file for shipyardctl
	ShipyardctlConfigFileName = "config"
)

Variables

This section is empty.

Functions

func ConfigExists

func ConfigExists() (bool, error)

ConfigExists checks if the config file exists

func GetConfigPath

func GetConfigPath() string

GetConfigPath exported version of getConfigPath

func InitNewConfigFile

func InitNewConfigFile(name string, sso string, clusterTarget string) error

InitNewConfigFile creates a new config file

Types

type Cluster

type Cluster struct {
	Name    string
	Cluster string
	SSO     string
}

Cluster representation of a target cluster

type Config

type Config struct {
	CurrentContext string // name of current Context
	Contexts       []Context
}

Config shipyardctl configuration object

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig reads the config file into memory

func MakeConfig

func MakeConfig(name string, sso string, clusterTarget string) *Config

MakeConfig creates a context named default based on the given environment

func (*Config) DumpConfig

func (c *Config) DumpConfig() error

DumpConfig dumps the config to stdout

func (*Config) GetCurrentClusterTarget

func (c *Config) GetCurrentClusterTarget() string

GetCurrentClusterTarget retrieves current context cluster target

func (*Config) GetCurrentContext

func (c *Config) GetCurrentContext() *Context

GetCurrentContext retrieves the current context

func (*Config) GetCurrentSSOTarget

func (c *Config) GetCurrentSSOTarget() string

GetCurrentSSOTarget retrieves current context sso target

func (*Config) GetCurrentToken

func (c *Config) GetCurrentToken() string

GetCurrentToken retrieves the user token from the current active context

func (*Config) GetCurrentUsername

func (c *Config) GetCurrentUsername() string

GetCurrentUsername retrieves the username of the current context

func (*Config) NewContext

func (c *Config) NewContext(name string, sso string, clusterTarget string) error

NewContext used to create a new context

func (*Config) Save

func (c *Config) Save() error

Save writes the config out to file

func (*Config) SaveToken

func (c *Config) SaveToken(username string, token string) error

SaveToken writes the given username and token to the current context

func (*Config) SetContext

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

SetContext switch current context to given context name

type Context

type Context struct {
	Name        string
	ClusterInfo Cluster
	UserInfo    User
}

Context a named combination of user creds and cluster info

type User

type User struct {
	Username string
	Token    string
}

User representation of a user's credentials

Jump to

Keyboard shortcuts

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