Documentation
¶
Index ¶
- Variables
- func CommandInterfaceBuilder(command string, args ...string) []interface{}
- type Argument
- func (argument *Argument) Clear()
- func (argument *Argument) Clone() *Argument
- func (argument *Argument) GetEnvironment(name string) (string, error)
- func (argument *Argument) GetOption(name string) (string, error)
- func (argument *Argument) HasEnvironment(name string) bool
- func (argument *Argument) HasOption(name string) bool
- func (argument *Argument) IsEmpty() bool
- func (argument *Argument) IsSimpleValue() bool
- func (argument *Argument) ParseDsn() error
- func (argument *Argument) ParseUrl() error
- func (argument *Argument) ParseUserHost() error
- func (argument *Argument) Set(value string) error
- type Connection
- func (connection *Connection) Clone() (conn *Connection)
- func (connection *Connection) CommandBuilder(command string, args ...string) []interface{}
- func (connection *Connection) DockerCommandBuilder(cmd string, args ...string) []interface{}
- func (connection *Connection) DockerGetContainerId() string
- func (connection *Connection) DockerGetEnvironment() map[string]string
- func (connection *Connection) GetType() string
- func (connection *Connection) IsDocker() bool
- func (connection *Connection) IsEmpty() (status bool)
- func (connection *Connection) IsSsh() bool
- func (connection *Connection) LocalCommandBuilder(cmd string, args ...string) []interface{}
- func (connection *Connection) RawCommandBuilder(command string, args ...string) []interface{}
- func (connection *Connection) RawShellCommandBuilder(args ...string) []interface{}
- func (connection *Connection) SetDocker(configuration string) error
- func (connection *Connection) SetSsh(configuration string) error
- func (connection *Connection) ShellCommandBuilder(args ...string) []interface{}
- func (connection *Connection) SshCommandBuilder(command string, args ...string) []interface{}
- func (connection *Connection) SshConnectionHostnameString() string
- func (connection *Connection) String() string
- type Environment
Constants ¶
This section is empty.
Variables ¶
var ( // Default SSH options ConnectionSshArguments = []string{"-oBatchMode=yes -oPasswordAuthentication=no"} // Default Docker options ConnectionDockerArguments = []string{"exec", "-i"} )
Functions ¶
func CommandInterfaceBuilder ¶
Convert string arguments to interfaces for shell.Cmd usage
Types ¶
type Argument ¶
type Argument struct { Scheme string Hostname string Port string Username string Password string Raw string Options map[string]string Environment map[string]string Workdir string // contains filtered or unexported fields }
func ParseArgument ¶
func (*Argument) GetEnvironment ¶
func (*Argument) HasEnvironment ¶
func (*Argument) IsSimpleValue ¶
func (*Argument) ParseUserHost ¶
type Connection ¶
type Connection struct { // Type of command Type string Ssh Argument Docker Argument // Working directory for eg. ssh Workdir string // Environment variables Environment Environment // contains filtered or unexported fields }
func (*Connection) Clone ¶
func (connection *Connection) Clone() (conn *Connection)
Clone connection
func (*Connection) CommandBuilder ¶
func (connection *Connection) CommandBuilder(command string, args ...string) []interface{}
Build command for shell.Cmd usage will automatically check if SSH'ed or docker exec will be used
func (*Connection) DockerCommandBuilder ¶
func (connection *Connection) DockerCommandBuilder(cmd string, args ...string) []interface{}
Create dockerized command
func (*Connection) DockerGetContainerId ¶
func (connection *Connection) DockerGetContainerId() string
Detect docker container id with docker-compose support
func (*Connection) DockerGetEnvironment ¶
func (connection *Connection) DockerGetEnvironment() map[string]string
Detect docker container id with docker-compose support
func (*Connection) GetType ¶
func (connection *Connection) GetType() string
Return type of connection, will guess type based on settings if type is empty
func (*Connection) IsDocker ¶
func (connection *Connection) IsDocker() bool
Checks if connection is using Docker
func (*Connection) IsEmpty ¶
func (connection *Connection) IsEmpty() (status bool)
Check if connection has set any settings
func (*Connection) IsSsh ¶
func (connection *Connection) IsSsh() bool
Checks if connection is using SSH
func (*Connection) LocalCommandBuilder ¶
func (connection *Connection) LocalCommandBuilder(cmd string, args ...string) []interface{}
Create local command
func (*Connection) RawCommandBuilder ¶
func (connection *Connection) RawCommandBuilder(command string, args ...string) []interface{}
Build raw command (not automatically quoted) for shell.Cmd usage will automatically check if SSH'ed or docker exec will be used
func (*Connection) RawShellCommandBuilder ¶
func (connection *Connection) RawShellCommandBuilder(args ...string) []interface{}
Run raw command (not automatically quoted) using an shell (eg. for running pipes or multiple commands) will automatically check if SSH'ed or docker exec will be used
func (*Connection) SetDocker ¶
func (connection *Connection) SetDocker(configuration string) error
Set docker configuration using string (query, dsn, user@host..)
func (*Connection) SetSsh ¶
func (connection *Connection) SetSsh(configuration string) error
Set SSH configuration using string (query, dsn, user@host..)
func (*Connection) ShellCommandBuilder ¶
func (connection *Connection) ShellCommandBuilder(args ...string) []interface{}
Run command using an shell (eg. for running pipes or multiple commands) will automatically check if SSH'ed or docker exec will be used
func (*Connection) SshCommandBuilder ¶
func (connection *Connection) SshCommandBuilder(command string, args ...string) []interface{}
Create SSH'ed command
func (*Connection) SshConnectionHostnameString ¶
func (connection *Connection) SshConnectionHostnameString() string
Build ssh connection string (eg. user@hostname)
func (*Connection) String ¶
func (connection *Connection) String() string
Create human readable string representation of command
type Environment ¶
func (*Environment) AddMap ¶
func (env *Environment) AddMap(vars map[string]string)
Add environment map (adds/overwrites)
func (*Environment) GetMap ¶
func (env *Environment) GetMap() map[string]string
Get all environment vars as map
func (*Environment) Set ¶
func (env *Environment) Set(name string, value string)
Set one environment variable
func (*Environment) SetMap ¶
func (env *Environment) SetMap(vars map[string]string)
Set environment map (absolute)