Documentation ¶
Overview ¶
Package clients implements utility clients
Index ¶
- func AppendFile(client *ssh.Client, os, path string, content []byte) (int64, error)
- func CopyFile(client *ssh.Client, src string, dst string) error
- func CopyFolder(client *ssh.Client, srcFolder string, dstFolder string) error
- func DownloadFile(client *ssh.Client, remotePath, localPath string) error
- func ExecuteCommand(client *ssh.Client, command string) (string, error)
- func FileExists(client *ssh.Client, path string) (bool, error)
- func GetAWSSSMClient() (*ssm.Client, error)
- func GetFile(client *ssh.Client, src string, dst string) error
- func GetSSHClient(user, host string, privateKey, privateKeyPassphrase []byte, ...) (client *ssh.Client, err error)
- func Lstat(client *ssh.Client, path string) (fs.FileInfo, error)
- func MkdirAll(client *ssh.Client, path string) error
- func ReadDir(client *ssh.Client, path string) ([]fs.DirEntry, error)
- func ReadFile(client *ssh.Client, path string) ([]byte, error)
- func Remove(client *ssh.Client, path string) error
- func RemoveAll(client *ssh.Client, path string) error
- func WriteFile(client *ssh.Client, path string, content []byte) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFile ¶ added in v0.52.0
AppendFile append content to the file and returns the number of bytes appened and error if any
func CopyFile ¶
CopyFile create a sftp session and copy a single file to the remote host through SSH
func CopyFolder ¶
CopyFolder create a sftp session and copy a folder to remote host through SSH
func DownloadFile ¶ added in v0.54.0
DownloadFile downloads the file from the remote host to the local host
func ExecuteCommand ¶
ExecuteCommand creates a session on an ssh client and runs a command. It returns the command output and errors
func FileExists ¶ added in v0.51.0
FileExists create a sftp session to and returns true if the file exists and is a regular file
func GetAWSSSMClient ¶
GetAWSSSMClient returns an aws SSM client
func GetFile ¶ added in v0.51.0
GetFile create a sftp session and copy a single file from the remote host through SSH
func GetSSHClient ¶
func GetSSHClient(user, host string, privateKey, privateKeyPassphrase []byte, retryInterval time.Duration, maxRetries uint64) (client *ssh.Client, err error)
GetSSHClient returns an ssh Client for the specified host
func Lstat ¶ added in v0.51.0
Lstat returns a FileInfo structure describing path. if path is a symbolic link, the FileInfo structure describes the symbolic link.
func MkdirAll ¶ added in v0.51.0
MkdirAll creates the specified directory along with any necessary parents. If the path is already a directory, does nothing and returns nil. Otherwise returns an error if any.
func ReadFile ¶ added in v0.51.0
ReadFile reads the content of the file, return bytes read and error if any
func Remove ¶ added in v0.51.0
Remove removes the specified file or directory. Returns an error if file or directory does not exist, or if the directory is not empty.
Types ¶
This section is empty.