Search Results for

    Show / Hide Table of Contents

    Plugin: SSH

    Introduction

    The plugin provides an easy way to transfer files over the web.

    Features

    Upload file

    Upload file via SSH protocol.

    Method Name: UploadV2

    Input

    • FileName(required): a string represents a file name to upload.
    • Bytes(required): a file content.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer file, default value is set in plugin settings.
    • Username(optional): a username to authenticate, default value is set in plugin settings.
    • Password(optional): a password to authenticate, default value is set in plugin settings.
    • AuthenticationType(optional): a type to authenticate, it can be password or private key.
    • PrivateKey(optional): a private key to authenticate.
    • Passphrase(optional): a passphrase to protects the private key.
    • Override(optional): an option to override existing file when upload, if does not have value is set in plugin settings or parameters, default is true.
    • CreateDirectory(optional): an option to allow to create a directory when upload if it does not exists, if does not have value is set in plugin settings or parameters, default is true.

    Output Data object:

    • IsSuccess: True if file transfers successfully, else False.
    • Data: The file content. Null if file transferred failed.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FileName", "file_name.csv" },
        { "Bytes", new byte[]{} },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "UploadV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    Download file

    Download file content via SSH protocol.

    Method Name: DownloadV2

    Input

    • FileName(required): a string represents a file name to download.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer file, default value is set in plugin settings.
    • Username(optional): a username to authenticate, default value is set in plugin settings.
    • Password(optional): a password to authenticate, default value is set in plugin settings.
    • AuthenticationType(optional): a type to authenticate, it can be password or private key.
    • PrivateKey(optional): a private key to authenticate.
    • Passphrase(optional): a passphrase to protects the private key.

    Output Data object:

    • IsSuccess: True if file transfers successfully, else False.
    • Data: The file content. Null if file transferred failed.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FileName", "file_name.csv" },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "DownloadV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    Delete file

    Delete file via SSH protocol.

    Method Name: DeleteV2

    Input

    • FileName(required): a string represents a file name to delete
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port default value is set in plugin settings.
    • RootPath(optional): a root path to transfer file, default value is set in plugin settings.
    • Username(optional): a username to authenticate, default value is set in plugin settings.
    • Password(optional): a password to authenticate, default value is set in plugin settings.
    • AuthenticationType(optional): a type to authenticate, it can be password or private key.
    • PrivateKey(optional): a private key to authenticate.
    • Passphrase(optional): a passphrase to protects the private key.

    Output Data object:

    • IsSuccess: True if file is deleted successfully, else False.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FileName", "file_name.csv" },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "DeleteV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    List files

    List files in a folder via SSH protocol.

    Method Name: ListFilesV2

    Input

    • FolderName(required): a string represents a folder name to get files.
    • LastModified(optional): get files that have LastWriteTimeUtc greater than LastModified value,get all files in folder by default.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer file default value is set in plugin settings.
    • Username(optional): a username to authenticate, default value is set in plugin settings.
    • Password(optional): a password to authenticate, default value is set in plugin settings.
    • AuthenticationType(optional): a type to authenticate, it can be password or private key.
    • PrivateKey(optional): a private key to authenticate.
    • Passphrase(optional): a passphrase to protects the private key.

    Output Data object:

    • IsSuccess: True if get files successfully, else False.
    • Data: An array contains the list of files.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FolderName", "Archive/Incoming" },
        { "LastModified", new DateTime(2021, 12, 01) }
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "ListFilesV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    Move file

    Move file to other location via SSH protocol.

    Method Name: MoveFileV2

    Input

    • FileName(required): a string represents file name to move.
    • ToFolder(required): a string represents a destination folder.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer file, default value is set in plugin settings.
    • Username(optional): a username to authenticate, default value is set in plugin settings.
    • Password(optional): a password to authenticate, default value is set in plugin settings.
    • AuthenticationType(optional): a type to authenticate, it can be password or private key.
    • PrivateKey(optional): a private key to authenticate.
    • Passphrase(optional): a passphrase to protects the private key.

    Output Data object:

    • IsSuccess: True if file is relocated successfully, else False.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FileName", "file_name.csv" },
        { "FolderName", "Archive/Outgoing" },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "MoveFileV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    Rename directory

    Rename directory via SSH protocol.

    Method Name: RenameDirectory

    Input

    • Path(required): a string represents current path.
    • NewPath(required): a string represents a new path.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer file, default value is set in plugin settings.
    • Username(optional): a username to authenticate, default value is set in plugin settings.
    • Password(optional): a password to authenticate, default value is set in plugin settings.
    • AuthenticationType(optional): a type to authenticate, it can be password or private key.
    • PrivateKey(optional): a private key to authenticate.
    • Passphrase(optional): a passphrase to protects the private key.

    Output Data object:

    • IsSuccess: True if directory is renamed successfully, else False.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "Path", "Archive/Outgoing" },
        { "NewPath", "Archive/Outgoing_New" },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "RenameDirectory", parameters);
    var output = pluginResult.GetObject("Data");
    

    Installation

    Requirements

    • Casewhere v2.5 or later

    Configuration

    Configure the plugin as below:

    {
      "Host": "127.0.0.1",
      "Port": 22,
      "Username": // username,
      "Password": // password,
      "RootPath": "/C:/STFP",
      "Override": true,
      "CreateDirectory": true
    }
    

    Releases

    1.1.2

    Changelog

    • Add Override configuration. Default is true.
    • Add CreateDirectory configuration. Default is true.
    • Add new method RenameDirectory Download (login required): SSH Plugin v1.1.1 update link.

    1.1.1 - 21/03/2022

    Changelog

    • Update the lasted version for Renci.SshNet.
    • Add unit tests.
      Download (login required): SSH Plugin v1.1.1

    1.1.0 - 20/01/2022

    Changelog

    • UploadV2
    • DownloadV2
    • DeleteV2
    • ListFilesV2
    • MoveFileV2
      Download (login required): SSH plugin v1.1.0 update link.

    1.0.0 - 24/07/2021

    Changelog

    • Upload
    • Download
    • Delete
    • ListFiles
    • MoveFile
      Download (login required): SSH plugin v1.0.0 update link.
    In This Article
    Back to top Generated by DocFX