Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFile(ctx context.Context, tr it.Transport, file *CopyFileRequest) error
- func CreateDirectory(ctx context.Context, tr it.Transport, dir *CreateDirectoryRequest) error
- func DeleteFile(ctx context.Context, tr it.Transport, req *DeleteFileRequest) error
- func TargetArchitecture(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
- func TargetDistro(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
- func TargetDistroVersion(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
- func TargetHomeDir(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
- func TargetHostname(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
- func TargetPlatform(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
- func TargetPlatformVersion(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
- func TargetProcessManager(ctx context.Context, tp transport.Transport, req *TargetRequest) (string, error)
- func WrapErrorWith(err error, msg ...string) error
- type CopyFileRequest
- type CopyFileRequestOpt
- func WithCopyFileChmod(chmod string) CopyFileRequestOpt
- func WithCopyFileChown(chown string) CopyFileRequestOpt
- func WithCopyFileContent(content it.Copyable) CopyFileRequestOpt
- func WithCopyFileDestination(destination string) CopyFileRequestOpt
- func WithCopyFileRetryOptions(opts ...retry.RetrierOpt) CopyFileRequestOpt
- func WithCopyFileTmpDir(dir string) CopyFileRequestOpt
- type CreateDirectoryRequest
- type CreateDirectoryRequestOpt
- type DeleteFileRequest
- type DeleteFileRequestOpt
- type DownloadOpt
- func WithDownloadRequestAuthPassword(password string) DownloadOpt
- func WithDownloadRequestAuthUser(user string) DownloadOpt
- func WithDownloadRequestDestination(dest string) DownloadOpt
- func WithDownloadRequestFlightControlPath(path string) DownloadOpt
- func WithDownloadRequestHTTPMethod(meth string) DownloadOpt
- func WithDownloadRequestMode(mode string) DownloadOpt
- func WithDownloadRequestReplace(replace bool) DownloadOpt
- func WithDownloadRequestRetryOptions(opts ...retry.RetrierOpt) DownloadOpt
- func WithDownloadRequestSHA256(sha string) DownloadOpt
- func WithDownloadRequestURL(url string) DownloadOpt
- func WithDownloadRequestUseSudo(useSudo bool) DownloadOpt
- type DownloadRequest
- type DownloadResponse
- type GetLogsResponse
- type HostInfo
- type InstallFlightControlOpt
- type InstallFlightControlRequest
- type InstallFlightControlResponse
- type PackageGetterType
- type PackageInstallGetter
- type PackageInstallInstaller
- type PackageInstallRequest
- type PackageInstallRequestOpt
- func WithPackageInstallCopyPath(path string) PackageInstallRequestOpt
- func WithPackageInstallDestination(path string) PackageInstallRequestOpt
- func WithPackageInstallDownloadOpts(opts ...DownloadOpt) PackageInstallRequestOpt
- func WithPackageInstallGetter(get *PackageInstallGetter) PackageInstallRequestOpt
- func WithPackageInstallInstaller(method *PackageInstallInstaller) PackageInstallRequestOpt
- func WithPackageInstallTemporaryDirectory(dir string) PackageInstallRequestOpt
- func WithPackageInstallUnzipOpts(opts ...UnzipOpt) PackageInstallRequestOpt
- type PackageInstallResponse
- type PackageInstallerType
- type RunScriptRequest
- type RunScriptRequestOpt
- func WithRunScriptChmod(chmod string) RunScriptRequestOpt
- func WithRunScriptChown(chown string) RunScriptRequestOpt
- func WithRunScriptContent(content it.Copyable) RunScriptRequestOpt
- func WithRunScriptDestination(destination string) RunScriptRequestOpt
- func WithRunScriptEnv(env map[string]string) RunScriptRequestOpt
- func WithRunScriptNoCleanup() RunScriptRequestOpt
- func WithRunScriptTmpDir(dir string) RunScriptRequestOpt
- func WithRunScriptUseSudo() RunScriptRequestOpt
- type RunScriptResponse
- type TargetRequest
- type TargetRequestOpt
- type UnzipOpt
- func WithUnzipRequestCreateDestinationDir(create bool) UnzipOpt
- func WithUnzipRequestDestinationDir(dir string) UnzipOpt
- func WithUnzipRequestDestinationDirMode(mode string) UnzipOpt
- func WithUnzipRequestFileMode(mode string) UnzipOpt
- func WithUnzipRequestFlightControlPath(path string) UnzipOpt
- func WithUnzipRequestReplace(replace bool) UnzipOpt
- func WithUnzipRequestSourcePath(path string) UnzipOpt
- func WithUnzipRequestUseSudo(useSudo bool) UnzipOpt
- type UnzipRequest
- type UnzipResponse
- type User
- type UserOpt
Constants ¶
const ( PackageGetterTypeCopy PackageGetterType = "copy" PackageGetterTypeReleases PackageGetterType = "releases" PackageGetterTypeArtifactory PackageGetterType = "artifactory" PackageGetterTypeRepository PackageGetterType = "repository" PackageInstallerTypeZip PackageInstallerType = "zip" PackageInstallerTypeDeb PackageInstallerType = "deb" PackageInstallerTypeRPM PackageInstallerType = "rpm" PackageInstallerTypeYum PackageInstallerType = "yum" PackageInstallerTypeApt PackageInstallerType = "apt" )
const DefaultFlightControlPath = "/opt/qti/bin/enos-flight-control"
DefaultFlightControlPath is the default location of our binary.
Variables ¶
var ( PackageInstallGetterCopy = &PackageInstallGetter{PackageGetterTypeCopy, packageInstallGetCopy} PackageInstallGetterReleases = &PackageInstallGetter{PackageGetterTypeReleases, packageInstallGetDownload} PackageInstallGetterArtifactory = &PackageInstallGetter{PackageGetterTypeArtifactory, packageInstallGetDownload} PackageInstallGetterRepository = &PackageInstallGetter{PackageGetterTypeRepository, packageInstallGetRepository} )
Package install gets. These are the built-in package getters.
var ( PackageInstallInstallerZip = &PackageInstallInstaller{ Type: PackageInstallerTypeZip, Install: packageInstallZipInstall, CompatibleGetters: []*PackageInstallGetter{ PackageInstallGetterCopy, PackageInstallGetterReleases, PackageInstallGetterArtifactory, }, } PackageInstallInstallerDEB = &PackageInstallInstaller{ Type: PackageInstallerTypeDeb, Install: packageInstallDEBInstall, CompatibleGetters: []*PackageInstallGetter{ PackageInstallGetterCopy, PackageInstallGetterReleases, PackageInstallGetterArtifactory, }, } PackageInstallInstallerRPM = &PackageInstallInstaller{ Type: PackageInstallerTypeRPM, Install: packageInstallRPMInstall, CompatibleGetters: []*PackageInstallGetter{ PackageInstallGetterCopy, PackageInstallGetterReleases, PackageInstallGetterArtifactory, }, } PackageInstallInstallerYum = &PackageInstallInstaller{ Type: PackageInstallerTypeYum, Install: packageInstallYumInstall, CompatibleGetters: []*PackageInstallGetter{ PackageInstallGetterRepository, }, } PackageInstallInstallerApt = &PackageInstallInstaller{ Type: PackageInstallerTypeApt, Install: packageInstallAptInstall, CompatibleGetters: []*PackageInstallGetter{ PackageInstallGetterRepository, }, } )
Package install methods. These are the built-in pacakage installers.
var ( // ErrPackageInstallGetterUnknown means the package get has not been set. ErrPackageInstallGetterUnknown = errors.New("package install get is unknown") // ErrPackageInstallGetterUnsupported means the package get is unsupported not been set. ErrPackageInstallGetterUnsupported = errors.New("package install get is unsupported") // ErrPackageInstallInstallerUnknown means the package method has not been set. ErrPackageInstallInstallerUnknown = errors.New("package install method is unknown") // ErrPackageInstallInstallerUnsupported means the package method is unsupported. ErrPackageInstallInstallerUnsupported = errors.New("package install method is unsupported") )
Functions ¶
func CopyFile ¶
CopyFile copies a file to the remote host. It first copies a file to a temporary directory, sets permissions, then copies to the destination directory as a superuser — retrying these operations if necessary.
func CreateDirectory ¶
CreateDirectory creates the directory and sets owner permissions.
func DeleteFile ¶
DeleteFile deletes a file on the remote host, retrying if necessary.
func TargetArchitecture ¶
func TargetArchitecture(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
TargetArchitecture is a helper that determines the targets architecture.
func TargetDistro ¶
TargetDistro is a helper that determines the targets distribution.
func TargetDistroVersion ¶
func TargetDistroVersion(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
TargetDistroVersion is a helper that determines the targets distribution version.
func TargetHomeDir ¶
TargetHomeDir is a helper that determines the targets HOME directory.
func TargetHostname ¶
func TargetHostname(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
TargetHostname is a helper that determines the targets hostname.
func TargetPlatform ¶
func TargetPlatform(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
TargetPlatform is a helper that determines the targets platform.
func TargetPlatformVersion ¶
func TargetPlatformVersion(ctx context.Context, tr transport.Transport, req *TargetRequest) (string, error)
TargetPlatformVersion is a helper that determines the targets platform version.
func TargetProcessManager ¶
func TargetProcessManager(ctx context.Context, tp transport.Transport, req *TargetRequest) (string, error)
TargetProcessManager is a helper that determines the targets process manager.
func WrapErrorWith ¶
WrapErrorWith returns a custom error message.
Types ¶
type CopyFileRequest ¶
type CopyFileRequest struct { Content it.Copyable TmpDir string Chmod string Chown string Destination string RetryOpts []retry.RetrierOpt }
CopyFileRequest copies a file to the remote host.
func NewCopyFileRequest ¶
func NewCopyFileRequest(opts ...CopyFileRequestOpt) *CopyFileRequest
NewCopyFileRequest takes functional options and returns a new file copy request.
type CopyFileRequestOpt ¶
type CopyFileRequestOpt func(*CopyFileRequest) *CopyFileRequest
CopyFileRequestOpt is a functional option for file copy.
func WithCopyFileChmod ¶
func WithCopyFileChmod(chmod string) CopyFileRequestOpt
WithCopyFileChmod sets permissions.
func WithCopyFileChown ¶
func WithCopyFileChown(chown string) CopyFileRequestOpt
WithCopyFileChown sets ownership.
func WithCopyFileContent ¶
func WithCopyFileContent(content it.Copyable) CopyFileRequestOpt
WithCopyFileContent sets content to be copied.
func WithCopyFileDestination ¶
func WithCopyFileDestination(destination string) CopyFileRequestOpt
WithCopyFileDestination sets file destination.
func WithCopyFileRetryOptions ¶
func WithCopyFileRetryOptions(opts ...retry.RetrierOpt) CopyFileRequestOpt
WithCopyFileRetryOptions sets retry options for file copy operations.
func WithCopyFileTmpDir ¶
func WithCopyFileTmpDir(dir string) CopyFileRequestOpt
WithCopyFileTmpDir sets temporary directory to use.
type CreateDirectoryRequest ¶
CreateDirectoryRequest creates a directory on remote host.
func NewCreateDirectoryRequest ¶
func NewCreateDirectoryRequest(opts ...CreateDirectoryRequestOpt) *CreateDirectoryRequest
NewCreateDirectoryRequest takes functional options and returns a new directory.
type CreateDirectoryRequestOpt ¶
type CreateDirectoryRequestOpt func(*CreateDirectoryRequest) *CreateDirectoryRequest
CreateDirectoryRequestOpt is a functional option for creating directory.
func WithDirChown ¶
func WithDirChown(owner string) CreateDirectoryRequestOpt
WithDirChown sets directory name.
func WithDirName ¶
func WithDirName(directory string) CreateDirectoryRequestOpt
WithDirName sets directory name.
type DeleteFileRequest ¶
type DeleteFileRequest struct { Path string RetryOpts []retry.RetrierOpt }
DeleteFileRequest deletes a file on the remote host.
func NewDeleteFileRequest ¶
func NewDeleteFileRequest(opts ...DeleteFileRequestOpt) *DeleteFileRequest
NewDeleteFileRequest takes functional options and returns a new file deletion request.
type DeleteFileRequestOpt ¶
type DeleteFileRequestOpt func(*DeleteFileRequest) *DeleteFileRequest
DeleteFileRequestOpt is a functional option for file deletion.
func WithDeleteFilePath ¶
func WithDeleteFilePath(path string) DeleteFileRequestOpt
WithDeleteFilePath sets which file to delete for file delete operations.
func WithDeleteFileRetryOptions ¶
func WithDeleteFileRetryOptions(opts ...retry.RetrierOpt) DeleteFileRequestOpt
WithDeleteFileRetryOptions sets retry options for file delete operations.
type DownloadOpt ¶
type DownloadOpt func(*DownloadRequest) *DownloadRequest
DownloadOpt is a functional option for an download request.
func WithDownloadRequestAuthPassword ¶
func WithDownloadRequestAuthPassword(password string) DownloadOpt
WithDownloadRequestAuthPassword sets basic auth password.
func WithDownloadRequestAuthUser ¶
func WithDownloadRequestAuthUser(user string) DownloadOpt
WithDownloadRequestAuthUser sets basic auth user.
func WithDownloadRequestDestination ¶
func WithDownloadRequestDestination(dest string) DownloadOpt
WithDownloadRequestDestination sets destination path of the downloaded file.
func WithDownloadRequestFlightControlPath ¶
func WithDownloadRequestFlightControlPath(path string) DownloadOpt
WithDownloadRequestFlightControlPath sets the location of the enos-flight-contro binary.
func WithDownloadRequestHTTPMethod ¶
func WithDownloadRequestHTTPMethod(meth string) DownloadOpt
WithDownloadRequestHTTPMethod sets the download HTTP method.
func WithDownloadRequestMode ¶
func WithDownloadRequestMode(mode string) DownloadOpt
WithDownloadRequestMode sets the mode for the downloaded file.
func WithDownloadRequestReplace ¶
func WithDownloadRequestReplace(replace bool) DownloadOpt
WithDownloadRequestReplace determines if the download command should replace existing files.
func WithDownloadRequestRetryOptions ¶
func WithDownloadRequestRetryOptions(opts ...retry.RetrierOpt) DownloadOpt
WithDownloadRequestRetryOptions sets retry options for dowload operation.
func WithDownloadRequestSHA256 ¶
func WithDownloadRequestSHA256(sha string) DownloadOpt
WithDownloadRequestSHA256 sets required SHA256 sum.
func WithDownloadRequestURL ¶
func WithDownloadRequestURL(url string) DownloadOpt
WithDownloadRequestURL sets the download drL.
func WithDownloadRequestUseSudo ¶
func WithDownloadRequestUseSudo(useSudo bool) DownloadOpt
WithDownloadRequestUseSudo determines if the download command should be run with sudo.
type DownloadRequest ¶
type DownloadRequest struct { FlightControlPath string URL string HTTPMethod string Destination string Mode string SHA256 string Timeout string AuthUser string AuthPassword string Sudo bool Replace bool RetryOpts []retry.RetrierOpt }
DownloadRequest performs a remote flight control download.
func NewDownloadRequest ¶
func NewDownloadRequest(opts ...DownloadOpt) *DownloadRequest
NewDownloadRequest takes functional options and returns a new download request.
type DownloadResponse ¶
type DownloadResponse struct{}
DownloadResponse is a flight control download response.
func Download ¶
func Download(ctx context.Context, tr transport.Transport, dr *DownloadRequest) (*DownloadResponse, error)
Download downloads a file on a remote machine with enos-flight-control, retrying if necessary.
type GetLogsResponse ¶
type GetLogsResponse interface { // GetAppName gets the name of the application that the logs pertain to. GetAppName() string // GetLogFileName creates a unique log file name. GetLogFileName() string // GetLogs gets the logs that were retrieved by a log file request GetLogs() []byte }
GetLogsResponse interface defining the functions required for any get logs request response.
type HostInfo ¶
type HostInfo struct { Arch *string Distro *string DistroVersion *string Hostname *string Pid1 *string Platform *string PlatformVersion *string }
HostInfo represents information about the target host.
func TargetHostInfo ¶
func TargetHostInfo(ctx context.Context, tr transport.Transport, req *TargetRequest) (*HostInfo, error)
TargetHostInfo is a helper that determines the targets host information. Any errors will be returned. NOTE: not all platforms support all host info so handle the result and error accordingly.
type InstallFlightControlOpt ¶
type InstallFlightControlOpt func(*InstallFlightControlRequest) *InstallFlightControlRequest
InstallFlightControlOpt is a functional option for an install request.
func WithInstallFlightControlRequestPath ¶
func WithInstallFlightControlRequestPath(path string) InstallFlightControlOpt
WithInstallFlightControlRequestPath sets the install path.
func WithInstallFlightControlRequestTargetRequest ¶
func WithInstallFlightControlRequestTargetRequest(tr *TargetRequest) InstallFlightControlOpt
WithInstallFlightControlRequestTargetRequest sets the target request.
func WithInstallFlightControlRequestUseHomeDir ¶
func WithInstallFlightControlRequestUseHomeDir() InstallFlightControlOpt
WithInstallFlightControlRequestUseHomeDir installs enos-flight-control into the home directory.
type InstallFlightControlRequest ¶
type InstallFlightControlRequest struct { Path string UseHomeDir bool *TargetRequest }
InstallFlightControlRequest is a flight control install request.
func NewInstallFlightControlRequest ¶
func NewInstallFlightControlRequest(opts ...InstallFlightControlOpt) *InstallFlightControlRequest
NewInstallFlightControlRequest takes functional options and returns a new install request.
type InstallFlightControlResponse ¶
type InstallFlightControlResponse struct {
Path string
}
InstallFlightControlResponse is a flight control install response.
func InstallFlightControl ¶
func InstallFlightControl(ctx context.Context, tr transport.Transport, ir *InstallFlightControlRequest) (*InstallFlightControlResponse, error)
InstallFlightControl installs the enos-flight-control binary on a remote host in an idempotent fashion.
type PackageGetterType ¶ added in v0.5.4
type PackageGetterType string
type PackageInstallGetter ¶
type PackageInstallGetter struct { Type PackageGetterType Get func(ctx context.Context, tr it.Transport, req *PackageInstallRequest) (string, error) }
PackageInstallGetter is where the package is coming from.
type PackageInstallInstaller ¶
type PackageInstallInstaller struct { Type PackageInstallerType CompatibleGetters []*PackageInstallGetter Install func(ctx context.Context, tr it.Transport, req *PackageInstallRequest) error }
PackageInstallInstaller is how a package is going to be installed.
func PackageInstallInstallerForFile ¶
func PackageInstallInstallerForFile(name string) *PackageInstallInstaller
PackageInstallInstallerForFile attempts to determine a suitable package installation method given the file name.
func (*PackageInstallInstaller) Compatible ¶
func (m *PackageInstallInstaller) Compatible(get *PackageInstallGetter) bool
Compatible determines if the install get artifact is compatible with the install method.
type PackageInstallRequest ¶
type PackageInstallRequest struct { Installer *PackageInstallInstaller Getter *PackageInstallGetter FlightControlPath string UnzipOpts []UnzipOpt // Unzip options if we're getting a zip bundle DownloadOpts []DownloadOpt // Download options if we're downloading the artifact CopyPath string // Where to copy from TempArtifactPath string // Intermediate location of artifact TempDir string // Base directory of temporary directory DestionationPath string // Final destination of artifact }
PackageInstallRequest is a request to install a package on a target machine.
func NewPackageInstallRequest ¶
func NewPackageInstallRequest(opts ...PackageInstallRequestOpt) *PackageInstallRequest
NewPackageInstallRequest takes functional options and returns a new script run req.
type PackageInstallRequestOpt ¶
type PackageInstallRequestOpt func(*PackageInstallRequest) *PackageInstallRequest
PackageInstallRequestOpt is a functional option for running a script.
func WithPackageInstallCopyPath ¶
func WithPackageInstallCopyPath(path string) PackageInstallRequestOpt
WithPackageInstallCopyPath sets get location of an artifact that is being copied from the local machine.
func WithPackageInstallDestination ¶
func WithPackageInstallDestination(path string) PackageInstallRequestOpt
WithPackageInstallDestination sets final destination for binaries.
func WithPackageInstallDownloadOpts ¶
func WithPackageInstallDownloadOpts(opts ...DownloadOpt) PackageInstallRequestOpt
WithPackageInstallDownloadOpts sets the package download options.
func WithPackageInstallGetter ¶
func WithPackageInstallGetter(get *PackageInstallGetter) PackageInstallRequestOpt
WithPackageInstallGetter sets the package install get.
func WithPackageInstallInstaller ¶
func WithPackageInstallInstaller(method *PackageInstallInstaller) PackageInstallRequestOpt
WithPackageInstallInstaller sets the package installer.
func WithPackageInstallTemporaryDirectory ¶
func WithPackageInstallTemporaryDirectory(dir string) PackageInstallRequestOpt
WithPackageInstallTemporaryDirectory sets the temporary directory.
func WithPackageInstallUnzipOpts ¶
func WithPackageInstallUnzipOpts(opts ...UnzipOpt) PackageInstallRequestOpt
WithPackageInstallUnzipOpts sets the package unzip options.
type PackageInstallResponse ¶
type PackageInstallResponse struct { Name string GetterType PackageGetterType InstallerType PackageInstallerType }
PackageInstallResponse is the response of the script run.
func PackageInstall ¶
func PackageInstall(ctx context.Context, tr it.Transport, req *PackageInstallRequest) (*PackageInstallResponse, error)
PackageInstall copies the script to the remote host, executes it, and cleans it up.
type PackageInstallerType ¶ added in v0.5.4
type PackageInstallerType string
type RunScriptRequest ¶
type RunScriptRequest struct { Env map[string]string NoCleanup bool Sudo bool CopyFileRequest *CopyFileRequest }
RunScriptRequest copies a file to the remote host.
func NewRunScriptRequest ¶
func NewRunScriptRequest(opts ...RunScriptRequestOpt) *RunScriptRequest
NewRunScriptRequest takes functional options and returns a new script run req.
type RunScriptRequestOpt ¶
type RunScriptRequestOpt func(*RunScriptRequest) *RunScriptRequest
RunScriptRequestOpt is a functional option for running a script.
func WithRunScriptChmod ¶
func WithRunScriptChmod(chmod string) RunScriptRequestOpt
WithRunScriptChmod sets permissions.
func WithRunScriptChown ¶
func WithRunScriptChown(chown string) RunScriptRequestOpt
WithRunScriptChown sets ownership.
func WithRunScriptContent ¶
func WithRunScriptContent(content it.Copyable) RunScriptRequestOpt
WithRunScriptContent sets content to be copied.
func WithRunScriptDestination ¶
func WithRunScriptDestination(destination string) RunScriptRequestOpt
WithRunScriptDestination sets file destination.
func WithRunScriptEnv ¶
func WithRunScriptEnv(env map[string]string) RunScriptRequestOpt
WithRunScriptEnv sets the environment variables.
func WithRunScriptNoCleanup ¶
func WithRunScriptNoCleanup() RunScriptRequestOpt
WithRunScriptNoCleanup disable the auto cleanup.
func WithRunScriptTmpDir ¶
func WithRunScriptTmpDir(dir string) RunScriptRequestOpt
WithRunScriptTmpDir sets temporary directory to use.
func WithRunScriptUseSudo ¶
func WithRunScriptUseSudo() RunScriptRequestOpt
WithRunScriptUseSudo runs the script with sudo.
type RunScriptResponse ¶
RunScriptResponse is the response of the script run.
func RunScript ¶
func RunScript(ctx context.Context, tr it.Transport, req *RunScriptRequest) (*RunScriptResponse, error)
RunScript copies the script to the remote host, executes it, and cleans it up.
type TargetRequest ¶
type TargetRequest struct { *retry.Retrier RetryOpts []retry.RetrierOpt }
TargetRequest is a Target* request.
func NewTargetRequest ¶
func NewTargetRequest(opts ...TargetRequestOpt) *TargetRequest
NewTargetRequest takes optional arguments and returns a new instance of TargetRequest.
func (*TargetRequest) Clone ¶
func (t *TargetRequest) Clone() *TargetRequest
Clone create a cloned copy of the target request.
type TargetRequestOpt ¶
type TargetRequestOpt func(*TargetRequest)
TargetRequestOpt is a functional option for a new Target.
func WithTargetRequestRetryOpts ¶
func WithTargetRequestRetryOpts(opts ...retry.RetrierOpt) TargetRequestOpt
WithTargetRequestRetryOpts allows the caller to define retry options.
type UnzipOpt ¶
type UnzipOpt func(*UnzipRequest) *UnzipRequest
UnzipOpt is a functional option for an unzip request.
func WithUnzipRequestCreateDestinationDir ¶
WithUnzipRequestCreateDestinationDir determines if the destination directory should be created.
func WithUnzipRequestDestinationDir ¶
WithUnzipRequestDestinationDir sets the unzip directory.
func WithUnzipRequestDestinationDirMode ¶
WithUnzipRequestDestinationDirMode sets the mode for destination directory if it is created.
func WithUnzipRequestFileMode ¶
WithUnzipRequestFileMode sets the mode for files that are expanded.
func WithUnzipRequestFlightControlPath ¶
WithUnzipRequestFlightControlPath sets the location of the enos-flight-contro binary.
func WithUnzipRequestReplace ¶
WithUnzipRequestReplace determines if the unzip command should overwrite the destination file if it exists.
func WithUnzipRequestSourcePath ¶
WithUnzipRequestSourcePath sets the zip archive source path.
func WithUnzipRequestUseSudo ¶
WithUnzipRequestUseSudo determines if the unzip command should be run with sudo.
type UnzipRequest ¶
type UnzipRequest struct { FlightControlPath string SourcePath string DestinationDirectory string FileMode string DestinationDirectoryMode string Sudo bool CreateDestinationDirectory bool Replace bool }
UnzipRequest performs a remote flight control unzip.
func NewUnzipRequest ¶
func NewUnzipRequest(opts ...UnzipOpt) *UnzipRequest
NewUnzipRequest takes functional options and returns a new unzip request.
type UnzipResponse ¶
type UnzipResponse struct{}
UnzipResponse is a flight control unzip response.
func Unzip ¶
func Unzip(ctx context.Context, tr transport.Transport, ur *UnzipRequest) (*UnzipResponse, error)
Unzip unzips an archive on a remote machine with enos-flight-control.
type User ¶
User is a system user.
func CreateOrUpdateUser ¶
CreateOrUpdateUser takes an wanted user specification and creates or updates a user to the specification.
func CreateUser ¶
CreateUser takes a context, transport, and user and creates the user on the remote machine.
func FindUser ¶
FindUser attempts to find details about a user on a remote machine. Currently we try to use tools that most-likely exist on most macOS and linux distro's.
func (*User) HasSameSetProperties ¶
HasSameSetProperties takes a user specification and verifies that the current user has the same set properties. The zero values will not be considered.