conf

package
v0.0.0-...-27a9103 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrettyJSON

func PrettyJSON(data string) string

PrettyJSON returns indented JSON data.

Types

type Auth

type Auth struct {
	Username string
	Password string
	Encoded  string
}

Auth contains username and password (decoded)

func (*Auth) Decode

func (a *Auth) Decode()

Decode will decode Encoded to Username and Password strings.

func (*Auth) Encode

func (a *Auth) Encode() string

Encode will encode Username and Password to base64 string.

func (*Auth) GetToken

func (a *Auth) GetToken(context *Context) (Token, error)

GetToken will return the token provided for the specified user.

func (*Auth) PromptPassword

func (a *Auth) PromptPassword()

PromptPassword get password from command prompt

type Config

type Config struct {
	CurrentContext string
	Contexts       []Context
}

Config contains details on all config settings.

func (*Config) AddContext

func (c *Config) AddContext(context Context) error

AddContext adds new context to config.

func (*Config) ExistsConfig

func (c *Config) ExistsConfig(name string) bool

ExistsConfig reports whether the config file exists.

func (*Config) GetContext

func (c *Config) GetContext(name string) (*Context, error)

GetContext returns the named context.

func (*Config) GetCurrentContext

func (c *Config) GetCurrentContext() (*Context, error)

GetCurrentContext returns the current context.

func (*Config) LoadConfig

func (c *Config) LoadConfig(path string) error

LoadConfig to load yaml config from file.

func (*Config) UpdateContext

func (c *Config) UpdateContext(name string, auth Auth, domain string)

UpdateContext apply updates to named context.

func (*Config) Validate

func (c *Config) Validate(name string) bool

Validate loops contexts to confirm if named context is valid.

func (*Config) WriteConfig

func (c *Config) WriteConfig(path string) error

WriteConfig to write any changed config back to file.

type Context

type Context struct {
	Auth   string
	Domain string
	Name   string
}

Context contains details on AiT instance.

type Token

type Token struct {
	Access string `json:"access_token"`
	Type   string `json:"token_type"`
}

Token returned from API request (valid approx 5 mins idle time).

func (*Token) GetHeader

func (t *Token) GetHeader() (string, string)

GetHeader return the header string for the token.

Jump to

Keyboard shortcuts

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