osutils

package
v0.1.54 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//RemoteImportPath - path to place the temporary remote import files when uploaded
	RemoteImportPath string = "/tmp/archive.backup"
)

Variables

This section is empty.

Functions

func Exists

func Exists(path string) (bool, error)

Exists - check if the given path exists

func SafeCreate

func SafeCreate(name ...string) (file *os.File, err error)

SafeCreate creates a file, creating parent directories if needed

func SafeCreateSSH

func SafeCreateSSH(client SFTPClient, name ...string) (file *sftp.File, err error)

SafeCreateSSH creates a file, creating parent directories if needed on a remote machine via an ssh client

func SafeRemoveSSH added in v0.1.44

func SafeRemoveSSH(client SFTPClient, filePath string) (err error)

SafeRemoveSSH removes a file on a remote machine via an ssh client

Types

type RemoteOperations added in v0.1.31

type RemoteOperations struct {
	GetSSHConnection func(command.SshConfig, *ssh.ClientConfig) (SFTPClient, error)
	// contains filtered or unexported fields
}

RemoteOperations - an object which allows us to execute operations on a remote system

func NewRemoteOperations

func NewRemoteOperations(sshCfg command.SshConfig) *RemoteOperations

NewRemoteOperations - a constructor for a remoteoperations object

func NewRemoteOperationsWithPath added in v0.1.41

func NewRemoteOperationsWithPath(sshCfg command.SshConfig, remoteImportPath string) *RemoteOperations

NewRemoteOperationsWithPath -

func (*RemoteOperations) GetRemoteFile added in v0.1.31

func (s *RemoteOperations) GetRemoteFile() (rfile io.WriteCloser, err error)

GetRemoteFile - get a file from a remote system and return a writecloser to it

func (*RemoteOperations) Path added in v0.1.31

func (s *RemoteOperations) Path() string

Path - allows us to get the path of the remote upload

func (*RemoteOperations) RemoveRemoteFile added in v0.1.44

func (s *RemoteOperations) RemoveRemoteFile() (err error)

RemoveRemoteFile - get a file from a remote system and return a writecloser to it

func (*RemoteOperations) SetPath added in v0.1.31

func (s *RemoteOperations) SetPath(p string)

SetPath - allows us to set the remote path of the upload

func (*RemoteOperations) UploadFile added in v0.1.31

func (s *RemoteOperations) UploadFile(lfile io.Reader) (err error)

UploadFile - allows us to upload the contents of the given reader

type SFTPClient added in v0.1.44

type SFTPClient interface {
	Create(path string) (*sftp.File, error)
	Mkdir(path string) error
	ReadDir(p string) ([]os.FileInfo, error)
	Remove(path string) error
}

SFTPClient -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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