• NeonSDK
  • NeonKUBE
Search Results for

    Show / Hide Table of Contents
    • Neon
      • Build
    • Neon.Blazor
      • BlazorHelper
      • BodyOutlet
      • ClientRenderContext
      • DOMRectReadOnly
      • EventHandlers
      • FileDownloader
      • HtmlElement
      • IRenderContext
      • IntersectionChangedEventArgs
      • IntersectionObserver
      • IntersectionObserverContext
      • MobileDetector
      • NeonBlazorExtensions
      • ServerRenderContext
      • SwipeDirection
      • SwipeHandler
    • Neon.Blazor.Analyzers
      • SvgGenerator
      • SvgGenerator.Svg
    • Neon.BuildInfo
      • ThisAssembly
      • ThisAssembly.Git
      • ThisAssembly.Git.BaseVersion
      • ThisAssembly.Git.SemVer
    • Neon.CSharp
      • CSharpHelper
      • CompilerErrorException
      • MetadataReferences
    • Neon.Cassandra
      • KeyspaceStatus
      • RowSetExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
      • SessionExtensions
    • Neon.Collections
      • ArgDictionary
      • Bits
      • IObjectDictionary
      • NiceDictionary<TKey, TValue>
      • ObjectDictionary
    • Neon.Common
      • AppDomainExtensions
      • Block
      • BlockArray
      • ByteEncoding
      • ByteUnits
      • CommandLine
      • CommandLine.OptionDefinition
      • CommandLine.Redactor
      • CpuArchitecture
      • Credentials
      • DateTimeExtensions
      • EnumExtensions
      • EnvironmentParser
      • EnvironmentParser.Parser<T>
      • EnvironmentParser.Validator<T>
      • EnvironmentParser.VariableSource
      • ExceptionExtensions
      • ExecuteException
      • ExecuteResponse
      • GlobPattern
      • HexDumpOption
      • HttpClientExtensions
      • HttpResponseMessageExtensions
      • IEnumerableExtensions
      • ILabeled
      • IOExtensions
      • IServiceContainer
      • IStaticDirectoryExtensions
      • LabelSelector
      • LabelSelectorOptions
      • LabelSelector<TItem>
      • NeonAssemblyExtensions
      • NeonExtendedHelper
      • NeonHelper
      • NetFramework
      • NewtonsoftExtensions
      • NotReadyException
      • ProcessExtensions
      • ProgramEntrypoint
      • ProgramEntrypointAsync
      • ProgramExitException
      • ProgramRunner
      • RandomExtensions
      • ReflectionExtensions
      • SemanticVersion
      • ServiceContainer
      • StaticZipOptions
      • StringBuilderExtensions
      • StringExtensions
      • Stub
      • Stub.Value
      • TaskExtensions
      • TimeSpanExtensions
      • ToolException
      • TriState
      • WeakEventController
      • WindowsEdition
      • WindowsFeatureStatus
      • YamlDotNetExtensions
    • Neon.Cryptography
      • AesCipher
      • CryptoExtensions
      • CryptoHelper
      • NeonVault
      • Wildcard
    • Neon.Csv
      • CsvReader
      • CsvTableReader
      • CsvTableWriter
      • CsvWriter
    • Neon.Data
      • DateTimeJsonConverter
      • DateTimeOffsetJsonConverter
      • IEnhancedJsonConverter
      • IGeneratedServiceClient
      • IPersistableType
      • IPersistableType<T>
      • IRoundtripData
      • IntegerEnumConverter<TEnum>
      • NotifyPropertyChanged
      • RoundtripDataFactory
      • RoundtripDataHelper
      • TimeSpanJsonConverter
      • VersionJsonConverter
    • Neon.Deployment
      • AwsCli
      • DeploymentException
      • DeploymentHelper
      • DownloadManifest
      • DownloadPart
      • DownloadProgressDelegate
      • DownloadProgressType
      • GitHub
      • GitHubActionsApi
      • GitHubPackage
      • GitHubPackageApi
      • GitHubPackageType
      • GitHubPackageVersion
      • GitHubPackageVisibility
      • GitHubReleaseApi
      • GitHubRepoPath
      • GitHubTagApi
      • IProfileClient
      • IProfileRequest
      • IProfileResponse
      • MaintainerProfile
      • NotifyClient
      • OnePassword
      • OnePasswordException
      • ProfileException
      • ProfileHandlerResult
      • ProfileRequest
      • ProfileResponse
      • ProfileServer
      • ProfileStatus
      • XenServer
    • Neon.Deployment.CodeSigning
      • AzureProfile
      • CodeSigner
      • UsbTokenProfile
    • Neon.Diagnostics
      • AssertException
      • ConfigExtensions
      • ConsoleJsonLogExporter
      • ConsoleJsonLogExporterOptions
      • ConsoleTextLogExporter
      • ConsoleTextLogExporterOptions
      • ExceptionInfo
      • FileLogExporter
      • FileLogExporterFormat
      • FileLogExporterOptions
      • LogAsTraceProcessor
      • LogAsTraceProcessorOptions
      • LogAttributeNames
      • LogAttributes
      • LogEvent
      • LogEventInterceptor
      • LoggerExtensions
      • NullLogger
      • TelemetryHub
      • TelemetrySpanEventNames
      • TelemetrySpanExtensions
    • Neon.Docker
      • DockerClient
      • DockerNetwork
      • DockerNetworkContainer
      • DockerNetworkIpam
      • DockerNode
      • DockerNodeManagerStatus
      • DockerResponse
      • DockerSettings
      • DockerVolume
      • NetworkCreateResponse
      • ServiceBindOptions
      • ServiceConfig
      • ServiceContainerSpec
      • ServiceCredentialSpec
      • ServiceDetails
      • ServiceDiscreteResourceSpec
      • ServiceDnsConfig
      • ServiceEndpoint
      • ServiceEndpointMode
      • ServiceEndpointPortConfig
      • ServiceEndpointSpec
      • ServiceFile
      • ServiceGenericResources
      • ServiceGlobalSchedulingMode
      • ServiceHealthCheck
      • ServiceIsolationMode
      • ServiceListResponse
      • ServiceLogDriver
      • ServiceMode
      • ServiceMount
      • ServiceMountBindPropagation
      • ServiceMountConsistency
      • ServiceMountType
      • ServiceNamedResourceSpec
      • ServiceNetwork
      • ServicePlacement
      • ServicePlacementPreferences
      • ServicePlacementSpreadSettings
      • ServicePlatform
      • ServicePortMode
      • ServicePortProtocol
      • ServicePrivileges
      • ServiceReplicatedSchedulingMode
      • ServiceResourceSettings
      • ServiceResources
      • ServiceRestartCondition
      • ServiceRestartPolicy
      • ServiceRollbackConfig
      • ServiceRollbackFailureAction
      • ServiceRollbackOrder
      • ServiceSELinuxContext
      • ServiceSchedulingMode
      • ServiceSecret
      • ServiceSpec
      • ServiceTaskTemplate
      • ServiceTmpfsOptions
      • ServiceUpdateConfig
      • ServiceUpdateFailureAction
      • ServiceUpdateOrder
      • ServiceUpdateState
      • ServiceUpdateStatus
      • ServiceVersion
      • ServiceVirtualIP
      • ServiceVolumeDriverConfig
      • ServiceVolumeOptions
      • VolumeListResponse
    • Neon.GitHub
      • GitExtensions
      • GitHubCredentials
      • GitHubRepo
      • LocalRepoApi
      • NoLocalRepositoryException
      • RemoteRepoApi
      • RemoteRepoBranchApi
      • RemoteRepoIssueApi
      • RemoteRepoIssueCommentApi
      • RemoteRepoPath
      • RemoteRepoReleaseApi
      • RemoteRepoTagApi
    • Neon.HyperV
      • HyperVClient
      • HyperVDriverType
      • HyperVException
      • NetAdapter
      • VirtualDrive
      • VirtualIPAddress
      • VirtualMachine
      • VirtualMachineNetworkAdapter
      • VirtualMachineState
      • VirtualNat
      • VirtualSwitch
      • VirtualSwitchType
    • Neon.IO
      • BlockStream
      • FixedLengthStream
      • IStaticDirectory
      • IStaticFile
      • LineEnding
      • LinuxPath
      • LinuxPermissions
      • PreprocessReader
      • RelayStream
      • StaticDirectoryBase
      • StaticFileBase
      • SubStream
      • TempFile
      • TempFolder
    • Neon.JsonConverters
      • JsonDateTimeConverter
      • JsonGenericConverter<T>
      • JsonNullableDateTimeConverter
    • Neon.ModelGen
      • ActionResult<T>
      • ApiVersion
      • ApiVersionAttribute
      • BodyStreamAttribute
      • ControllerValidationAttribute
      • DataModelAttribute
      • EnumMember
      • FromBodyAttribute
      • FromHeaderAttribute
      • FromQueryAttribute
      • FromRouteAttribute
      • GeneratedClientAttribute
      • GeneratedMethodAttribute
      • GeneratedParamAttribute
      • HashSourceAttribute
      • HttpAttribute
      • HttpDeleteAttribute
      • HttpGetAttribute
      • HttpHeadAttribute
      • HttpOptionsAttribute
      • HttpPatchAttribute
      • HttpPostAttribute
      • HttpPutAttribute
      • IActionResult
      • ModelGenerator
      • ModelGeneratorOutput
      • ModelGeneratorSettings
      • NoCodeGenAttribute
      • NoControllerValidationAttribute
      • PassAs
      • PersistableAttribute
      • PersistableKeyAttribute
      • RouteAttribute
      • ServiceModelAttribute
      • TargetAttribute
      • UxFrameworks
    • Neon.Net
      • HttpApiException
      • HttpException
      • JsonClient
      • JsonClientPayload
      • JsonResponse
      • Jwt
      • LocalHostSection
      • NetConst
      • NetHelper
      • NetworkCidr
      • NetworkConfiguration
      • NetworkException
      • NetworkPorts
      • Pinger
      • ReachableHost
      • ReachableHostMode
      • StreamDocument
    • Neon.Postgres
      • ConnectionExtensions
      • DatabaseStatus
      • PreparedCommand
      • ReaderAsyncEnumerator
      • ReaderEnumerator
      • ReaderExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
    • Neon.Retry
      • ExponentialRetryPolicy
      • IRetryPolicy
      • LinearRetryPolicy
      • NoRetryPolicy
      • RetryPolicy
      • RetryPolicyBase
      • RetryTransientArgs
      • TransientDetector
      • TransientException
    • Neon.Roslyn
      • DisplayFormat
      • DocumentationComment
      • DocumentationItem
      • MetadataLoadContext
      • RoslynAssembly
      • RoslynConstructorInfo
      • RoslynCustomAttributeData
      • RoslynExtensions
      • RoslynFieldInfo
      • RoslynMethodInfo
      • RoslynParameterInfo
      • RoslynPropertyInfo
      • RoslynType
      • SharedUtilities
    • Neon.Roslyn.Xunit
      • AdditionalSourceText
      • CompilationOptions
      • CompilationOptionsProvider
      • TestCompilation
      • TestCompilationAssertions
      • TestCompilationBuilder
      • TestCompilationBuilderExtensions
      • TestCompilationExtensions
    • Neon.SSH
      • CommandBundle
      • CommandFile
      • CommandResponse
      • HostFolders
      • IBashCommandFormatter
      • ILinuxSshProxy
      • LinuxDiskInfo
      • LinuxDiskPartition
      • LinuxSshProxy
      • LinuxSshProxy<TMetadata>
      • NamespaceDoc
      • RemoteCommandException
      • RunOptions
      • SshCredentials
      • SshExtensions
      • SshProxyException
    • Neon.Service
      • LogMetricsProcessor
      • MetricsMode
      • MetricsOptions
      • NeonService
      • NeonServiceOptions
      • NeonServiceStatus
      • OtelConfigExtensions
      • OtlpCollectorChecker
      • ProcessTerminator
      • ServiceApiContact
      • ServiceApiInfo
      • ServiceApiLicense
      • ServiceDependencies
      • ServiceDescription
      • ServiceEndpoint
      • ServiceEndpointProtocol
      • ServiceEndpoints
      • ServiceMap
    • Neon.SignalR
      • DependencyInjectionExtensions
      • DnsCache
      • GroupAction
      • GroupCommand
      • IDnsCache
      • Invocation
      • NatsHubLifetimeManager<THub>
      • ProxyConfig
      • ServiceCollectionExtensions
      • ServiceDiscovey
      • SignalrProxyMiddleware
      • SignalrProxyMiddlewareExtensions
      • TracerProviderBuilderExtensions
    • Neon.Tailwind
      • ClickOffEventHandler
      • ComponentEventArgs<TSender>
      • ComponentEventArgs<TSender, TEventArgs>
      • DisclosureState
      • EventHandlerComponentBase<TComponent>
      • HeadlessButton
      • HeadlessDialog
      • HeadlessDialogPanel
      • HeadlessDisclosure
      • HeadlessDisclosureButton
      • HeadlessDisclosurePanel
      • HeadlessListboxButton<TValue>
      • HeadlessListboxLabel<TValue>
      • HeadlessListboxOption<TValue>
      • HeadlessListboxOptions<TValue>
      • HeadlessListbox<TValue>
      • HeadlessMenu
      • HeadlessMenuButton
      • HeadlessMenuItem
      • HeadlessMenuItems
      • HeadlessSwitch
      • HeadlessSwitchGroup
      • HeadlessSwitchLabel
      • IPortalBinder
      • KeyDownEventHandler
      • KeyboardKey
      • ListboxFocus
      • ListboxState
      • MenuFocus
      • MenuState
      • Portal
      • PortalBinder
      • PortalContent
      • SearchAssistant
      • TailwindExtensions
      • Transition
      • TransitionGroup
      • TransitionState
    • Neon.Tasks
      • Async
      • AsyncAutoResetEvent
      • AsyncManualResetEvent
      • AsyncMutex
      • AsyncPeriodicTask
      • AsyncReaderWriterLock
      • AsyncReentrantMutex
      • AsyncTimer
      • IAsyncFuture
      • IAsyncFuture<T>
      • NonDisposableTask
      • NonDisposableTask<T>
      • SyncContext
      • SyncContextMode
    • Neon.Temporal
      • ActivityHelper
      • ActivityLogEnricher
      • TemporalEnricherTagNames
      • WorkflowLogEnricher
    • Neon.Time
      • GatedTimer
      • GoDuration
      • PolledTimer
      • RecurringTimer
      • RecurringTimerType
      • SysTime
      • TimeOfDay
    • Neon.WSL
      • Wsl2Proxy
    • Neon.Web
      • AesProtector
      • DataProtectionExtensions
      • NeonController
      • NeonControllerBase
      • RoundTripJsonInputFormatter
      • RoundTripJsonOutputFormatter
      • TracerProviderBuilderExtensions
      • WebHelper
    • Neon.WinTTY
      • ConsoleTTY
    • Neon.Windows
      • MEMORYSTATUSEX
      • PowerShellException
      • Win32
    • Neon.XenServer
      • IXenClient
      • XenClient
      • XenClient.MachineOperations
      • XenClient.StorageOperations
      • XenClient.TemplateOperations
      • XenException
      • XenHostInfo
      • XenObject
      • XenResponse
      • XenStorageRepository
      • XenTempIso
      • XenTemplate
      • XenVirtualDisk
      • XenVirtualMachine
      • XenVmPowerState
    • Neon.Xunit
      • AnsiblePlayResults
      • AnsiblePlayer
      • AnsibleTaskResult
      • AspNetFixture
      • BasicFixture
      • CodeFixture
      • CollectionComparer<T>
      • ComposedFixture
      • ContainerFixture
      • ContainerLimits
      • DockerComposeFixture
      • DockerFixture
      • DockerFixture.ConfigInfo
      • DockerFixture.ContainerInfo
      • DockerFixture.NetworkInfo
      • DockerFixture.SecretInfo
      • DockerFixture.ServiceInfo
      • DockerFixture.StackDefinition
      • DockerFixture.StackInfo
      • DockerFixture.StackService
      • EnvironmentFixture
      • HostsFixture
      • ITestFixture
      • IncompatibleServiceException
      • MaintainerFactAttribute
      • MaintainerTheoryAttribute
      • MockHttpServer
      • MockHttpServerExtensions
      • NatsFixture
      • NatsStreamingFixture
      • NeonServiceFixture<TService>
      • PlatformFactAttribute
      • RepeatAttribute
      • TargetPlatforms
      • TestArea
      • TestCollection
      • TestContext
      • TestFixture
      • TestFixtureStatus
      • TestHelper
      • TestHttpClient
      • TestOutputWriter
      • TestTrait
      • XunitExtensions
    • Neon.Xunit.YugaByte
      • YugaByteFixture
    • Neon.YugaByte
      • YugaByteHelper

    Interface ILinuxSshProxy

    Defines core methods and properties implemented by LinuxSshProxy.

    Namespace: Neon.SSH
    Assembly: Neon.SSH.dll
    Syntax
    public interface ILinuxSshProxy

    Properties

    Address

    The IP address to used for connecting to the remote machine.

    Declaration
    IPAddress Address { get; set; }
    Property Value
    Type Description
    IPAddress

    ConnectTimeout

    The connection attempt timeout. This defaults to 5 seconds.

    Declaration
    TimeSpan ConnectTimeout { get; set; }
    Property Value
    Type Description
    TimeSpan

    DefaultRunOptions

    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.

    Declaration
    RunOptions DefaultRunOptions { get; set; }
    Property Value
    Type Description
    RunOptions
    Remarks

    Setting this is a good way to specify a global default for flags like FaultOnError.

    DownloadFolderPath

    Returns the path to the user's download folder on the remote machine.

    Declaration
    string DownloadFolderPath { get; }
    Property Value
    Type Description
    string

    FileTimeout

    The file operation timeout. This defaults to 30 seconds.

    Declaration
    TimeSpan FileTimeout { get; set; }
    Property Value
    Type Description
    TimeSpan

    HomeFolderPath

    Returns the path to the user's home folder on the remote machine.

    Declaration
    string HomeFolderPath { get; }
    Property Value
    Type Description
    string

    IsConfiguring

    Used to indicate that the remote machine is actively being being configured. This property is a bit of a hack used when displaying the status of a NEONKUBE cluster setup.

    Declaration
    bool IsConfiguring { get; set; }
    Property Value
    Type Description
    bool

    IsFaulted

    Indicates that the remote machine is in a faulted state because one or more operations have failed. This property is a bit of a hack used when displaying the status of a NEONKUBE cluster setup.

    Declaration
    bool IsFaulted { get; set; }
    Property Value
    Type Description
    bool

    IsInvolved

    Used to indicate that the remote machine will be involved in a configuration step.
    This property is a bit of a hack used when displaying the status of a NEONKUBE cluster setup.

    Declaration
    bool IsInvolved { get; set; }
    Property Value
    Type Description
    bool

    IsReady

    Indicates that the remote machine has completed or has failed the current set of operations.
    This property is a bit of a hack used when displaying the status of a NEONKUBE cluster setup.

    Declaration
    bool IsReady { get; set; }
    Property Value
    Type Description
    bool
    Remarks
    note

    This will always return false if the remote machine when IsFaulted=true.

    KernelRelease

    Describes the Linux kernel release installed on the remote machine.

    note

    This currently assumes that the kernel versions returned by uname -r are formatted like:

    • 5.4.0
    • 5.4.0-66-generic
    • 5.4.72-microsoft-standard-WSL2

    This property returns the full release string. Use KernelVersion if you just want the version.

    Declaration
    string KernelRelease { get; }
    Property Value
    Type Description
    string

    KernelVersion

    Returns the Linux kernel release version installed on the remote machine.

    note

    This currently assumes that the kernel versions returned by uname -r are formatted like:

    • 5.4.0
    • 5.4.0-66-generic
    • 5.4.72-microsoft-standard-WSL2

    This property extracts the version (up to the first dash) and returns that and KernelRelease includes the full release text.

    Declaration
    Version KernelVersion { get; }
    Property Value
    Type Description
    Version

    Name

    Returns the display name for the remote machine.

    Declaration
    string Name { get; }
    Property Value
    Type Description
    string

    OsName

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

    note

    This is only valid after a connection has been established.

    Declaration
    string OsName { get; }
    Property Value
    Type Description
    string

    OsVersion

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

    note

    This is only valid after a connection has been established.

    Declaration
    Version OsVersion { get; }
    Property Value
    Type Description
    Version

    RemotePath

    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.

    Declaration
    string RemotePath { get; set; }
    Property Value
    Type Description
    string
    Remarks
    note

    When you modify this, be sure to use a colon (:) to separate multiple directories as required.

    RetryCount

    The number of times to retry a failed remote command.
    This defaults to 5.

    Declaration
    int RetryCount { get; set; }
    Property Value
    Type Description
    int

    SshPort

    The SSH port. This defaults to 22.

    Declaration
    int SshPort { get; set; }
    Property Value
    Type Description
    int

    Status

    The current remote machine status.

    Declaration
    string Status { get; set; }
    Property Value
    Type Description
    string
    Remarks

    This property is intended to be used by management tools to indicate the state of the remote machine for UX purposes. This property will be set by some methods such as WaitForBoot(TimeSpan?) but can also be set explicitly by tools when they have an operation in progress on the remote machine.

    note

    This will return a variation of *** FAULTED *** if IsFaulted=true.

    UploadFolderPath

    Returns the path to the user's upload folder on the remote machine.

    Declaration
    string UploadFolderPath { get; }
    Property Value
    Type Description
    string

    Username

    Returns the username used to log into the remote node.

    Declaration
    string Username { get; }
    Property Value
    Type Description
    string

    Methods

    CloneScpClient()

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

    note

    The caller is responsible for disposing the returned instance.

    Declaration
    ScpClient CloneScpClient()
    Returns
    Type Description
    ScpClient

    The cloned client.

    CloneSshClient()

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

    note

    The caller is responsible for disposing the returned instance.

    Declaration
    SshClient CloneSshClient()
    Returns
    Type Description
    SshClient

    The cloned client.

    Connect(TimeSpan)

    Establishes a connection to the remote machine, disconnecting first if the proxy is already connected.

    Declaration
    void Connect(TimeSpan timeout = default)
    Parameters
    Type Name Description
    TimeSpan timeout

    Maximum amount of time to wait for a connection (defaults to ConnectTimeout).

    Remarks
    note

    The first time a connection is established is called on a particular host, password credentials must be used so that low-level sudo configuration can be performed. Subsequent connections can use TLS certificates.

    Exceptions
    Type Condition
    SshProxyException

    Thrown if the host hasn't been prepared yet and the SSH connection credentials are not username/password or if there's problem with low-level host configuration.

    CreateShell()

    Creates an interactive shell.

    Declaration
    ShellStream CreateShell()
    Returns
    Type Description
    ShellStream

    A ShellStream.

    CreateSudoShell()

    Creates an interactive shell for running with sudo permissions.

    Declaration
    ShellStream CreateSudoShell()
    Returns
    Type Description
    ShellStream

    A ShellStream.

    DeleteDirectory(string)

    Deletes the directory if it exists.

    Declaration
    void DeleteDirectory(string path)
    Parameters
    Type Name Description
    string path

    The directory path.

    DeleteFile(string)

    Deletes the file if it exists.

    Declaration
    void DeleteFile(string path)
    Parameters
    Type Name Description
    string path

    The file path.

    DirectoryExists(string)

    Determines whether a directory exists on the remote server.

    Declaration
    bool DirectoryExists(string path)
    Parameters
    Type Name Description
    string path

    The directory path.

    Returns
    Type Description
    bool

    true if the directory exists.

    DisableSudoPrompt(string)

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

    note

    The connected user must already be a member of the root group.

    note

    You do not need to call Connect(TimeSpan) or WaitForBoot(TimeSpan?) before calling this method (in fact, calling those methods will probably fail).

    Declaration
    void DisableSudoPrompt(string password)
    Parameters
    Type Name Description
    string password

    The current user's password.

    Remarks

    This method uses the existence of a file at /etc/neon-sshproxy-init file to ensure that it only executes once per machine. This file will be created the first time this method is called on the machine.

    Disconnect()

    Closes any open connections to the Linux remote machine but leaves open the opportunity to reconnect later.

    Declaration
    void Disconnect()
    Remarks
    note

    This is similar to Dispose() but dispose does not allow reconnection.

    This command is useful situations where the client application may temporarily lose contact with the remote machine if for example, when it is rebooted or the network configuration changes.

    Download(string, Stream)

    Downloads a file from the Linux server and writes it out a stream.

    Declaration
    void Download(string source, Stream output)
    Parameters
    Type Name Description
    string source

    The source path of the file on the Linux server.

    Stream output

    The output stream.

    Download(string, string)

    Downloads a file from the remote node to the local file computer, creating parent folders as necessary.

    Declaration
    void Download(string source, string target)
    Parameters
    Type Name Description
    string source

    The source path on the Linux server.

    string target

    The target path on the local computer.

    DownloadBytes(string)

    Downloads a file as bytes from the Linux server .

    Declaration
    byte[] DownloadBytes(string source)
    Parameters
    Type Name Description
    string source

    The source path of the file on the Linux server.

    Returns
    Type Description
    byte[]

    The file contents as UTF8 text.

    DownloadText(string)

    Downloads a file as text from the Linux server.

    Declaration
    string DownloadText(string source)
    Parameters
    Type Name Description
    string source

    The source path of the file on the Linux server.

    Returns
    Type Description
    string

    The file contents as UTF8 text.

    Fault(string)

    Puts the node proxy into the faulted state.

    Declaration
    void Fault(string message = null)
    Parameters
    Type Name Description
    string message

    The optional message to be logged.

    FileExists(string)

    Determines whether a file exists on the remote server.

    Declaration
    bool FileExists(string path)
    Parameters
    Type Name Description
    string path

    The file path.

    Returns
    Type Description
    bool

    true if the file exists.

    GetNeonInitStatus()

    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 used to configure the network and credentials by mounting a virual ISO drive with a configuration script for non-cloud environments.

    note

    The neon-init service disables itself after running for the first time. You'll need to call SetNeonInitStatus(bool, bool) passing false the re-enable this service when required.

    Declaration
    bool GetNeonInitStatus()
    Returns
    Type Description
    bool

    true if neon-init has been executed.

    GetNetworkInterface(IPAddress)

    Returns the name of the network interface assigned to a specific IP address.

    Declaration
    string GetNetworkInterface(IPAddress address)
    Parameters
    Type Name Description
    IPAddress address

    The target IP address.

    Returns
    Type Description
    string

    The network interface name.

    Remarks

    In the olden days, network devices were assigned names like eth0, eth1,... during boot somewhat randomly and there was no guarantee that the same assignments would be made on subsequent server restarts.

    Modern Linux systems generate predictable network interfaces names during boot by enumerating the physical devices installed and generating device names based on the topology of the system (e.g. slots, channels,...). This is discussed here.

    note

    Cloud environments as well as environments where nodes hosted on hypervisors like Hyper-V or XenServer will still assign interface names like eth0... This method will still work for these environments.

    Exceptions
    Type Condition
    SshProxyException

    Thrown if the interface was not found.

    GetTimeUtc()

    Returns the current time (UTC) on the remote machine.

    Declaration
    DateTime GetTimeUtc()
    Returns
    Type Description
    DateTime

    The machine's current DateTime (UTC).

    KubeCtlApply(StringBuilder, RunOptions)

    Uses kubectl apply -f to apply a YAML file.

    Declaration
    CommandResponse KubeCtlApply(StringBuilder sbYaml, RunOptions runOptions = RunOptions.Defaults)
    Parameters
    Type Name Description
    StringBuilder sbYaml

    The YAML file contents.

    RunOptions runOptions

    Optional RunOptions.

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    KubectlApply(string, RunOptions)

    Uses kubectl apply -f to apply a YAML file.

    Declaration
    CommandResponse KubectlApply(string yaml, RunOptions runOptions = RunOptions.Defaults)
    Parameters
    Type Name Description
    string yaml

    The YAML file contents.

    RunOptions runOptions

    Optional RunOptions.

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    ListDisks(bool)

    Lists information about the disks on the remote machine.

    Declaration
    Dictionary<string, LinuxDiskInfo> ListDisks(bool fixedDisksOnly = true)
    Parameters
    Type Name Description
    bool fixedDisksOnly

    Optionally specifies that non-fixed disks should be returned as well (defaults to true).

    Returns
    Type Description
    Dictionary<string, LinuxDiskInfo>

    A Dictionary<TKey, TValue> relating the case sensitive disk name to a LinuxDiskInfo including information on the disk partitions.

    ListPartitionedDisks()

    Returns the names of any partitioned disks (excluding floppy disks).

    Declaration
    List<string> ListPartitionedDisks()
    Returns
    Type Description
    List<string>

    The names of the unpartitioned disks.

    ListUnpartitionedDisks()

    Returns the names of any unpartitioned disks (excluding floppy disks).

    Declaration
    List<string> ListUnpartitionedDisks()
    Returns
    Type Description
    List<string>

    The names of the unpartitioned disks.

    Log(string)

    Writes text to the operation log.

    Declaration
    void Log(string text)
    Parameters
    Type Name Description
    string text

    The text.

    LogException(Exception)

    Writes exception information to the operation log.

    Declaration
    void LogException(Exception e)
    Parameters
    Type Name Description
    Exception e

    The exception.

    LogException(string, Exception)

    Writes exception information to the operation log.

    Declaration
    void LogException(string message, Exception e)
    Parameters
    Type Name Description
    string message

    The operation details.

    Exception e

    The exception.

    LogFlush()

    Flushes the log.

    Declaration
    void LogFlush()

    LogLine(string)

    Writes a line of text to the operation log.

    Declaration
    void LogLine(string text)
    Parameters
    Type Name Description
    string text

    The text.

    Reboot(bool)

    Reboot the remote machine.

    Declaration
    void Reboot(bool wait = true)
    Parameters
    Type Name Description
    bool wait

    Optionally waits for the remote machine to reboot and then reconnects (defaults to true).

    RemoveFile(string)

    Removes a file on the server if it exists.

    Declaration
    void RemoveFile(string target)
    Parameters
    Type Name Description
    string target

    The path to the target file.

    RunCommand(CommandBundle, RunOptions)

    Runs a CommandBundle with user permissions on the remote machine.

    Declaration
    CommandResponse RunCommand(CommandBundle bundle, RunOptions runOptions = RunOptions.Defaults)
    Parameters
    Type Name Description
    CommandBundle bundle

    The bundle.

    RunOptions runOptions

    The execution options (defaults to Defaults).

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    Remarks
    note

    bundle may not include single quotes or redirect angle brackets such as < or >>. For more complex command, try uploading and executing a CommandBundle instead.

    This method is intended for situations where one or more files need to be uploaded to a cluster node and then be used when a command is executed.

    To use this class, construct an instance passing the command and arguments to be executed. The command be an absolute reference to an executable in folders such as /bin or /usr/local/bin, an executable somewhere on the current PATH, or relative to the files unpacked from the bundle. The current working directory will be set to the folder where the bundle was unpacked, so you can reference local executables like ./MyExecutable.

    Once a bundle is constructed, you will add CommandFile instances specifying the file data you want to include. These include the relative path to the file to be uploaded as well as its text or binary data. You may also indicate whether each file is to be marked as executable.

    note

    runOptions is set to Defaults by default. This means that the flags specified by DefaultRunOptions will be be used. This is a good way to specify a global default for flags like FaultOnError.

    note

    This command requires that the unzip package be installed on the host.

    RunCommand(string, RunOptions, params object[])

    Runs a shell command on the Linux server with RunOptions.

    Declaration
    CommandResponse RunCommand(string command, RunOptions runOptions, params object[] args)
    Parameters
    Type Name Description
    string command

    The command.

    RunOptions runOptions

    The execution options.

    object[] args

    The optional command arguments.

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    Remarks
    note

    command may not include single quotes or redirect angle brackets such as < or >>. For more complex command, try uploading and executing a CommandBundle instead.

    note

    Any null arguments will be ignored.

    The runOptions flags control how this command functions. If FaultOnError is set, then commands that return a non-zero exit code will put the server into the faulted state by setting IsFaulted=true and throwing a RemoteCommandException. This means that IsReady will always return false afterwards and subsequent calls to RunCommand(string, params object[]) and SudoCommand(string, params object[]) will be ignored unless RunWhenFaulted is passed with the future command. LogOnErrorOnly indicates that command output should be logged only for non-zero exit codes.

    Exceptions
    Type Condition
    RemoteCommandException

    Thrown if the command returned a non-zero exit code and FaultOnError was passed.

    RunCommand(string, params object[])

    Runs a shell command on the Linux server.

    Declaration
    CommandResponse RunCommand(string command, params object[] args)
    Parameters
    Type Name Description
    string command

    The command.

    object[] args

    The optional command arguments.

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    Remarks

    This method uses DefaultRunOptions when executing the command.

    You can override this behavior by passing an RunOptions to the RunCommand(string, RunOptions, params object[]) override.

    note

    Any null arguments will be ignored.

    SetNeonInitStatus(bool, bool)

    Manually sets the neon-init service execution status.

    The neon-init 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.

    Calling this with true will prevent the neon-init service from looking for a mounted ISO on next boot and executing the special script there. Calling this with false will re-enable the neon-init service when the machine is rebooted.

    note

    The neon-init service disables itself after running for the first time. You'll need to call SetNeonInitStatus(bool, bool) passing false the re-enable this service when required.

    Declaration
    void SetNeonInitStatus(bool initialized, bool keepNetworkSettings = false)
    Parameters
    Type Name Description
    bool initialized

    Pass true to indicate that the neon-init service has been executed, false to clear the status.

    bool keepNetworkSettings

    Optionally retains the static network settings when initialized is passed as false, otherwise the original (probably DHCP) settings will be restored.

    Shutdown()

    Shutdown the remote machine.

    Declaration
    void Shutdown()

    SudoCommand(CommandBundle, RunOptions)

    Runs a CommandBundle under sudo on the remote machine.

    Declaration
    CommandResponse SudoCommand(CommandBundle bundle, RunOptions runOptions = RunOptions.Defaults)
    Parameters
    Type Name Description
    CommandBundle bundle

    The bundle.

    RunOptions runOptions

    The execution options (defaults to Defaults).

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    Remarks

    This method is intended for situations where one or more files need to be uploaded to a cluster node and then be used when a command is executed.

    To use this class, construct an instance passing the command and arguments to be executed. The command be an absolute reference to an executable in folders such as /bin or /usr/local/bin, an executable somewhere on the current PATH, or relative to the files unpacked from the bundle. The current working directory will be set to the folder where the bundle was unpacked, so you can reference local executables like ./MyExecutable.

    Once a bundle is constructed, you will add CommandFile instances specifying the file data you want to include. These include the relative path to the file to be uploaded as well as its text or binary data. You may also indicate whether each file is to be marked as executable.

    note

    runOptions is set to Defaults by default. This means that the flags specified by DefaultRunOptions will be be used. This is a good way to specify a global default for flags like FaultOnError.

    note

    This command requires that the unzip package be installed on the host.

    SudoCommand(string, RunOptions, params object[])

    Runs a shell command on the Linux server under sudo with RunOptions.

    Declaration
    CommandResponse SudoCommand(string command, RunOptions runOptions, params object[] args)
    Parameters
    Type Name Description
    string command

    The command.

    RunOptions runOptions

    The execution options.

    object[] args

    The optional command arguments.

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    Remarks
    note

    command may not include single quotes or redirect angle brackets such as < or >>. For more complex command, try uploading and executing a CommandBundle instead.

    The runOptions flags control how this command functions. If FaultOnError is set, then commands that return a non-zero exit code will put the server into the faulted state by setting IsFaulted=true. This means that IsReady will always return false afterwards and subsequent command executions will be ignored unless RunWhenFaulted is specified for the future command.

    LogOnErrorOnly indicates that command output should be logged only for non-zero exit codes.

    note

    Any null arguments will be ignored.

    SudoCommand(string, params object[])

    Runs a shell command on the Linux server under sudo.

    Declaration
    CommandResponse SudoCommand(string command, params object[] args)
    Parameters
    Type Name Description
    string command

    The command.

    object[] args

    The optional command arguments.

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    Remarks
    note

    command may not include single quotes or redirect angle brackets such as < or >>. For more complex command, try uploading and executing a CommandBundle instead.

    This method uses the DefaultRunOptions when executing the command.

    You can override this behavior by passing an RunOptions to the RunCommand(string, RunOptions, params object[]) override.

    note

    Any null arguments will be ignored.

    SudoCommandAsUser(string, string, RunOptions, params object[])

    Runs a shell command on the Linux server under sudo as a specific user and with RunOptions.

    Declaration
    CommandResponse SudoCommandAsUser(string user, string command, RunOptions runOptions, params object[] args)
    Parameters
    Type Name Description
    string user

    The username.

    string command

    The command.

    RunOptions runOptions

    The execution options.

    object[] args

    The optional command arguments.

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    Remarks
    note

    command may not include single quotes or redirect angle brackets such as < or >>. For more complex command, try uploading and executing a CommandBundle instead.

    The runOptions flags control how this command functions. If FaultOnError is set, then commands that return a non-zero exit code will put the server into the faulted state by setting IsFaulted=true. This means that IsReady will always return false afterwards and subsequent command executions will be ignored unless RunWhenFaulted is specified for the future command.

    LogOnErrorOnly indicates that command output should be logged only for non-zero exit codes.

    note

    Any null arguments will be ignored.

    SudoCommandAsUser(string, string, params object[])

    Runs a shell command on the Linux server under sudo as a specific user.

    Declaration
    CommandResponse SudoCommandAsUser(string user, string command, params object[] args)
    Parameters
    Type Name Description
    string user

    The username.

    string command

    The command.

    object[] args

    The optional command arguments.

    Returns
    Type Description
    CommandResponse

    The CommandResponse.

    Remarks
    note

    command may not include single quotes or redirect angle brackets such as < or >>. For more complex command, try uploading and executing a CommandBundle instead.

    This method uses the DefaultRunOptions when executing the command.

    You can override this behavior by passing an RunOptions to the RunCommand(string, RunOptions, params object[]) override.

    note

    Any null arguments will be ignored.

    UpdateCredentials(SshCredentials)

    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.

    Declaration
    void UpdateCredentials(SshCredentials newCredentials)
    Parameters
    Type Name Description
    SshCredentials newCredentials

    The new credentials.

    Upload(string, Stream, string, string, bool)

    Uploads a binary stream to the Linux server and then writes it to the file system.

    Declaration
    void Upload(string target, Stream input, string permissions = null, string owner = null, bool userPermissions = false)
    Parameters
    Type Name Description
    string target

    The target path on the Linux server.

    Stream input

    The input stream.

    string permissions

    Optionally specifies the file permissions (must be chmod compatible).

    string owner

    Optionally specifies the file owner (must be chown compatible).

    bool userPermissions

    Optionally indicates that the operation should be performed with user-level permissions rather than sudo, which is the default.

    Remarks
    note

    Implementation Note: The SSH.NET library we're using does not allow for files to be uploaded directly to arbitrary file system locations, even if the logged-in user has admin permissions. The problem is that SSH.NET does not provide a way to use sudo to claim these higher permissions.

    The workaround is to create an upload folder in the user's home directory called ~/upload and upload the file there first and then use SSH to move the file to its target location under sudo.

    UploadBytes(string, byte[])

    Uploads a byte array to a Linux server file.

    Declaration
    void UploadBytes(string target, byte[] bytes)
    Parameters
    Type Name Description
    string target

    The target path of the file on the Linux server.

    byte[] bytes

    The bytes to be uploaded.

    UploadText(string, Stream, int, 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.

    Declaration
    void UploadText(string target, Stream textStream, int tabStop = 0, Encoding inputEncoding = null, Encoding outputEncoding = null, string permissions = null, string owner = null)
    Parameters
    Type Name Description
    string target

    The target path on the Linux server.

    Stream textStream

    The input stream.

    int tabStop

    Optionally expands TABs into spaces when greater than zero or converts a series of leading spaces into tabs if less than zero.

    Encoding inputEncoding

    Optionally specifies the input text encoding (defaults to UTF-8).

    Encoding outputEncoding

    Optionally specifies the output text encoding (defaults to UTF-8).

    string permissions

    Optionally specifies the file permissions (must be chmod compatible).

    string owner

    Optionally specifies the file owner (must be chown compatible).

    Remarks
    note

    Any Unicode Byte Order Marker (BOM) at start of the input stream will be removed.

    note

    Implementation Note: The SSH.NET library we're using does not allow for files to be uploaded directly to arbitrary file system locations, even if the logged-in user has admin permissions. The problem is that SSH.NET does not provide a way to use sudo to claim these higher permissions.

    The workaround is to create an upload folder in the user's home directory called ~/upload and upload the file there first and then use SSH to move the file to its target location under sudo.

    UploadText(string, string, int, 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.

    Declaration
    void UploadText(string target, string text, int tabStop = 0, Encoding outputEncoding = null, string permissions = null, string owner = null)
    Parameters
    Type Name Description
    string target

    The target path on the Linux server.

    string text

    The input text.

    int tabStop

    Optionally expands TABs into spaces when greater than zero or converts a series of leading spaces into tabs if less than zero.

    Encoding outputEncoding

    Optionally specifies the output text encoding (defaults to UTF-8).

    string permissions

    Optionally specifies the file permissions (must be chmod compatible).

    string owner

    Optionally specifies the file owner (must be chown compatible).

    Remarks
    note

    Implementation Note: The SSH.NET library we're using does not allow for files to be uploaded directly to arbitrary file system locations, even if the logged-in user has admin permissions. The problem is that SSH.NET does not provide a way to use sudo to claim these higher permissions.

    The workaround is to create an upload folder in the user's home directory called ~/upload and upload the file there first and then use SSH to move the file to its target location under sudo.

    UploadText(string, StringBuilder, int, 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.

    Declaration
    void UploadText(string target, StringBuilder text, int tabStop = 0, Encoding outputEncoding = null, string permissions = null, string owner = null)
    Parameters
    Type Name Description
    string target

    The target path on the Linux server.

    StringBuilder text

    The input text.

    int tabStop

    Optionally expands TABs into spaces when greater than zero or converts a series of leading spaces into tabs if less than zero.

    Encoding outputEncoding

    Optionally specifies the output text encoding (defaults to UTF-8).

    string permissions

    Optionally specifies the file permissions (must be chmod compatible).

    string owner

    Optionally specifies the file owner (must be chown compatible).

    Remarks
    note

    Implementation Note: The SSH.NET library we're using does not allow for files to be uploaded directly to arbitrary file system locations, even if the logged-in user has admin permissions. The problem is that SSH.NET does not provide a way to use sudo to claim these higher permissions.

    The workaround is to create an upload folder in the user's home directory called ~/upload and upload the file there first and then use SSH to move the file to its target location under sudo.

    WaitForBoot(TimeSpan?)

    Waits for the remote machine to boot by continuously attempting to establish a SSH session.

    Declaration
    void WaitForBoot(TimeSpan? timeout = null)
    Parameters
    Type Name Description
    TimeSpan? timeout

    The operation timeout (defaults to 10 minutes).

    Remarks
    note

    The first time a connection is established is called on a particular host, password credentials must be used so that low-level sudo configuration can be performed. Subsequent connections can use TLS certificates.

    The method will attempt to connect to the remote machine every 10 seconds up to the specified timeout. If it is unable to connect during this time, the exception thrown by the SSH client will be rethrown.

    Exceptions
    Type Condition
    SshProxyException

    Thrown if the host hasn't been prepared yet and the SSH connection credentials are not username/password or if there's problem with low-level host configuration.

    In this article
    Back to top © Copyright 2005-2023 by NEONFORGE LLC