clients

package
v0.51.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package clients implements utility clients

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(client *ssh.Client, src string, dst string) error

CopyFile create a sftp session and copy a single file to the remote host through SSH

func CopyFolder

func CopyFolder(client *ssh.Client, srcFolder string, dstFolder string) error

CopyFolder create a sftp session and copy a folder to remote host through SSH

func ExecuteCommand

func ExecuteCommand(client *ssh.Client, command string) (string, error)

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

func FileExists(client *ssh.Client, path string) (bool, error)

FileExists create a sftp session to and returns true if the file exists and is a regular file

func GetAWSSSMClient

func GetAWSSSMClient() (*ssm.Client, error)

GetAWSSSMClient returns an aws SSM client

func GetFile added in v0.51.0

func GetFile(client *ssh.Client, src string, dst string) error

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

func Lstat(client *ssh.Client, path string) (fs.FileInfo, error)

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

func MkdirAll(client *ssh.Client, path string) error

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 ReadDir added in v0.51.0

func ReadDir(client *ssh.Client, path string) ([]fs.DirEntry, error)

ReadDir returns list of directory entries in path

func ReadFile added in v0.51.0

func ReadFile(client *ssh.Client, path string) ([]byte, error)

ReadFile reads the content of the file, return bytes read and error if any

func Remove added in v0.51.0

func Remove(client *ssh.Client, path string) error

Remove removes the specified file or directory. Returns an error if file or directory does not exist, or if the directory is not empty.

func RemoveAll added in v0.51.0

func RemoveAll(client *ssh.Client, path string) error

RemoveAll recursively removes all files/folders in the specified directory. Returns an error if the directory does not exist.

func WriteFile added in v0.51.0

func WriteFile(client *ssh.Client, path string, content []byte) (int64, error)

WriteFile write content to the file and returns the number of bytes written and error if any

Types

This section is empty.

Jump to

Keyboard shortcuts

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