Click or drag to resize

LinuxSshProxyTMetadata Class

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.

Inheritance Hierarchy
SystemObject
  Neon.SSHLinuxSshProxy
    Neon.SSHLinuxSshProxyTMetadata

Namespace:  Neon.SSH
Assembly:  Neon.SSH (in Neon.SSH.dll) Version: 2.14.0
Syntax
public class LinuxSshProxy<TMetadata> : LinuxSshProxy
where TMetadata : class

Type Parameters

TMetadata
Defines the metadata type the application wishes to associate with the server. You may specify object when no additional metadata is required.

The LinuxSshProxyTMetadata type exposes the following members.

Constructors
  NameDescription
Public methodLinuxSshProxyTMetadata
Constructs a LinuxSshProxyTMetadata.
Top
Properties
  NameDescription
Public propertyAddress
The cluster private IP address to used for connecting to the remote machine.
(Inherited from LinuxSshProxy.)
Public propertyConnectTimeout
The connection attempt timeout. This defaults to 5 seconds.
(Inherited from LinuxSshProxy.)
Public propertyDefaultRunOptions
Specifies the default options to be bitwise ORed with any specific options passed to a run or sudo execution command when the Defaults flag is specified. This defaults to None.
(Inherited from LinuxSshProxy.)
Public propertyDownloadFolderPath
Returns the path to the user's download folder on the remote machine.
(Inherited from LinuxSshProxy.)
Public propertyFileTimeout
The file operation timeout. This defaults to 30 seconds.
(Inherited from LinuxSshProxy.)
Public propertyHomeFolderPath
Returns the path to the user's home folder on the remote machine.
(Inherited from LinuxSshProxy.)
Public propertyIsFaulted
Indicates that the remote machine is in a faulted state because one or more operations have failed.
(Inherited from LinuxSshProxy.)
Public propertyIsReady
Indicates that the remote machine has completed or has failed the current set of operations.
(Inherited from LinuxSshProxy.)
Public propertyMetadata
Applications may use this to associate metadata with the instance.
Public propertyName
Returns the display name for the remote machine.
(Inherited from LinuxSshProxy.)
Public propertyOsName

Returns the name of the remote operating system (e.g. "Ubuntu").

Note Note
This is only valid after a connection has been established.
(Inherited from LinuxSshProxy.)
Public propertyOsVersion

Returns the version of the remote operating system (e.g. "18.04.1").

Note Note
This is only valid after a connection has been established.
(Inherited from LinuxSshProxy.)
Public propertyRemotePath
The PATH to use on the remote machine when executing commands in the session or null/empty to run commands without a path. This defaults to the standard Linux path.
(Inherited from LinuxSshProxy.)
Public propertyRetryCount
The number of times to retry a failed remote command. This defaults to 5.
(Inherited from LinuxSshProxy.)
Public propertySshPort
The SSH port. This defaults to 22.
(Inherited from LinuxSshProxy.)
Public propertyStatus
The current remote machine status.
(Inherited from LinuxSshProxy.)
Public propertyUploadFolderPath
Returns the path to the user's upload folder on the remote machine.
(Inherited from LinuxSshProxy.)
Public propertyUsername
Returns the username used to log into the remote node.
(Inherited from LinuxSshProxy.)
Top
Methods
  NameDescription
Public methodClone
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.
Public methodCloneScpClient

Creates and returns a clone of a low-level ScpClient to the remote endpoint.

Note Note
The caller is responsible for disposing the returned instance.
(Inherited from LinuxSshProxy.)
Public methodCloneSshClient

Creates and returns a clone of a low-level SshClient to the remote endpoint.

Note Note
The caller is responsible for disposing the returned instance.
(Inherited from LinuxSshProxy.)
Protected methodCloneTo(LinuxSshProxy)
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.
(Inherited from LinuxSshProxy.)
Protected methodCloneTo(LinuxSshProxyTMetadata)
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.
Public methodConnect
Establishes a connection to the remote machine, disconnecting first if the proxy is already connected.
(Inherited from LinuxSshProxy.)
Public methodCreateShell
Creates an interactive shell.
(Inherited from LinuxSshProxy.)
Public methodCreateSudoShell
Creates an interactive shell for running with sudo permissions.
(Inherited from LinuxSshProxy.)
Public methodDirectoryExists
Determines whether a directory exists on the remote server.
(Inherited from LinuxSshProxy.)
Public methodDisableSudoPrompt

Prevents sudo from prompting for passwords and also ensures that the /home/root directory exists and has the appropriate permissions.

