Documentation ¶
Index ¶
- Variables
- func AppHostRoot(appName string) string
- func AppRoot(appName string) string
- func AskForDestructiveConfirmation(name string, objectType string) error
- func CatFile(filename string)
- func CloneAppData(pluginName string, oldAppName string, newAppName string) error
- func CollectReport(appName string, infoFlag string, flags map[string]ReportFunc) map[string]string
- func CommandPropertySet(pluginName, appName, property, value string, properties map[string]string, ...)
- func CommandUsage(helpHeader string, helpContent string)
- func ContainerExists(containerID string) bool
- func ContainerIsRunning(containerID string) bool
- func ContainerRemove(containerID string) bool
- func ContainerStart(containerID string) bool
- func ContainerWait(containerID string) bool
- func ContainerWaitTilReady(containerID string, timeout time.Duration) error
- func Copy(src, dst string) error
- func CopyFromImage(appName string, image string, source string, destination string) error
- func CreateAppDataDirectory(pluginName, appName string) error
- func CreateDataDirectory(pluginName string) error
- func DirectoryExists(filename string) bool
- func DockerBin() string
- func DockerCleanup(appName string, forceCleanup bool) error
- func DockerContainerCreate(image string, containerCreateArgs []string) (string, error)
- func DockerFilterContainers(filters []string) ([]string, error)
- func DockerFilterImages(filters []string) ([]string, error)
- func DockerInspect(containerOrImageID, format string) (output string, err error)
- func DockerRemoveContainers(containerIDs []string)
- func DokkuApps() ([]string, error)
- func EnvWrap(fn func() error, environ map[string]string) error
- func FileExists(filename string) bool
- func FileToSlice(filename string) (lines []string, err error)
- func GetAppContainerIDs(appName string, containerType string) ([]string, error)
- func GetAppDataDirectory(pluginName string, appName string) string
- func GetAppImageName(appName, imageTag, imageRepo string) (imageName string)
- func GetAppImageRepo(appName string) string
- func GetAppRunningContainerIDs(appName string, containerType string) ([]string, error)
- func GetAppScheduler(appName string) string
- func GetDataDirectory(pluginName string) string
- func GetDeployingAppImageName(appName, imageTag, imageRepo string) (string, error)
- func GetGlobalScheduler() string
- func GetRunningImageTag(appName string, imageTag string) (string, error)
- func GetWorkingDir(appName string, image string) string
- func GetenvWithDefault(key string, defaultValue string) (val string)
- func IsAbsPath(path string) bool
- func IsComposeInstalled() bool
- func IsDeployed(appName string) bool
- func IsImageCnbBased(image string) bool
- func IsImageHerokuishBased(image string, appName string) bool
- func IsValidAppName(appName string) error
- func ListDanglingImages(appName string) ([]string, error)
- func ListFilesWithPrefix(path string, prefix string) []string
- func Log(text string)
- func LogDebug(text string)
- func LogExclaim(text string)
- func LogFail(text string)
- func LogFailQuiet(text string)
- func LogFailWithError(err error)
- func LogFailWithErrorQuiet(err error)
- func LogInfo1(text string)
- func LogInfo1Quiet(text string)
- func LogInfo2(text string)
- func LogInfo2Quiet(text string)
- func LogQuiet(text string)
- func LogStderr(text string)
- func LogVerbose(text string)
- func LogVerboseQuiet(text string)
- func LogVerboseQuietContainerLogs(containerID string)
- func LogVerboseQuietContainerLogsTail(containerID string, lines int, tail bool)
- func LogVerboseStderr(text string)
- func LogVerboseStderrQuiet(text string)
- func LogWarn(text string)
- func MigrateAppDataDirectory(pluginName string, oldAppName string, newAppName string) error
- func MustGetEnv(key string) (val string)
- func ParseReportArgs(pluginName string, arguments []string) ([]string, string, error)
- func ParseScaleOutput(b []byte) (map[string]int32, error)
- func PlugnTriggerExists(triggerName string) bool
- func PropertyClone(pluginName string, oldAppName string, newAppName string) error
- func PropertyDelete(pluginName string, appName string, property string) error
- func PropertyDestroy(pluginName string, appName string) error
- func PropertyExists(pluginName string, appName string, property string) bool
- func PropertyGet(pluginName string, appName string, property string) string
- func PropertyGetAll(pluginName string, appName string) (map[string]string, error)
- func PropertyGetAllByPrefix(pluginName string, appName string, prefix string) (map[string]string, error)
- func PropertyGetDefault(pluginName, appName, property, defaultValue string) (val string)
- func PropertyListAdd(pluginName string, appName string, property string, value string, index int) error
- func PropertyListGet(pluginName string, appName string, property string) (lines []string, err error)
- func PropertyListGetByIndex(pluginName string, appName string, property string, index int) (propertyValue string, err error)
- func PropertyListGetByValue(pluginName string, appName string, property string, value string) (propertyValue string, err error)
- func PropertyListLength(pluginName string, appName string, property string) (length int, err error)
- func PropertyListRemove(pluginName string, appName string, property string, value string) error
- func PropertyListRemoveByPrefix(pluginName string, appName string, property string, prefix string) error
- func PropertyListSet(pluginName string, appName string, property string, value string, index int) error
- func PropertyListWrite(pluginName string, appName string, property string, values []string) error
- func PropertySetup(pluginName string) error
- func PropertyWrite(pluginName string, appName string, property string, value string) error
- func ReadFirstLine(filename string) (text string)
- func RemoveAppDataDirectory(pluginName, appName string) error
- func RemoveImages(imageIDs []string) error
- func ReportSingleApp(reportType string, appName string, infoFlag string, ...) error
- func RightPad(str string, length int, pad string) string
- func RunCommandAgainstAllApps(command parallelCommand, commandName string, parallelCount int) error
- func RunCommandAgainstAllAppsInParallel(command parallelCommand, commandName string, parallelCount int) error
- func RunCommandAgainstAllAppsSerially(command parallelCommand, commandName string) error
- func SetPermissions(input SetPermissionInput) error
- func SetupAppData(pluginName string) error
- func ShiftString(a []string) (string, []string)
- func StripInlineComments(text string) string
- func SuppressOutput(f errfunc) error
- func ToBool(s string) bool
- func ToInt(s string, defaultValue int) int
- func TouchFile(filename string) error
- func TriggerAppList(filtered bool) error
- func TriggerCorePostDeploy(appName string) error
- func TriggerInstall() error
- func TriggerPostAppCloneSetup(oldAppName string, newAppName string) error
- func TriggerPostAppRenameSetup(oldAppName string, newAppName string) error
- func TriggerPostDelete(appName string) error
- func UcFirst(str string) string
- func UnfilteredDokkuApps() ([]string, error)
- func VarArgs(arguments []string, skip int) []string
- func VerifyAppName(appName string) error
- func VerifyImage(image string) bool
- func WriteBytesToFile(input WriteBytesToFileInput) error
- func WriteSliceToFile(input WriteSliceToFileInput) error
- func WriteStringToFile(input WriteStringToFileInput) error
- type AppDoesNotExist
- type ErrWithExitCode
- type ExecCommandInput
- type ExecCommandResponse
- func CallExecCommand(input ExecCommandInput) (ExecCommandResponse, error)
- func CallExecCommandWithContext(ctx context.Context, input ExecCommandInput) (ExecCommandResponse, error)
- func CallPlugnTrigger(input PlugnTriggerInput) (ExecCommandResponse, error)
- func CallPlugnTriggerWithContext(ctx context.Context, input PlugnTriggerInput) (ExecCommandResponse, error)
- type PlugnTriggerInput
- type ReportFunc
- type SetPermissionInput
- type SftpCopyInput
- type SftpCopyResult
- type SftpCopyTask
- type SshCommandInput
- type SshResult
- type SshTask
- type WriteBytesToFileInput
- type WriteSliceToFileInput
- type WriteStringToFileInput
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultProperties is a map of all valid common properties with corresponding default property values DefaultProperties = map[string]string{ "deployed": "false", } // GlobalProperties is a map of all valid global common properties GlobalProperties = map[string]bool{} )
Functions ¶
func AskForDestructiveConfirmation ¶
AskForDestructiveConfirmation checks for confirmation on destructive actions
func CloneAppData ¶
CloneAppData copies the data from one app to another
func CollectReport ¶
CollectReport iterates over a set of report functions to collect the :report output in parallel
func CommandPropertySet ¶
func CommandPropertySet(pluginName, appName, property, value string, properties map[string]string, globalProperties map[string]bool)
CommandPropertySet is a generic function that will set a property for a given plugin/app combination
func CommandUsage ¶
CommandUsage outputs help for a command
func ContainerExists ¶
ContainerExists checks to see if a container exists
func ContainerIsRunning ¶
ContainerIsRunning checks to see if a container is running
func ContainerRemove ¶
ContainerRemove runs 'docker container remove' against an existing container
func ContainerStart ¶
ContainerStart runs 'docker container start' against an existing container
func ContainerWait ¶
ContainerWait runs 'docker container wait' against an existing container
func ContainerWaitTilReady ¶
ContainerWaitTilReady will wait timeout seconds and then check if a container is running returning an error if it is not running at the end of the timeout
func Copy ¶
Copy copies a file/directory from src to dst. If the source is a file, it will also convert line endings to unix style
func CopyFromImage ¶
CopyFromImage copies a file from named image to destination
func CreateAppDataDirectory ¶
CreateAppDataDirectory creates a data directory for the given plugin/app combination with the correct permissions
func CreateDataDirectory ¶
CreateDataDirectory creates a data directory for the given plugin/app combination with the correct permissions
func DirectoryExists ¶
DirectoryExists returns if a path exists and is a directory
func DockerBin ¶
func DockerBin() string
DockerBin returns a string which contains a path to the current docker binary
func DockerCleanup ¶
DockerCleanup cleans up all exited/dead containers and removes all dangling images
func DockerContainerCreate ¶
DockerContainerCreate creates a new container and returns the container ID
func DockerFilterContainers ¶
DockerFilterContainers returns a slice of container IDs based on the passed in filters
func DockerFilterImages ¶
DockerFilterImages returns a slice of image IDs based on the passed in filters
func DockerInspect ¶
DockerInspect runs an inspect command with a given format against a container or image ID
func DockerRemoveContainers ¶
func DockerRemoveContainers(containerIDs []string)
DockerRemoveContainers will call `docker container rm` on the specified containers
func FileExists ¶
FileExists returns if a path exists and is a file
func FileToSlice ¶
FileToSlice reads in all the lines from a file into a string slice
func GetAppContainerIDs ¶
GetAppContainerIDs returns a list of docker container ids for given app and optional container_type
func GetAppDataDirectory ¶
GetAppDataDirectory returns the path to the data directory for the given plugin/app combination
func GetAppImageName ¶
GetAppImageName returns image identifier for a given app, tag tuple. validate if tag is presented
func GetAppImageRepo ¶
GetAppImageRepo is the central definition of a dokku image repo pattern
func GetAppRunningContainerIDs ¶
GetAppRunningContainerIDs return a list of running docker container ids for given app and optional container_type
func GetAppScheduler ¶
GetAppScheduler fetches the scheduler for a given application
func GetDataDirectory ¶
GetDataDirectory returns the path to the data directory for the specified plugin
func GetDeployingAppImageName ¶
GetDeployingAppImageName returns deploying image identifier for a given app, tag tuple. validate if tag is presented
func GetGlobalScheduler ¶
func GetGlobalScheduler() string
GetGlobalScheduler fetchs the global scheduler
func GetRunningImageTag ¶
GetRunningImageTag retrieves current deployed image tag for a given app
func GetWorkingDir ¶
GetWorkingDir returns the working directory for a given image
func GetenvWithDefault ¶
GetenvWithDefault returns env variable or defaultValue if it's not set
func IsComposeInstalled ¶
func IsComposeInstalled() bool
func IsDeployed ¶
IsDeployed returns true if given app has a running container
func IsImageCnbBased ¶
IsImageCnbBased returns true if app image is based on cnb
func IsImageHerokuishBased ¶
IsImageHerokuishBased returns true if app image is based on herokuish
func IsValidAppName ¶
IsValidAppName verifies that the app name matches naming restrictions
func ListDanglingImages ¶
ListDanglingImages lists all dangling image ids for a given app
func ListFilesWithPrefix ¶
ListFilesWithPrefix lists files within a given path that have a given prefix
func LogFail ¶
func LogFail(text string)
LogFail is the failure log formatter prints text to stderr and exits with status 1
func LogFailQuiet ¶
func LogFailQuiet(text string)
LogFailQuiet is the failure log formatter (with quiet option) prints text to stderr and exits with status 1
func LogFailWithError ¶
func LogFailWithError(err error)
LogFailWithError is the failure log formatter prints text to stderr and exits with the specified exit code
func LogFailWithErrorQuiet ¶
func LogFailWithErrorQuiet(err error)
LogFailWithErrorQuiet is the failure log formatter (with quiet option) prints text to stderr and exits with the specified exit code The error message is not printed if DOKKU_QUIET_OUTPUT has any value
func LogInfo1Quiet ¶
func LogInfo1Quiet(text string)
LogInfo1Quiet is the info1 header formatter (with quiet option)
func LogInfo2Quiet ¶
func LogInfo2Quiet(text string)
LogInfo2Quiet is the info2 header formatter (with quiet option)
func LogVerbose ¶
func LogVerbose(text string)
LogVerbose is the verbose log formatter prints indented text to stdout
func LogVerboseQuiet ¶
func LogVerboseQuiet(text string)
LogVerboseQuiet is the verbose log formatter prints indented text to stdout (with quiet option)
func LogVerboseQuietContainerLogs ¶
func LogVerboseQuietContainerLogs(containerID string)
LogVerboseQuietContainerLogs is the verbose log formatter for container logs
func LogVerboseQuietContainerLogsTail ¶
LogVerboseQuietContainerLogsTail is the verbose log formatter for container logs with tail mode enabled
func LogVerboseStderr ¶
func LogVerboseStderr(text string)
LogVerboseStderr is the verbose log formatter prints indented text to stderr
func LogVerboseStderrQuiet ¶
func LogVerboseStderrQuiet(text string)
LogVerboseStderrQuiet is the verbose log formatter prints indented text to stderr (with quiet option)
func MigrateAppDataDirectory ¶
MigrateAppDataDirectory migrates the data directory for one app to another
func MustGetEnv ¶
MustGetEnv returns env variable or fails if it's not set
func ParseReportArgs ¶
ParseReportArgs splits out flags from non-flags for input into report commands
func ParseScaleOutput ¶
ParseScaleOutput allows golang plugins to properly parse the output of ps-current-scale
func PlugnTriggerExists ¶
PlugnTriggerExists returns whether a plugin trigger exists (ignoring the existence of any within the 20_events plugin)
func PropertyClone ¶
PropertyClone clones a set of properties from one app to another
func PropertyDelete ¶
PropertyDelete deletes a property from the plugin properties for an app
func PropertyDestroy ¶
PropertyDestroy destroys the plugin properties for an app
func PropertyExists ¶
PropertyExists returns whether a property exists or not
func PropertyGet ¶
PropertyGet returns the value for a given property
func PropertyGetAll ¶
PropertyGetAll returns a map of all properties for a given app
func PropertyGetAllByPrefix ¶
func PropertyGetAllByPrefix(pluginName string, appName string, prefix string) (map[string]string, error)
PropertyGetAllByPrefix returns a map of all properties for a given app with a specified prefix
func PropertyGetDefault ¶
PropertyGetDefault returns the value for a given property with a specified default value
func PropertyListAdd ¶
func PropertyListAdd(pluginName string, appName string, property string, value string, index int) error
PropertyListAdd adds a property to a list at an optionally specified index
func PropertyListGet ¶
func PropertyListGet(pluginName string, appName string, property string) (lines []string, err error)
PropertyListGet returns a property list
func PropertyListGetByIndex ¶
func PropertyListGetByIndex(pluginName string, appName string, property string, index int) (propertyValue string, err error)
PropertyListGetByIndex returns an entry within property list by index
func PropertyListGetByValue ¶
func PropertyListGetByValue(pluginName string, appName string, property string, value string) (propertyValue string, err error)
PropertyListGetByValue returns an entry within property list by value
func PropertyListLength ¶
PropertyListLength returns the length of a property list
func PropertyListRemove ¶
PropertyListRemove removes a value from a property list
func PropertyListRemoveByPrefix ¶
func PropertyListRemoveByPrefix(pluginName string, appName string, property string, prefix string) error
PropertyListRemoveByPrefix removes a value by prefix from a property list
func PropertyListSet ¶
func PropertyListSet(pluginName string, appName string, property string, value string, index int) error
PropertyListSet sets a value within a property list at a specified index
func PropertyListWrite ¶
PropertyListWrite completely rewrites a list property
func PropertySetup ¶
PropertySetup creates the plugin config root
func PropertyWrite ¶
PropertyWrite writes a value for a given application property
func ReadFirstLine ¶
ReadFirstLine gets the first line of a file that has contents and returns it if there are no contents, an empty string is returned will also return an empty string if the file does not exist
func RemoveAppDataDirectory ¶
RemoveAppDataDirectory removes the path to the data directory for the given plugin/app combination
func ReportSingleApp ¶
func ReportSingleApp(reportType string, appName string, infoFlag string, infoFlags map[string]string, infoFlagKeys []string, format string, trimPrefix bool, uppercaseFirstCharacter bool) error
ReportSingleApp is an internal function that displays a report for an app
func RunCommandAgainstAllApps ¶
RunCommandAgainstAllApps runs a given parallelCommand against all apps
func RunCommandAgainstAllAppsInParallel ¶
func RunCommandAgainstAllAppsInParallel(command parallelCommand, commandName string, parallelCount int) error
RunCommandAgainstAllAppsInParallel runs a given parallelCommand against all apps in parallel
func RunCommandAgainstAllAppsSerially ¶
RunCommandAgainstAllAppsSerially runs a given parallelCommand against all apps serially
func SetPermissions ¶
func SetPermissions(input SetPermissionInput) error
SetPermissions sets the proper owner and filemode for a given file
func SetupAppData ¶
SetupAppData ensures each app has a data directory
func ShiftString ¶
ShiftString removes the first and returns that entry as well as the rest of the list
func StripInlineComments ¶
StripInlineComments removes bash-style comment from input line
func SuppressOutput ¶
func SuppressOutput(f errfunc) error
SuppressOutput suppresses the output of a function unless there is an error
func TriggerAppList ¶
TriggerAppList outputs each app name to stdout on a newline
func TriggerCorePostDeploy ¶
TriggerCorePostDeploy associates the container with a specified network
func TriggerInstall ¶
func TriggerInstall() error
TriggerInstall runs the install step for the common plugin
func TriggerPostAppCloneSetup ¶
TriggerPostAppCloneSetup copies common files
func TriggerPostAppRenameSetup ¶
TriggerPostAppRenameSetup renames common files
func TriggerPostDelete ¶
TriggerPostDelete destroys the common property for a given app container
func UnfilteredDokkuApps ¶
UnfilteredDokkuApps returns an unfiltered list of all local apps
func VerifyAppName ¶
VerifyAppName checks if an app conforming to either the old or new naming conventions exists
func VerifyImage ¶
VerifyImage returns true if docker image exists in local repo
func WriteBytesToFile ¶
func WriteBytesToFile(input WriteBytesToFileInput) error
WriteBytesToFile writes a byte array to a file
func WriteSliceToFile ¶
func WriteSliceToFile(input WriteSliceToFileInput) error
WriteSliceToFile writes a slice of strings to a file
func WriteStringToFile ¶
func WriteStringToFile(input WriteStringToFileInput) error
WriteStringToFile writes a string to a file
Types ¶
type AppDoesNotExist ¶
type AppDoesNotExist struct {
// contains filtered or unexported fields
}
AppDoesNotExist wraps error to include the app name and is used to distinguish between a normal error and an error where the app is missing
func (*AppDoesNotExist) Error ¶
func (err *AppDoesNotExist) Error() string
Error returns a standard non-existent app error
func (*AppDoesNotExist) ExitCode ¶
func (err *AppDoesNotExist) ExitCode() int
ExitCode returns an exit code to use in case this error bubbles up into an os.Exit() call
type ErrWithExitCode ¶
type ErrWithExitCode interface {
ExitCode() int
}
ErrWithExitCode wraps error and exposes an ExitCode method
type ExecCommandInput ¶
type ExecCommandInput struct { // Command is the command to execute Command string // Args are the arguments to pass to the command Args []string // DisableStdioBuffer disables the stdio buffer DisableStdioBuffer bool // Env is the environment variables to pass to the command Env map[string]string // Stdin is the stdin of the command Stdin io.Reader // StreamStdio prints stdout and stderr directly to os.Stdout/err as // the command runs StreamStdio bool // StreamStdout prints stdout directly to os.Stdout as the command runs. StreamStdout bool // StreamStderr prints stderr directly to os.Stderr as the command runs. StreamStderr bool // StdoutWriter is the writer to write stdout to StdoutWriter io.Writer // StderrWriter is the writer to write stderr to StderrWriter io.Writer // Sudo runs the command with sudo -n -u root Sudo bool }
ExecCommandInput is the input for the ExecCommand function
type ExecCommandResponse ¶
type ExecCommandResponse struct { // Stdout is the stdout of the command Stdout string // Stderr is the stderr of the command Stderr string // ExitCode is the exit code of the command ExitCode int // Cancelled is whether the command was cancelled Cancelled bool }
ExecCommandResponse is the response for the ExecCommand function
func CallExecCommand ¶
func CallExecCommand(input ExecCommandInput) (ExecCommandResponse, error)
CallExecCommand executes a command on the local host
func CallExecCommandWithContext ¶
func CallExecCommandWithContext(ctx context.Context, input ExecCommandInput) (ExecCommandResponse, error)
CallExecCommandWithContext executes a command on the local host with the given context
func CallPlugnTrigger ¶
func CallPlugnTrigger(input PlugnTriggerInput) (ExecCommandResponse, error)
CallPlugnTrigger executes a trigger via plugn
func CallPlugnTriggerWithContext ¶
func CallPlugnTriggerWithContext(ctx context.Context, input PlugnTriggerInput) (ExecCommandResponse, error)
CallPlugnTriggerWithContext executes a trigger via plugn with the given context
func (ExecCommandResponse) StderrBytes ¶
func (ecr ExecCommandResponse) StderrBytes() []byte
StderrBytes returns the trimmed stderr of the command as bytes
func (ExecCommandResponse) StderrContents ¶
func (ecr ExecCommandResponse) StderrContents() string
StderrContents returns the trimmed stderr of the command
func (ExecCommandResponse) StdoutBytes ¶
func (ecr ExecCommandResponse) StdoutBytes() []byte
StdoutBytes returns the trimmed stdout of the command as bytes
func (ExecCommandResponse) StdoutContents ¶
func (ecr ExecCommandResponse) StdoutContents() string
StdoutContents returns the trimmed stdout of the command
type PlugnTriggerInput ¶
type PlugnTriggerInput struct { // Args are the arguments to pass to the trigger Args []string // DisableStdioBuffer disables the stdio buffer DisableStdioBuffer bool // Env is the environment variables to pass to the trigger Env map[string]string // Stdin is the stdin of the command Stdin io.Reader // StreamStdio determines whether to stream the stdio of the trigger StreamStdio bool // StreamStdout prints stdout directly to os.Stdout as the command runs. StreamStdout bool // StreamStderr prints stderr directly to os.Stderr as the command runs. StreamStderr bool // Trigger is the trigger to execute Trigger string }
PlugnTriggerInput is the input for CallPlugnTrigger
type ReportFunc ¶
ReportFunc is a type that declares functions useful for :report subcommands
type SetPermissionInput ¶
type SetPermissionInput struct { Filename string GroupName string Mode os.FileMode Username string }
SetPermissionsInput is the input struct for SetPermissions
type SftpCopyInput ¶
type SftpCopyInput struct { // AllowUknownHosts allows connecting to hosts with unknown host keys AllowUknownHosts bool // DestinationPath is the path to copy the file to DestinationPath string // RemoteHost is the remote host to connect to RemoteHost string // SourcePath is the path to the file to copy SourcePath string }
SftpCopyInput is the input for CallSftpCopy
type SftpCopyResult ¶
SftpCopyResult is the result of executing an SftpCopyTask
func CallSftpCopy ¶
func CallSftpCopy(input SftpCopyInput) (SftpCopyResult, error)
CallSftpCopy copies a file to a remote host via sftp
func CallSftpCopyWithContext ¶
func CallSftpCopyWithContext(ctx context.Context, input SftpCopyInput) (SftpCopyResult, error)
CallSftpCopyWithContext copies a file to a remote host via sftp with the given context
type SftpCopyTask ¶
type SftpCopyTask struct { // SourcePath is the path to the file to copy SourcePath string // DestinationPath is the path to copy the file to DestinationPath string // Shell run the command in a bash shell. // Note that the system must have `bash` installed in the PATH or in /bin/bash Shell bool // Stdin connect a reader to stdin for the command // being executed. Stdin io.Reader // PrintCommand prints the command before executing PrintCommand bool // AllowUknownHosts allows connecting to hosts with unknown host keys AllowUknownHosts bool // Hostname is the hostname to connect to Hostname string // Port is the port to connect to Port uint // Username is the username to connect with Username string // Password is the password to connect with Password string // SshKeyPath is the path to the ssh key to use SshKeyPath string }
func (SftpCopyTask) Execute ¶
func (task SftpCopyTask) Execute(ctx context.Context) (SftpCopyResult, error)
Execute runs the task
type SshCommandInput ¶
type SshCommandInput struct { // Command is the command to execute. This can be the path to an executable // or the executable with arguments. // // Any arguments must be given via Args Command string // Args are the arguments to pass to the command. Args []string // DisableStdioBuffer disables the stdio buffer DisableStdioBuffer bool // Env is a list of environment variables to add to the current environment Env map[string]string // AllowUknownHosts allows connecting to hosts with unknown host keys AllowUknownHosts bool // RemoteHost is the remote host to connect to RemoteHost string // Stdin is the stdin of the command Stdin io.Reader // StreamStdio prints stdout and stderr directly to os.Stdout/err as // the command runs. StreamStdio bool // StreamStdout prints stdout directly to os.Stdout as the command runs. StreamStdout bool // StreamStderr prints stderr directly to os.Stderr as the command runs. StreamStderr bool // Sudo runs the command with sudo -n -u root Sudo bool }
SshCommandInput is the input for CallSshCommand
type SshResult ¶
SshResult is the result of executing a command on a remote host via ssh
func CallSshCommand ¶
func CallSshCommand(input SshCommandInput) (SshResult, error)
CallSshCommand executes a command on a remote host via ssh
func CallSshCommandWithContext ¶
func CallSshCommandWithContext(ctx context.Context, input SshCommandInput) (SshResult, error)
CallSshCommand executes a command on a remote host via ssh with the given context
type SshTask ¶
type SshTask struct { // Command is the command to execute. This can be the path to an executable // or the executable with arguments. // // Any arguments must be given via Args Command string // Args are the arguments to pass to the command. Args []string // Shell run the command in a bash shell. // Note that the system must have `bash` installed in the PATH or in /bin/bash Shell bool // Env is a list of environment variables to add to the current environment Env []string // Stdin connect a reader to stdin for the command // being executed. Stdin io.Reader // PrintCommand prints the command before executing PrintCommand bool // StreamStdio prints stdout and stderr directly to os.Stdout/err as // the command runs. StreamStdio bool // DisableStdioBuffer prevents any output from being saved in the // TaskResult, which is useful for when the result is very large, or // when you want to stream the output to another writer exclusively. DisableStdioBuffer bool // StdoutWriter when set will receive a copy of stdout from the command StdOutWriter io.Writer // StderrWriter when set will receive a copy of stderr from the command StdErrWriter io.Writer // AllowUknownHosts allows connecting to hosts with unknown host keys AllowUknownHosts bool // Hostname is the hostname to connect to Hostname string // Port is the port to connect to Port uint // Username is the username to connect with Username string // Password is the password to connect with Password string // SshKeyPath is the path to the ssh key to use SshKeyPath string // Sudo runs the command with sudo -n -u root Sudo bool }
SshTask is a task for executing a command on a remote host via ssh
type WriteBytesToFileInput ¶
type WriteBytesToFileInput struct { Bytes []byte Filename string GroupName string Mode os.FileMode Username string }
WriteBytesToFileInput writes a byte array to a file