command

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2018 License: BSD-2-Clause Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Run a script on the local machine.
	Local = iota

	// Remote is a command that combines a copy and a sudo command.
	Remote

	// Copy a file from the local machine to the target instance.
	Copy

	// Run a script on the target machine as with super user priviledges.
	Sudo

	// Output a message to the console
	Message
)

Variables

This section is empty.

Functions

func CopyTo

func CopyTo(c Command) bool

CopyTo copies the give source script to the destination on the given instance. It returns true on success. Command output is send as messages to the console.

func CopyToWithOutput

func CopyToWithOutput(c Command) ([]byte, error)

CopyToWithOutput copies the give source script to the destination on the given instance. The command output and an error are returned.

func Run

func Run(c []Command, i resource.Instance) bool

Run runs a set of commands. Remote and copy commands are directed to the given instance. If the instance is nil, the set of commands should all be local. It returns true on success. Command output is send as messages to the console.

func RunAsRoot

func RunAsRoot(c []Command, i resource.Instance) bool

RunAsRoot runs a set of commands as root. Remote and copy commands are directed to the given instance. If the instance is nil, the set of commands should all be local. It returns true on success. Command output is send as messages to the console.

func RunLocal

func RunLocal(c Command) bool

RunLocal runs the given command as a local command. It returns true on success. Command output is send as messages to the console.

func RunLocalWithOutput

func RunLocalWithOutput(c Command) ([]byte, error)

RunLocalWithOutput runs the given command as a local command. The command output and an error are returned.

func RunQuiet

func RunQuiet(c []Command, i resource.Instance) bool

RunQuiet runs a set of commands the same as Run, however messaging to the console is disabled for the run.

func RunQuietAsRoot

func RunQuietAsRoot(c []Command, i resource.Instance) bool

RunQuietAsRoot runs a set of commands the same as RunAsRoot, however messaging to the console is disabled for the run.

func RunRemote

func RunRemote(c Command) bool

RunRemote copies the source script from the given command to the destination on the instance. It then runs the script on the instance. It returns true on success. Command output is send as messages to the console.

func RunRemoteWithOutput

func RunRemoteWithOutput(c Command) ([]byte, error)

RunRemoteWithOutput copies the source script from the given command to the destination on the instance. It then runs the script on the instance. The command output and an error are returned.

func RunSudo

func RunSudo(c Command) bool

RunSudo runs the given command on the instance under sudo. It returns true on success. Command output is send as messages to the console.

func RunSudoWithOutput

func RunSudoWithOutput(c Command) ([]byte, error)

RunSudoWithOutput runs the given command on the instance under sudo. The command output and an error are returned.

func RunWithOutput

func RunWithOutput(c []Command, i resource.Instance) ([]byte, error)

RunWithOutput runs a set of commands. Remote and copy commands are directed to the given instance. If the instance is nil, the set of commands should all be local. The command output and an error are returned.

func RunWithOutputAsRoot

func RunWithOutputAsRoot(c []Command, i resource.Instance) ([]byte, error)

RunWithOutputAsRoot runs a set of commands as root. Remote and copy commands are directed to the given instance. If the instance is nil, the set of commands should all be local. The command output and an error are returned.

Types

type Command

type Command struct {
	// Type is required in a command set and not needed it an individual run command.
	// These are Local, Remote, Copy and Sudo.
	Type cType

	// Instance is required in an individual run command and not needed in a command set.
	Instance resource.Instance

	// The description of the command. This will be send as a message to the console.
	Desc string

	// The source of the command. For local and sudo type of commands, this is the
	// path to the command to be executed. For copy and remote commands this is the
	// path of the script to copy to the target instance.
	Src string

	// The destination of the command. This is unneeded for local and sudo commands.
	// For remote and copy commands, this is the location on the target instance
	// where the script will be copied to
	Dest string

	// The arguments passed to the command. This is unneeded for the copy command
	Args []string
	// contains filtered or unexported fields
}

The Command structure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL