Documentation ¶
Index ¶
- Constants
- func CheckIfValuePresent(dataset []string, element string) bool
- func Debug(params ...interface{})
- func DisableDebugging()
- func EnableDebugging()
- func GetOutputFormats() []string
- func GetProfiles() []string
- func LoadCache(c *Config) interface{}
- func SetupContext(cfg *Config)
- type API
- type APIArg
- type Config
- func (c Config) CacheFile() string
- func (c *Config) GetAPIVerbMap() map[string][]*API
- func (c *Config) GetCache() map[string]*API
- func (c *Config) GetPrompt() string
- func (c *Config) LoadProfile(name string)
- func (c *Config) Name() string
- func (c *Config) PrintHeader()
- func (c *Config) SaveCache(response map[string]interface{})
- func (c *Config) StartSpinner(suffix string) *spinner.Spinner
- func (c *Config) StopSpinner(waiter *spinner.Spinner)
- func (c *Config) UpdateCache(response map[string]interface{}) interface{}
- func (c *Config) UpdateConfig(key string, value string, update bool)
- func (c *Config) Version() string
- type Core
- type ServerProfile
Constants ¶
const ( COLUMN = "column" CSV = "csv" JSON = "json" TABLE = "table" TEXT = "text" DEFAULT = "default" )
Output formats
const DEFAULT_ACS_API_ENDPOINT = "http://localhost:8080/client/api"
const FAKE = "fake"
FAKE is used for fake CLI only options like filter=
Variables ¶
This section is empty.
Functions ¶
func CheckIfValuePresent ¶
func GetOutputFormats ¶
func GetOutputFormats() []string
func LoadCache ¶
func LoadCache(c *Config) interface{}
LoadCache loads cache using the default cache file
func SetupContext ¶
func SetupContext(cfg *Config)
Types ¶
type API ¶
type API struct { Name string Verb string Noun string Args []*APIArg RequiredArgs []string Related []string Async bool Description string ResponseKeys []string }
API describes a CloudStack API
type APIArg ¶
type APIArg struct { Name string Type string Related []string Description string Required bool Length int }
APIArg are the args passable to an API
type Config ¶
type Config struct { Dir string ConfigFile string HistoryFile string LogFile string HasShell bool Core *Core ActiveProfile *ServerProfile Context *context.Context Cancel context.CancelFunc C chan bool }
Config describes CLI config file and default options
func (*Config) GetAPIVerbMap ¶
GetAPIVerbMap returns API cache by verb
func (*Config) LoadProfile ¶
LoadProfile loads an existing profile
func (*Config) PrintHeader ¶
func (c *Config) PrintHeader()
PrintHeader prints startup message in CLI mode
func (*Config) StartSpinner ¶
StartSpinner starts and returns a waiting cursor that the CLI can use
func (*Config) StopSpinner ¶
StopSpinner stops the provided spinner if it is valid
func (*Config) UpdateCache ¶
UpdateCache uses auto-discovery data to update internal API cache
func (*Config) UpdateConfig ¶
UpdateConfig updates and saves config
type Core ¶
type Core struct { Prompt string `ini:"prompt"` AsyncBlock bool `ini:"asyncblock"` Timeout int `ini:"timeout"` Output string `ini:"output"` VerifyCert bool `ini:"verifycert"` ProfileName string `ini:"profile"` AutoComplete bool `ini:"autocomplete"` }
Core block describes common options for the CLI
type ServerProfile ¶
type ServerProfile struct { URL string `ini:"url"` Username string `ini:"username"` Password string `ini:"password"` Domain string `ini:"domain"` APIKey string `ini:"apikey"` SecretKey string `ini:"secretkey"` Client *http.Client `ini:"-"` }
ServerProfile describes a management server