Note Note
The connected user must already be a member of the root group.
(Inherited from LinuxSshProxy.)
Public methodDisconnect
Closes any open connections to the Linux remote machine but leaves open the opportunity to reconnect later.
(Inherited from LinuxSshProxy.)
Public methodDispose
Releases all associated resources (e.g. any open remote machine connections).
(Inherited from LinuxSshProxy.)
Protected methodDispose(Boolean)
Releases all associated resources (e.g. any open server connections).
(Overrides LinuxSshProxyDispose(Boolean).)
Public methodDownload(String, Stream)
Downloads a file from the Linux server and writes it out a stream.
(Inherited from LinuxSshProxy.)
Public methodDownload(String, String)
Downloads a file from the remote node to the local file computer, creating parent folders as necessary.
(Inherited from LinuxSshProxy.)
Public methodDownloadBytes
Downloads a file as bytes from the Linux server .
(Inherited from LinuxSshProxy.)
Public methodDownloadText
Downloads a file as text from the Linux server.
(Inherited from LinuxSshProxy.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodFault
Puts the node proxy into the faulted state.
(Inherited from LinuxSshProxy.)
Public methodFileExists
Determines whether a file exists on the remote server.
(Inherited from LinuxSshProxy.)
Protected methodFinalize
Finalizer.
(Inherited from LinuxSshProxy.)
Protected methodGetAuthenticationMethod
Extracts the authentication method from SSH credentials.
(Inherited from LinuxSshProxy.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetNeonInitStatus
Returns an indication of whether the neon-init service has been executed on the remote machine. This service is deployed to neonKUBE cluster nodes to act as a poor-man's cloud-init to configure the network and credentials by mounting a virual ISO drive with a configuration script for non-cloud environments.
(Inherited from LinuxSshProxy.)
Public methodGetNetworkInterface
Returns the name of the network interface assigned to a specific IP address.
(Inherited from LinuxSshProxy.)
Public methodGetTimeUtc
Returns the current time (UTC) on the remote machine.
(Inherited from LinuxSshProxy.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodKubectlApply
Uses kubectl apply -f to apply a YAML file.
(Inherited from LinuxSshProxy.)
Public methodKubeCtlApply
Uses kubectl apply -f to apply a YAML file.
(Inherited from LinuxSshProxy.)
Public methodListDisks
Lists information about the disks on the remote machine.
(Inherited from LinuxSshProxy.)
Public methodListPartitionedDisks
Returns the names of any partitioned disks (excluding floppy disks).
(Inherited from LinuxSshProxy.)
Public methodListUnpartitionedDisks
Returns the names of any unpartitioned disks (excluding floppy disks).
(Inherited from LinuxSshProxy.)
Public methodLog
Writes text to the operation log.
(Inherited from LinuxSshProxy.)
Public methodLogException(Exception)
Writes exception information to the operation log.
(Inherited from LinuxSshProxy.)
Public methodLogException(String, Exception)
Writes exception information to the operation log.
(Inherited from LinuxSshProxy.)
Public methodLogFlush
Flushes the log.
(Inherited from LinuxSshProxy.)
Public methodLogLine
Writes a line of text to the operation log.
(Inherited from LinuxSshProxy.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodReboot
Reboot the remote machine.
(Inherited from LinuxSshProxy.)
Public methodRemoveFile
Removes a file on the server if it exists.
(Inherited from LinuxSshProxy.)
Public methodRunCommand(String, Object)
Runs a shell command on the Linux server.
(Inherited from LinuxSshProxy.)
Public methodRunCommand(CommandBundle, RunOptions)
Runs a CommandBundle with user permissions on the remote machine.
(Inherited from LinuxSshProxy.)
Public methodRunCommand(String, RunOptions, Object)
Runs a shell command on the Linux server with RunOptions.
(Inherited from LinuxSshProxy.)
Public methodSetNeonInitStatus
Manually sets the neon-init service execution status.
(Inherited from LinuxSshProxy.)
Public methodShutdown
Shutdown the remote machine.
(Inherited from LinuxSshProxy.)
Public methodSudoCommand(String, Object)
Runs a shell command on the Linux server under sudo.
(Inherited from LinuxSshProxy.)
Public methodSudoCommand(CommandBundle, RunOptions)
Runs a CommandBundle under sudo on the remote machine.
(Inherited from LinuxSshProxy.)
Public methodSudoCommand(String, RunOptions, Object)
Runs a shell command on the Linux server under sudo with RunOptions.
(Inherited from LinuxSshProxy.)
Public methodSudoCommandAsUser(String, String, Object)
Runs a shell command on the Linux server under sudo as a specific user.
(Inherited from LinuxSshProxy.)
Public methodSudoCommandAsUser(String, String, RunOptions, Object)
Runs a shell command on the Linux server under sudo as a specific user and with RunOptions.
(Inherited from LinuxSshProxy.)
Public methodToString
Returns a string that represents the current object.
(Inherited from LinuxSshProxy.)
Public methodUpdateCredentials
Updates the proxy credentials. Call this whenever you change the password or SSH certificate for the user account we're using for the current proxy connection. This ensures that the proxy will be able to reconnect to the service when required.
(Inherited from LinuxSshProxy.)
Public methodUpload
Uploads a binary stream to the Linux server and then writes it to the file system.
(Inherited from LinuxSshProxy.)
Public methodUploadBytes
Uploads a byte array to a Linux server file.
(Inherited from LinuxSshProxy.)
Public methodUploadText(String, String, Int32, Encoding, String, String)
Uploads a text string to the Linux server and then writes it to the file system, converting any CR-LF line endings to the Unix-style LF.
(Inherited from LinuxSshProxy.)
Public methodUploadText(String, StringBuilder, Int32, Encoding, String, String)
Uploads text from a StringBuilder to the Linux server and then writes it to the file system, converting any CR-LF line endings to the Unix-style LF.
(Inherited from LinuxSshProxy.)
Public methodUploadText(String, Stream, Int32, Encoding, Encoding, String, String)
Uploads a text stream to the Linux server and then writes it to the file system, converting any CR-LF line endings to the Unix-style LF.
(Inherited from LinuxSshProxy.)
Public methodVerifyCertificate
Verifies a TLS/SSL certificate.
(Inherited from LinuxSshProxy.)
Public methodWaitForBoot
Waits for the remote machine to boot by continuously attempting to establish a SSH session.
(Inherited from LinuxSshProxy.)
Top
Fields
  NameDescription
Protected fieldcredentials (Inherited from LinuxSshProxy.)
Protected fieldlogWriter (Inherited from LinuxSshProxy.)
Top
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 Note
You can use Clone to make a copy of a proxy that can be used to perform parallel operations against the same machine.
Thread Safety
Instance members of this type are not safe for multi-threaded operations.
See Also