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 IsFileUploadAPI(api string) bool
- 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) PauseActiveSpinners() int
- func (c *Config) PrintHeader()
- func (c *Config) ResumePausedSpinners()
- 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 ( FAKE = "fake" FilePathArg = "filepath=" )
FAKE is used for fake CLI only options like filter=
const ( COLUMN = "column" CSV = "csv" JSON = "json" TABLE = "table" TEXT = "text" DEFAULT = "default" )
Output formats
const DefaultACSAPIEndpoint = "http://localhost:8080/client/api"
DefaultACSAPIEndpoint is the default API endpoint for CloudStack.
Variables ¶
This section is empty.
Functions ¶
func CheckIfValuePresent ¶
CheckIfValuePresent checks if an element is present in the dataset.
func GetOutputFormats ¶
func GetOutputFormats() []string
GetOutputFormats returns the supported output formats.
func IsFileUploadAPI ¶
IsFileUploadAPI checks if the provided API name corresponds to a file upload-related API. It returns true if the API name matches one of the following (case-insensitive): "getUploadParamsForIso", "getUploadParamsForVolume", or "getUploadParamsForTemplate".
func LoadCache ¶
func LoadCache(c *Config) interface{}
LoadCache loads cache using the default cache file
func SetupContext ¶
func SetupContext(cfg *Config)
SetupContext initializes the context and signal handling for the config.
Types ¶
type API ¶
type API struct {
Name string
Verb string
Noun string
Args []*APIArg
RequiredArgs []string
FakeArgs []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
// contains filtered or unexported fields
}
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) PauseActiveSpinners ¶
PauseActiveSpinners stops the spinners without removing them from the acive spinners list, allowing resume.
func (*Config) PrintHeader ¶
func (c *Config) PrintHeader()
PrintHeader prints startup message in CLI mode
func (*Config) ResumePausedSpinners ¶
func (c *Config) ResumePausedSpinners()
ResumePausedSpinners restarts the spinners from the active spinners list if they are not already running.
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"`
PostRequest bool `ini:"postrequest"`
}
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