118 lines
3.3 KiB
C#
118 lines
3.3 KiB
C#
|
|
using System.ComponentModel.DataAnnotations;
|
||
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
||
|
|
|
||
|
|
namespace OTSSignsOrchestrator.Core.Models.Entities;
|
||
|
|
|
||
|
|
public enum InstanceStatus
|
||
|
|
{
|
||
|
|
Deploying,
|
||
|
|
Active,
|
||
|
|
Error,
|
||
|
|
Deleted
|
||
|
|
}
|
||
|
|
|
||
|
|
public enum XiboApiTestStatus
|
||
|
|
{
|
||
|
|
Unknown,
|
||
|
|
Success,
|
||
|
|
Failed
|
||
|
|
}
|
||
|
|
|
||
|
|
public class CmsInstance
|
||
|
|
{
|
||
|
|
[Key]
|
||
|
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||
|
|
|
||
|
|
[Required, MaxLength(100)]
|
||
|
|
public string CustomerName { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
/// <summary>Exactly 3 lowercase letters used to derive all resource names.</summary>
|
||
|
|
[MaxLength(3)]
|
||
|
|
public string CustomerAbbrev { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
[Required, MaxLength(100)]
|
||
|
|
public string StackName { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
[Required, MaxLength(200)]
|
||
|
|
public string CmsServerName { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
[Required, Range(1024, 65535)]
|
||
|
|
public int HostHttpPort { get; set; }
|
||
|
|
|
||
|
|
[Required, MaxLength(500)]
|
||
|
|
public string ThemeHostPath { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
[Required, MaxLength(500)]
|
||
|
|
public string LibraryHostPath { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
[Required, MaxLength(200)]
|
||
|
|
public string SmtpServer { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
[Required, MaxLength(200)]
|
||
|
|
public string SmtpUsername { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// JSON array of placement constraints, e.g. ["node.labels.xibo==true"]
|
||
|
|
/// </summary>
|
||
|
|
[MaxLength(2000)]
|
||
|
|
public string? Constraints { get; set; }
|
||
|
|
|
||
|
|
[Required, MaxLength(500)]
|
||
|
|
public string TemplateRepoUrl { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
[MaxLength(500)]
|
||
|
|
public string? TemplateRepoPat { get; set; }
|
||
|
|
|
||
|
|
public DateTime? TemplateLastFetch { get; set; }
|
||
|
|
|
||
|
|
[MaxLength(100)]
|
||
|
|
public string? TemplateCacheKey { get; set; }
|
||
|
|
|
||
|
|
public InstanceStatus Status { get; set; } = InstanceStatus.Deploying;
|
||
|
|
|
||
|
|
/// <summary>Encrypted Xibo admin username for API access.</summary>
|
||
|
|
[MaxLength(500)]
|
||
|
|
public string? XiboUsername { get; set; }
|
||
|
|
|
||
|
|
/// <summary>Encrypted Xibo admin password. Never logged; encrypted at rest.</summary>
|
||
|
|
[MaxLength(1000)]
|
||
|
|
public string? XiboPassword { get; set; }
|
||
|
|
|
||
|
|
public XiboApiTestStatus XiboApiTestStatus { get; set; } = XiboApiTestStatus.Unknown;
|
||
|
|
|
||
|
|
public DateTime? XiboApiTestedAt { get; set; }
|
||
|
|
|
||
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||
|
|
|
||
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||
|
|
|
||
|
|
/// <summary>Soft delete marker.</summary>
|
||
|
|
public DateTime? DeletedAt { get; set; }
|
||
|
|
|
||
|
|
// ── CIFS / SMB credentials (per-instance) ─────────────────────────────
|
||
|
|
|
||
|
|
[MaxLength(200)]
|
||
|
|
public string? CifsServer { get; set; }
|
||
|
|
|
||
|
|
[MaxLength(500)]
|
||
|
|
public string? CifsShareBasePath { get; set; }
|
||
|
|
|
||
|
|
[MaxLength(200)]
|
||
|
|
public string? CifsUsername { get; set; }
|
||
|
|
|
||
|
|
/// <summary>Encrypted CIFS password. Never logged; encrypted at rest.</summary>
|
||
|
|
[MaxLength(1000)]
|
||
|
|
public string? CifsPassword { get; set; }
|
||
|
|
|
||
|
|
[MaxLength(500)]
|
||
|
|
public string? CifsExtraOptions { get; set; }
|
||
|
|
|
||
|
|
/// <summary>ID of the SshHost this instance is deployed to.</summary>
|
||
|
|
public Guid? SshHostId { get; set; }
|
||
|
|
|
||
|
|
[ForeignKey(nameof(SshHostId))]
|
||
|
|
public SshHost? SshHost { get; set; }
|
||
|
|
|
||
|
|
public ICollection<OperationLog> OperationLogs { get; set; } = new List<OperationLog>();
|
||
|
|
}
|