Documentation
¶
Index ¶
- Constants
- Variables
- func Args(args ...string) []string
- func ArgsS(args string) []string
- func Execute() (cmd *cobra.Command, err error)
- func IsTerminal(f *os.File) bool
- func NewCompletionCommand(baseCmd *BaseCommand) *cobra.Command
- func NewConfigCommand(baseCmd *BaseCommand) *cobra.Command
- func NewConsoleCommand(baseCmd *BaseCommand) *cobra.Command
- func NewIgniteCommand(baseCmd *BaseCommand) *cobra.Command
- func NewInitCommand(baseCommand *BaseCommand) *cobra.Command
- func NewOptimizerCommand(baseCmd *BaseCommand) *cobra.Command
- func NewOptimizerConfigCommand(baseCmd *BaseCommand) *cobra.Command
- func NewOptimizerConfigEditCommand(baseCmd *BaseCommand) *cobra.Command
- func NewOptimizerConfigGetCommand(baseCmd *BaseCommand) *cobra.Command
- func NewOptimizerConfigPatchCommand(baseCmd *BaseCommand) *cobra.Command
- func NewOptimizerConfigSetCommand(baseCmd *BaseCommand) *cobra.Command
- func NewOptimizerRestartCommand(baseCmd *BaseCommand) *cobra.Command
- func NewOptimizerStartCommand(baseCmd *BaseCommand) *cobra.Command
- func NewOptimizerStatusCommand(baseCmd *BaseCommand) *cobra.Command
- func NewOptimizerStopCommand(baseCmd *BaseCommand) *cobra.Command
- func NewProfileCommand(baseCmd *BaseCommand) *cobra.Command
- func NewServoCommand(baseCmd *BaseCommand) *cobra.Command
- func NewVitalCommand(baseCmd *BaseCommand) *cobra.Command
- func PrettyPrintJSONBytes(bytes []byte) error
- func PrettyPrintJSONObject(obj interface{}) error
- func PrettyPrintJSONResponse(resp *resty.Response) error
- func PrettyPrintJSONString(str string) error
- func PrettyPrintYAMLToString(bytes []byte, colorize bool, lineNumbers bool) (string, error)
- func RangeOfValidJSONArgs(min int, max int) cobra.PositionalArgs
- func SetJSONKeyPathValuesFromStringOnBytes(jsonPathDescriptor string, bytes []byte) ([]byte, error)
- func SetJSONKeyPathValuesFromStringsOnBytes(jsonPathDescriptors []string, bytes []byte) ([]byte, error)
- func SetStdio(stdio terminal.Stdio)
- func ValidSetJSONKeyPathArgs(cmd *cobra.Command, args []string) error
- type BaseCommand
- func (cmd *BaseCommand) AccessToken() string
- func (cmd *BaseCommand) AllSettings() map[string]interface{}
- func (cmd *BaseCommand) Ask(qs []*survey.Question, response interface{}, opts ...survey.AskOpt) error
- func (cmd *BaseCommand) AskOne(p survey.Prompt, response interface{}, opts ...survey.AskOpt) error
- func (cmd *BaseCommand) BaseURL() string
- func (cmd *BaseCommand) BaseURLHostnameAndPort() string
- func (cmd *BaseCommand) ColorOutput() bool
- func (cmd *BaseCommand) DebugModeEnabled() bool
- func (baseCmd *BaseCommand) DefaultConfigFile() string
- func (baseCmd *BaseCommand) DefaultConfigPath() string
- func (baseCmd *BaseCommand) DefaultConfigType() string
- func (cmd *BaseCommand) ErrOrStderr() io.Writer
- func (cmd *BaseCommand) Flags() *pflag.FlagSet
- func (baseCmd *BaseCommand) GetAllSettings() map[string]interface{}
- func (baseCmd *BaseCommand) GetBaseURL() string
- func (baseCmd *BaseCommand) GetBaseURLHostnameAndPort() string
- func (baseCmd *BaseCommand) GetOptimizerComponents() (orgSlug string, appSlug string)
- func (baseCmd *BaseCommand) InitConfigRunE(cmd *cobra.Command, args []string) error
- func (baseCmd *BaseCommand) IsInitialized() bool
- func (cmd *BaseCommand) LoadProfile() (*Profile, error)
- func (baseCmd *BaseCommand) NewAPIClient() *opsani.Client
- func (cmd *BaseCommand) Optimizer() string
- func (cmd *BaseCommand) OptimizerComponents() (orgSlug string, appSlug string)
- func (cmd *BaseCommand) OutOrStdout() io.Writer
- func (cmd *BaseCommand) PersistentFlags() *pflag.FlagSet
- func (cmd *BaseCommand) PrettyPrintJSONBytes(bytes []byte) error
- func (cmd *BaseCommand) PrettyPrintJSONObject(obj interface{}) error
- func (cmd *BaseCommand) PrettyPrintJSONResponse(resp *resty.Response) error
- func (cmd *BaseCommand) PrettyPrintJSONString(str string) error
- func (cmd *BaseCommand) PrettyPrintYAML(bytes []byte, lineNumbers bool) error
- func (cmd *BaseCommand) PrettyPrintYAMLObject(obj interface{}) error
- func (cmd *BaseCommand) Print(i ...interface{})
- func (cmd *BaseCommand) PrintErr(i ...interface{})
- func (cmd *BaseCommand) PrintErrf(format string, i ...interface{})
- func (cmd *BaseCommand) PrintErrln(i ...interface{})
- func (cmd *BaseCommand) Printf(format string, i ...interface{})
- func (cmd *BaseCommand) Println(i ...interface{})
- func (cmd *BaseCommand) RequestTracingEnabled() bool
- func (baseCmd *BaseCommand) RequireConfigFileFlagToExistRunE(cmd *cobra.Command, args []string) error
- func (baseCmd *BaseCommand) RequireInitRunE(cmd *cobra.Command, args []string) error
- func (cmd *BaseCommand) RootCobraCommand() *cobra.Command
- func (cmd *BaseCommand) SetColorOutput(colorOutput bool)
- func (cmd *BaseCommand) Viper() *viper.Viper
- type DockerComposeServoDriver
- func (c *DockerComposeServoDriver) Config() error
- func (c *DockerComposeServoDriver) Logs(logsArgs servoLogsArgs) error
- func (c *DockerComposeServoDriver) Restart() error
- func (c *DockerComposeServoDriver) Shell() error
- func (c *DockerComposeServoDriver) Start() error
- func (c *DockerComposeServoDriver) Status() error
- func (c *DockerComposeServoDriver) Stop() error
- type FlagError
- type KubernetesServoDriver
- func (c *KubernetesServoDriver) Config() error
- func (c *KubernetesServoDriver) Logs(logsArgs servoLogsArgs) error
- func (c *KubernetesServoDriver) Restart() error
- func (c *KubernetesServoDriver) Shell() error
- func (c *KubernetesServoDriver) Start() error
- func (c *KubernetesServoDriver) Status() error
- func (c *KubernetesServoDriver) Stop() error
- type Profile
- type ProfileRegistry
- func (pr *ProfileRegistry) AddProfile(profile Profile) error
- func (pr *ProfileRegistry) ProfileNamed(name string) *Profile
- func (pr *ProfileRegistry) Profiles() []*Profile
- func (pr *ProfileRegistry) RemoveProfile(profile Profile) error
- func (pr *ProfileRegistry) RemoveProfileNamed(name string) error
- func (pr *ProfileRegistry) Save() error
- func (pr *ProfileRegistry) Set(profiles []Profile)
- type RunEFunc
- type RunFunc
- type Servo
- type ServoDriver
- type Task
Constants ¶
const ( KeyBaseURL = "base-url" KeyOptimizer = "optimizer" KeyToken = "token" KeyProfile = "profile" KeyDebugMode = "debug" KeyRequestTracing = "trace-requests" KeyEnvPrefix = "OPSANI" DefaultBaseURL = "https://api.opsani.com/" )
Configuration keys (Cobra and Viper)
Variables ¶
var ( Version = "dev" Commit = "none" BuildDate = "unknown" BuiltBy = "unknown" )
Functions ¶
func Args ¶ added in v0.2.0
Args is a convenience function that converts a variadic list of strings into an array
func ArgsS ¶ added in v0.2.0
ArgsS is a convenience function that converts a space delimited string into an array of args
func Execute ¶
Execute is the entry point for executing all commands from main All commands with RunE will bubble errors back here
func IsTerminal ¶
IsTerminal reports whether the file descriptor is connected to a terminal
func NewCompletionCommand ¶
func NewCompletionCommand(baseCmd *BaseCommand) *cobra.Command
NewCompletionCommand returns a new Opsani CLI cmpletion command instance
func NewConfigCommand ¶
func NewConfigCommand(baseCmd *BaseCommand) *cobra.Command
NewConfigCommand returns a new instance of the root command for Opsani CLI
func NewConsoleCommand ¶ added in v0.2.0
func NewConsoleCommand(baseCmd *BaseCommand) *cobra.Command
NewConsoleCommand returns a command that opens the Opsani Console in the default browser
func NewIgniteCommand ¶ added in v0.2.0
func NewIgniteCommand(baseCmd *BaseCommand) *cobra.Command
NewDemoCommand returns a new instance of the demo command
func NewInitCommand ¶
func NewInitCommand(baseCommand *BaseCommand) *cobra.Command
NewInitCommand returns a new `opsani init` command instance
func NewOptimizerCommand ¶ added in v0.2.0
func NewOptimizerCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerCommand returns a new `opsani app` command instance
func NewOptimizerConfigCommand ¶ added in v0.2.0
func NewOptimizerConfigCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerConfigCommand returns a new Opsani CLI `app config` action
func NewOptimizerConfigEditCommand ¶ added in v0.2.0
func NewOptimizerConfigEditCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerConfigEditCommand returns a new Opsani CLI app config edit action
func NewOptimizerConfigGetCommand ¶ added in v0.2.0
func NewOptimizerConfigGetCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerConfigGetCommand returns a new Opsani CLI `app config get` action
func NewOptimizerConfigPatchCommand ¶ added in v0.2.0
func NewOptimizerConfigPatchCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerConfigPatchCommand returns a new Opsani CLI `app config patch` action
func NewOptimizerConfigSetCommand ¶ added in v0.2.0
func NewOptimizerConfigSetCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerConfigSetCommand returns a new Opsani CLI `app config set` action
func NewOptimizerRestartCommand ¶ added in v0.2.0
func NewOptimizerRestartCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerRestartCommand returns an Opsani CLI command for restarting the app
func NewOptimizerStartCommand ¶ added in v0.2.0
func NewOptimizerStartCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerStartCommand returns an Opsani CLI command for starting the app
func NewOptimizerStatusCommand ¶ added in v0.2.0
func NewOptimizerStatusCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerStatusCommand returns an Opsani CLI command for retrieving status on the app
func NewOptimizerStopCommand ¶ added in v0.2.0
func NewOptimizerStopCommand(baseCmd *BaseCommand) *cobra.Command
NewOptimizerStopCommand returns an Opsani CLI command for stopping the app
func NewProfileCommand ¶
func NewProfileCommand(baseCmd *BaseCommand) *cobra.Command
NewProfileCommand returns a new instance of the profile command
func NewServoCommand ¶
func NewServoCommand(baseCmd *BaseCommand) *cobra.Command
NewServoCommand returns a new instance of the servo command
func NewVitalCommand ¶ added in v0.2.0
func NewVitalCommand(baseCmd *BaseCommand) *cobra.Command
NewVitalCommand returns a new instance of the vital command
func PrettyPrintJSONBytes ¶
PrettyPrintJSONBytes prints the given byte array as pretty printed JSON
func PrettyPrintJSONObject ¶
func PrettyPrintJSONObject(obj interface{}) error
PrettyPrintJSONObject prints the given object as pretty printed JSON
func PrettyPrintJSONResponse ¶
func PrettyPrintJSONResponse(resp *resty.Response) error
PrettyPrintJSONResponse prints the given API response as pretty printed JSON
func PrettyPrintJSONString ¶
PrettyPrintJSONString prints the given string as pretty printed JSON
func PrettyPrintYAMLToString ¶ added in v0.2.0
PrettyPrintYAMLToString pretty formats the given YAML byte array, optionally including line numbers
func RangeOfValidJSONArgs ¶
func RangeOfValidJSONArgs(min int, max int) cobra.PositionalArgs
RangeOfValidJSONArgs ensures that the number of args are within the range and are all valid JSON
func SetJSONKeyPathValuesFromStringOnBytes ¶
SetJSONKeyPathValuesFromStringOnBytes sets a JSON dotted path expression of the form (this.key=value) to a new value in a JSON byte array
func SetJSONKeyPathValuesFromStringsOnBytes ¶
func SetJSONKeyPathValuesFromStringsOnBytes(jsonPathDescriptors []string, bytes []byte) ([]byte, error)
SetJSONKeyPathValuesFromStringsOnBytes sets an array of JSON dotted path expressions of the form (this.key=value) to a new value in a JSON byte array
Types ¶
type BaseCommand ¶
type BaseCommand struct {
// contains filtered or unexported fields
}
BaseCommand is the foundational command structure for the Opsani CLI It contains the root command for Cobra and is designed for embedding into other command structures to add subcommand functionality
func NewRootCommand ¶
func NewRootCommand() *BaseCommand
NewRootCommand returns a new instance of the root command for Opsani CLI
func (*BaseCommand) AccessToken ¶
func (cmd *BaseCommand) AccessToken() string
AccessToken returns the Opsani API access token
func (*BaseCommand) AllSettings ¶
func (cmd *BaseCommand) AllSettings() map[string]interface{}
AllSettings returns all configuration settings
func (*BaseCommand) Ask ¶
func (cmd *BaseCommand) Ask(qs []*survey.Question, response interface{}, opts ...survey.AskOpt) error
Ask is a wrapper for survey.AskOne that executes with the command's stdio
func (*BaseCommand) AskOne ¶
func (cmd *BaseCommand) AskOne(p survey.Prompt, response interface{}, opts ...survey.AskOpt) error
AskOne is a wrapper for survey.AskOne that executes with the command's stdio
func (*BaseCommand) BaseURL ¶
func (cmd *BaseCommand) BaseURL() string
BaseURL returns the Opsani API base URL The BaseURL is determined by config (args/env), active profile, or default
func (*BaseCommand) BaseURLHostnameAndPort ¶
func (cmd *BaseCommand) BaseURLHostnameAndPort() string
BaseURLHostnameAndPort returns the hostname and port portion of Opsani base URL for summary display
func (*BaseCommand) ColorOutput ¶
func (cmd *BaseCommand) ColorOutput() bool
ColorOutput indicates if ANSI colors will be used for output
func (*BaseCommand) DebugModeEnabled ¶
func (cmd *BaseCommand) DebugModeEnabled() bool
DebugModeEnabled returns a boolean value indicating if debugging is enabled
func (*BaseCommand) DefaultConfigFile ¶
func (baseCmd *BaseCommand) DefaultConfigFile() string
DefaultConfigFile returns the full path to the default Opsani configuration file
func (*BaseCommand) DefaultConfigPath ¶
func (baseCmd *BaseCommand) DefaultConfigPath() string
DefaultConfigPath returns the path to the directory storing the Opsani configuration file
func (*BaseCommand) DefaultConfigType ¶
func (baseCmd *BaseCommand) DefaultConfigType() string
DefaultConfigType returns the
func (*BaseCommand) ErrOrStderr ¶ added in v0.2.0
func (cmd *BaseCommand) ErrOrStderr() io.Writer
ErrOrStderr returns output to stdout.
func (*BaseCommand) Flags ¶
func (cmd *BaseCommand) Flags() *pflag.FlagSet
Flags returns the complete FlagSet that applies to this command (local and persistent declared here and by all parents).
func (*BaseCommand) GetAllSettings ¶
func (baseCmd *BaseCommand) GetAllSettings() map[string]interface{}
GetAllSettings returns all configuration settings
func (*BaseCommand) GetBaseURL ¶
func (baseCmd *BaseCommand) GetBaseURL() string
GetBaseURL returns the Opsani API base URL
func (*BaseCommand) GetBaseURLHostnameAndPort ¶
func (baseCmd *BaseCommand) GetBaseURLHostnameAndPort() string
GetBaseURLHostnameAndPort returns the hostname and port portion of Opsani base URL for summary display
func (*BaseCommand) GetOptimizerComponents ¶ added in v0.2.0
func (baseCmd *BaseCommand) GetOptimizerComponents() (orgSlug string, appSlug string)
GetAppComponents returns the organization name and app ID as separate path components
func (*BaseCommand) InitConfigRunE ¶
func (baseCmd *BaseCommand) InitConfigRunE(cmd *cobra.Command, args []string) error
InitConfigRunE initializes client configuration and aborts execution if an error is encountered
func (*BaseCommand) IsInitialized ¶
func (baseCmd *BaseCommand) IsInitialized() bool
IsInitialized returns a boolean value that indicates if the client has been initialized
func (*BaseCommand) LoadProfile ¶
func (cmd *BaseCommand) LoadProfile() (*Profile, error)
LoadProfile loads the configuration for the specified profile
func (*BaseCommand) NewAPIClient ¶
func (baseCmd *BaseCommand) NewAPIClient() *opsani.Client
NewAPIClient returns an Opsani API client configured using the active configuration
func (*BaseCommand) Optimizer ¶ added in v0.2.0
func (cmd *BaseCommand) Optimizer() string
Optimizer returns the target Opsani app
func (*BaseCommand) OptimizerComponents ¶ added in v0.2.0
func (cmd *BaseCommand) OptimizerComponents() (orgSlug string, appSlug string)
OptimizerComponents returns the organization name and app ID as separate path components
func (*BaseCommand) OutOrStdout ¶
func (cmd *BaseCommand) OutOrStdout() io.Writer
OutOrStdout returns output to stdout.
func (*BaseCommand) PersistentFlags ¶
func (cmd *BaseCommand) PersistentFlags() *pflag.FlagSet
PersistentFlags returns the persistent FlagSet specifically set in the current command.
func (*BaseCommand) PrettyPrintJSONBytes ¶
func (cmd *BaseCommand) PrettyPrintJSONBytes(bytes []byte) error
PrettyPrintJSONBytes prints the given byte array as pretty printed JSON
func (*BaseCommand) PrettyPrintJSONObject ¶
func (cmd *BaseCommand) PrettyPrintJSONObject(obj interface{}) error
PrettyPrintJSONObject prints the given object as pretty printed JSON
func (*BaseCommand) PrettyPrintJSONResponse ¶
func (cmd *BaseCommand) PrettyPrintJSONResponse(resp *resty.Response) error
PrettyPrintJSONResponse prints the given API response as pretty printed JSON
func (*BaseCommand) PrettyPrintJSONString ¶
func (cmd *BaseCommand) PrettyPrintJSONString(str string) error
PrettyPrintJSONString prints the given string as pretty printed JSON
func (*BaseCommand) PrettyPrintYAML ¶
func (cmd *BaseCommand) PrettyPrintYAML(bytes []byte, lineNumbers bool) error
PrettyPrintYAML pretty prints the given YAML byte array, optionally including line numbers
func (*BaseCommand) PrettyPrintYAMLObject ¶
func (cmd *BaseCommand) PrettyPrintYAMLObject(obj interface{}) error
PrettyPrintYAMLObject pretty prints the given object marshalled into YAML
func (*BaseCommand) Print ¶
func (cmd *BaseCommand) Print(i ...interface{})
Print is a convenience method to Print to the defined output, fallback to Stderr if not set.
func (*BaseCommand) PrintErr ¶
func (cmd *BaseCommand) PrintErr(i ...interface{})
PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set.
func (*BaseCommand) PrintErrf ¶
func (cmd *BaseCommand) PrintErrf(format string, i ...interface{})
PrintErrf is a convenience method to Printf to the defined Err output, fallback to Stderr if not set.
func (*BaseCommand) PrintErrln ¶
func (cmd *BaseCommand) PrintErrln(i ...interface{})
PrintErrln is a convenience method to Println to the defined Err output, fallback to Stderr if not set.
func (*BaseCommand) Printf ¶
func (cmd *BaseCommand) Printf(format string, i ...interface{})
Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set.
func (*BaseCommand) Println ¶
func (cmd *BaseCommand) Println(i ...interface{})
Println is a convenience method to Println to the defined output, fallback to Stderr if not set.
func (*BaseCommand) RequestTracingEnabled ¶
func (cmd *BaseCommand) RequestTracingEnabled() bool
RequestTracingEnabled returns a boolean value indicating if request tracing is enabled
func (*BaseCommand) RequireConfigFileFlagToExistRunE ¶
func (baseCmd *BaseCommand) RequireConfigFileFlagToExistRunE(cmd *cobra.Command, args []string) error
RequireConfigFileFlagToExistRunE aborts command execution with an error if the config file specified via a flag does not exist
func (*BaseCommand) RequireInitRunE ¶
func (baseCmd *BaseCommand) RequireInitRunE(cmd *cobra.Command, args []string) error
RequireInitRunE aborts command execution with an error if the client is not initialized
func (*BaseCommand) RootCobraCommand ¶
func (cmd *BaseCommand) RootCobraCommand() *cobra.Command
RootCobraCommand returns the root Cobra command of the Opsani CLI command
func (*BaseCommand) SetColorOutput ¶
func (cmd *BaseCommand) SetColorOutput(colorOutput bool)
SetColorOutput sets whether or not ANSI colors will be used for output
func (*BaseCommand) Viper ¶
func (cmd *BaseCommand) Viper() *viper.Viper
Viper returns the Viper configuration object underlying the Opsani CLI command
type DockerComposeServoDriver ¶ added in v0.2.0
type DockerComposeServoDriver struct {
// contains filtered or unexported fields
}
DockerComposeServoDriver supports interaction with servos deployed via Docker Compose
func (*DockerComposeServoDriver) Config ¶ added in v0.2.0
func (c *DockerComposeServoDriver) Config() error
Config returns the servo config file
func (*DockerComposeServoDriver) Logs ¶ added in v0.2.0
func (c *DockerComposeServoDriver) Logs(logsArgs servoLogsArgs) error
Logs outputs the servo logs
func (*DockerComposeServoDriver) Restart ¶ added in v0.2.0
func (c *DockerComposeServoDriver) Restart() error
Restart restrarts the servo
func (*DockerComposeServoDriver) Shell ¶ added in v0.2.0
func (c *DockerComposeServoDriver) Shell() error
Shell establishes an interactive shell with the servo
func (*DockerComposeServoDriver) Start ¶ added in v0.2.0
func (c *DockerComposeServoDriver) Start() error
Start starts the servo
func (*DockerComposeServoDriver) Status ¶ added in v0.2.0
func (c *DockerComposeServoDriver) Status() error
Status outputs the servo status
func (*DockerComposeServoDriver) Stop ¶ added in v0.2.0
func (c *DockerComposeServoDriver) Stop() error
Stop stops the servo
type FlagError ¶
type FlagError struct {
Err error
}
FlagError is the kind of error raised in flag processing
type KubernetesServoDriver ¶ added in v0.2.0
type KubernetesServoDriver struct {
// contains filtered or unexported fields
}
KubernetesServoDriver supports interaction with servos deployed via Kubernetes
func (*KubernetesServoDriver) Config ¶ added in v0.2.0
func (c *KubernetesServoDriver) Config() error
Config outputs the servo config
func (*KubernetesServoDriver) Logs ¶ added in v0.2.0
func (c *KubernetesServoDriver) Logs(logsArgs servoLogsArgs) error
Logs outputs the servo logs
func (*KubernetesServoDriver) Restart ¶ added in v0.2.0
func (c *KubernetesServoDriver) Restart() error
Restart restarts the servo
func (*KubernetesServoDriver) Shell ¶ added in v0.2.0
func (c *KubernetesServoDriver) Shell() error
Shell establishes an interactive shell with the servo
func (*KubernetesServoDriver) Start ¶ added in v0.2.0
func (c *KubernetesServoDriver) Start() error
Start starts the servo
func (*KubernetesServoDriver) Status ¶ added in v0.2.0
func (c *KubernetesServoDriver) Status() error
Status outputs the servo status
func (*KubernetesServoDriver) Stop ¶ added in v0.2.0
func (c *KubernetesServoDriver) Stop() error
Stop stops the servo
type Profile ¶
type Profile struct { Name string `yaml:"name" mapstructure:"name" json:"name"` Optimizer string `yaml:"optimizer" mapstructure:"optimizer" json:"optimizer"` Token string `yaml:"token" mapstructure:"token" json:"token"` BaseURL string `yaml:"base_url,omitempty" mapstructure:"base_url,omitempty" json:"base_url,omitempty"` Servo Servo `yaml:"servo,omitempty" mapstructure:"servo,omitempty" json:"servo,omitempty"` }
Profile represents an Opsani app, token, and base URL
func (Profile) Organization ¶ added in v0.2.0
Organization returns the domain of the organization that owns the app
type ProfileRegistry ¶
type ProfileRegistry struct {
// contains filtered or unexported fields
}
ProfileRegistry provides an interface for managing configuration of app profiles
func NewProfileRegistry ¶
func NewProfileRegistry(viper *viper.Viper) (*ProfileRegistry, error)
NewProfileRegistry returns a new registry of configured app profiles
func (*ProfileRegistry) AddProfile ¶
func (pr *ProfileRegistry) AddProfile(profile Profile) error
AddProfile adds a Profile to the config
func (*ProfileRegistry) ProfileNamed ¶
func (pr *ProfileRegistry) ProfileNamed(name string) *Profile
ProfileNamed named returns the Profile with the given name
func (*ProfileRegistry) Profiles ¶
func (pr *ProfileRegistry) Profiles() []*Profile
Profiles returns the Profiles in the configuration
func (*ProfileRegistry) RemoveProfile ¶
func (pr *ProfileRegistry) RemoveProfile(profile Profile) error
RemoveProfile removes a Profile from the config
func (*ProfileRegistry) RemoveProfileNamed ¶
func (pr *ProfileRegistry) RemoveProfileNamed(name string) error
RemoveProfileNamed removes a Profile from the config with the given name
func (*ProfileRegistry) Save ¶
func (pr *ProfileRegistry) Save() error
Save the data back to the config
func (*ProfileRegistry) Set ¶
func (pr *ProfileRegistry) Set(profiles []Profile)
Set sets the Profile on the registry
type RunEFunc ¶
RunEFunc is a Cobra Run function that returns an error
func ReduceRunEFuncs ¶
ReduceRunEFuncs reduces a list of Cobra run functions that return an error into a single aggregate run function
type RunFunc ¶
RunFunc is a Cobra Run function
func ReduceRunFuncs ¶
ReduceRunFuncs reduces a list of Cobra run functions into a single aggregate run function
type Servo ¶
type Servo struct { Type string `yaml:"type" mapstructure:"type"` // Docker Compose User string `yaml:"user,omitempty" mapstructure:"user,omitempty"` Host string `yaml:"host,omitempty" mapstructure:"host,omitempty"` Port string `yaml:"port,omitempty" mapstructure:"port,omitempty"` Path string `yaml:"path,omitempty" mapstructure:"path,omitempty"` Bastion string `yaml:"bastion,omitempty" mapstructure:"bastion,omitempty"` // Kubernetes Namespace string `yaml:"namespace,omitempty" mapstructure:"namespace,omitempty"` Deployment string `yaml:"deployment,omitempty" mapstructure:"deployment,omitempty"` }
Servo represents a deployed Servo assembly running somewhere
func (Servo) BastionComponents ¶
BastionComponents splits the bastion host identifier into user and host components
func (Servo) Description ¶ added in v0.2.0
Description returns a textual description of the servo
func (Servo) DisplayHost ¶
DisplayHost returns the hostname and port if different from 22
func (Servo) DisplayPath ¶
DisplayPath returns the path that the Servo is installed at
func (Servo) HostAndPort ¶
HostAndPort returns a string with the host and port when different from 22
type ServoDriver ¶ added in v0.2.0
type ServoDriver interface { Status() error // TODO: pass io.Writer for output, ssh interface for bastion Start() error Stop() error Restart() error Logs(args servoLogsArgs) error Config() error Shell() error }
ServoDriver defines a standard interface for interacting with servo deployments
func NewServoDriver ¶ added in v0.2.0
func NewServoDriver(servo Servo) (ServoDriver, error)
NewServoDriver creates and returns an appropriate commander for a given servo