Files
OTSSignsOrchestrator/OTSSignsOrchestrator.Core/Models/Entities/SshHost.cs
Matt Batchelder adf1a2e4db
Some checks failed
Build and Publish Docker Image / build-and-push (push) Has been cancelled
Add WAL file for database and log instance deployment failures
2026-02-19 08:27:54 -05:00

58 lines
1.6 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace OTSSignsOrchestrator.Core.Models.Entities;
/// <summary>
/// Represents a remote Docker Swarm host accessible over SSH.
/// SSH key paths or encrypted passwords are stored for authentication.
/// </summary>
public class SshHost
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required, MaxLength(200)]
public string Label { get; set; } = string.Empty;
[Required, MaxLength(500)]
public string Host { get; set; } = string.Empty;
[Range(1, 65535)]
public int Port { get; set; } = 22;
[Required, MaxLength(100)]
public string Username { get; set; } = string.Empty;
/// <summary>
/// Path to the SSH private key file on the local machine.
/// </summary>
[MaxLength(1000)]
public string? PrivateKeyPath { get; set; }
/// <summary>
/// Encrypted passphrase for the SSH key (if any). Protected by DataProtection.
/// </summary>
[MaxLength(2000)]
public string? KeyPassphrase { get; set; }
/// <summary>
/// Encrypted SSH password (if key-based auth is not used). Protected by DataProtection.
/// </summary>
[MaxLength(2000)]
public string? Password { get; set; }
/// <summary>
/// Whether to prefer key-based auth over password.
/// </summary>
public bool UseKeyAuth { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
/// <summary>Last time a connection was successfully tested.</summary>
public DateTime? LastTestedAt { get; set; }
public bool? LastTestSuccess { get; set; }
}