Documentation
¶
Index ¶
- Variables
- func CommandInterfaceBuilder(command string, args ...string) []interface{}
- type Connection
- func (connection *Connection) Clone() Connection
- func (connection *Connection) CommandBuilder(command string, args ...string) []interface{}
- func (connection *Connection) DockerCommandBuilder(cmd string, args ...string) []interface{}
- func (connection *Connection) DockerGetContainerId(containerName string) string
- func (connection *Connection) GetType() string
- func (connection *Connection) IsEmpty() 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) ShellCommandBuilder(args ...string) []interface{}
- func (connection *Connection) SshCommandBuilder(command string, args ...string) []interface{}
- func (connection *Connection) SshConnectionHostnameString() string
- func (connection *Connection) String() string
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 Connection ¶
type Connection struct {
// Type of command
// local: for local execution
// ssh: for execution using ssh
// docker: for execution using a docker container
Type string
// Hostname for ssh execution
Hostname string
// Username for ssh execution
User string
// Password for ssh execution
Password string
// Docker container ID for execution inside docker container
// compose:name for automatic docker-compose lookup (docker-compose.yml must be in working directory)
Docker string
// Working directory for eg. ssh
WorkDir string
// Environment variables
Environment map[string]string
}
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(containerName 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) IsEmpty ¶
func (connection *Connection) IsEmpty() bool
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) 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