SSH resource client

SSH resource client

Format

A R6 object of class SshResourceClient

Details

Connects to a SSH server.

Super classes

resourcer::ResourceClient -> resourcer::CommandResourceClient -> SshResourceClient

Methods

Inherited methods


Method new()

Create a SshResourceClient instance. This client will interact wtih a computation resource using ssh commands.

Usage

SshResourceClient$new(resource)

Arguments

resource

The computation resource.

Returns

The SshResourceClient object.


Method getAllowedCommands()

Get the command names that can be executed.

Usage

SshResourceClient$getAllowedCommands()

Returns

A character vector


Method getConnection()

Get or create the SSH connection object, for raw interaction.

Usage

SshResourceClient$getConnection()

Returns

The SSH connection object.


Method downloadFile()

Download one or more files (wilcard * is supported in the file name (which can be a directory))

Usage

SshResourceClient$downloadFile(file, to = ".", verbose = FALSE)

Arguments

file

The file path(s) to download, either absolute or relative to the working directory.

to

The download destination.

verbose

If TRUE, details the file operations on the console output.

Returns

The paths of the files having been downloaded.


Method uploadFile()

Upload one or more files

Usage

SshResourceClient$uploadFile(file, to = ".", verbose = FALSE)

Arguments

file

The file or vector of files to upload.

to

The upload destination, either absolute or relative to working directory.

verbose

If TRUE, details the file operations on the console output.

Returns

The paths of the files having been uploaded.


Method tempDir()

Get connection's temporary directory in the remote server, create it if it does not exists.

Usage

SshResourceClient$tempDir()

Returns

The path to the temporary directory.


Method removeTempDir()

Remove the connection's temporary directory from the remote server, if it was defined.

Usage

SshResourceClient$removeTempDir()


Method exec()

Executes a ssh command.

Usage

SshResourceClient$exec(command, params = NULL, test = FALSE)

Arguments

command

The command name.

params

A character vector of arguments to pass.

test

If TRUE, the command is printed but not executed (for debugging).

Returns

The command execution result object.


Method close()

Close the SSH connection.

Usage

SshResourceClient$close()


Method clone()

The objects of this class are cloneable with this method.

Usage

SshResourceClient$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.