Documentation
¶
Index ¶
- func ConsumePassword(username string, password string) (string, error)
- func EstablishSFTPConnection(sshClient *ssh.Client) (*sftp.Client, error)
- func EstablishSSHConnection(username string, password string, host string, ignoreHostKeyCheck bool, ...) (*ssh.Client, error)
- func TransferScript(scriptPath string, client *sftp.Client) (string, error)
- type Options
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsumePassword ¶
ConsumePassword will prompt the user for a password, reads it from STDIN, and returns it.
func EstablishSFTPConnection ¶
EstablishSFTPConnection returns an sftp client for use
Types ¶
type Options ¶
type Options struct {
// Command that will be ran, if provided
Command string
// if true, delete the script after execution
Cleanup bool
// Whether or not to verify host keys
IgnoreHostkeyCheck bool
// Host to execute on
Host string
// User to execute as
User string
// Password for User
Password string
// A custom private key to use
PrivateKey string
// A script to be ran, if provided
Script string
}
Options contains information on the the command to be ran
func (*Options) RunCommand ¶
RunCommand is a wrapper around establishing the ssh connection and then calling the RunSSHCommand
type Result ¶
type Result struct {
// The command that was ran.
CommandRan string `json:"command" yaml:"command"`
// stdout from the command.
Stdout string `json:"result" yaml:"result"`
// Host command ran on
Host string `json:"host" yaml:"host"`
}
Result contains various information about what a command returned.
func RunSSHCommand ¶
RunSSHCommand runs the command and records its information in a CommandResult
func (*Result) PrintHostOutput ¶
PrintHostOutput formats the host and stdout nicely.
Click to show internal directories.
Click to hide internal directories.