Class LinuxSshProxy<TMetadata>
Uses a SSH/SCP connection to provide access to Linux machines to access files, run commands, etc. This extends LinuxSshProxy by adding the Metadata property with a generic type.
note
IMPORTANT: We use this class to manage Ubuntu Linux machines. This will likely work for Debian and other Debian based distros but other distros like Alpine and Red Hat may have problems or may not work at all.
Inherited Members
Namespace: Neon.SSH
Assembly: Neon.SSH.dll
Syntax
public class LinuxSshProxy<TMetadata> : LinuxSshProxy where TMetadata : class
Type Parameters
Name | Description |
---|---|
TMetadata | Defines the metadata type the application wishes to associate with the server.
You may specify |
Remarks
Construct an instance to connect to a specific cluster node. You may specify
TMetadata
to associate application specific information
or state with the instance.
This class includes methods to invoke Linux commands on the node,
Call Dispose() or Disconnect() to close the connection.
note
You can use Clone() to make a copy of a proxy that can be used to perform parallel operations against the same machine.
Constructors
LinuxSshProxy(string, IPAddress, SshCredentials, int, TextWriter)
Constructs a LinuxSshProxy<TMetadata>.
Declaration
public LinuxSshProxy(string name, IPAddress address, SshCredentials credentials, int port = 22, TextWriter logWriter = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The display name for the server. |
IPAddress | address | The private cluster IP address for the server. |
SshCredentials | credentials | The credentials to be used for establishing SSH connections. |
int | port | Optionally overrides the standard SSH port (22). |
TextWriter | logWriter | The optional TextWriter where operation logs will be written. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Properties
Metadata
Applications may use this to associate metadata with the instance.
Declaration
public TMetadata Metadata { get; set; }
Property Value
Type | Description |
---|---|
TMetadata |
Methods
Clone()
Returns a clone of the SSH proxy. This can be useful for situations where you need to be able to perform multiple SSH/SCP operations against the same machine in parallel.
Declaration
public LinuxSshProxy<TMetadata> Clone()
Returns
Type | Description |
---|---|
LinuxSshProxy<TMetadata> | The cloned LinuxSshProxy<TMetadata>. |
CloneTo(LinuxSshProxy<TMetadata>)
Used by derived classes to copy the base class state to a new instance as well as configure the new connection's SSH and SCP clients.
Declaration
protected void CloneTo(LinuxSshProxy<TMetadata> target)
Parameters
Type | Name | Description |
---|---|---|
LinuxSshProxy<TMetadata> | target | The target proxy. |
Dispose(bool)
Releases all associated resources (e.g. any open server connections).
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Pass |