chore: update project structure with contracts and services for CaddyManager, including configuration and Docker integration
All checks were successful
Caddy Manager CI build / docker (push) Successful in 1m16s
All checks were successful
Caddy Manager CI build / docker (push) Successful in 1m16s
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
namespace CaddyManager.Contracts.Models.Caddy;
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the information parsed from the Caddy configuration file.
|
||||
/// </summary>
|
||||
public class CaddyConfigurationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Hostnames that are configured in the Caddyfile.
|
||||
/// </summary>
|
||||
public List<string> Hostnames { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The hostname of the reverse proxy server.
|
||||
/// </summary>
|
||||
public string ReverseProxyHostname { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Ports being used with the reverse proxy hostname
|
||||
/// </summary>
|
||||
public List<int> ReverseProxyPorts { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The name of the configuration file.
|
||||
/// </summary>
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Aggregated ports for the reverse proxy hostname from all configurations.
|
||||
/// </summary>
|
||||
public List<int> AggregatedReverseProxyPorts { get; set; } = [];
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is not CaddyConfigurationInfo other)
|
||||
return false;
|
||||
return FileName == other.FileName;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return FileName.GetHashCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace CaddyManager.Contracts.Models.Caddy;
|
||||
|
||||
/// <summary>
|
||||
/// Class to wrap the response of a Caddy delete operation
|
||||
/// </summary>
|
||||
public class CaddyDeleteOperationResponse : CaddyOperationResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// List of configurations that were successfully deleted
|
||||
/// </summary>
|
||||
public List<string> DeletedConfigurations { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace CaddyManager.Contracts.Models.Caddy;
|
||||
|
||||
/// <summary>
|
||||
/// Class to wrap the response of a generic Caddy operation
|
||||
/// </summary>
|
||||
public class CaddyOperationResponse
|
||||
{
|
||||
private string _message = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the operation was successful
|
||||
/// </summary>
|
||||
public bool Success { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Message to describe the operation result to provide more context
|
||||
/// </summary>
|
||||
public string Message
|
||||
{
|
||||
get => _message;
|
||||
set => _message = value ?? string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace CaddyManager.Contracts.Models.Caddy;
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the information needed to save a Caddy configuration
|
||||
/// </summary>
|
||||
public class CaddySaveConfigurationRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates if the configuration is new
|
||||
/// </summary>
|
||||
public bool IsNew { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the Caddy configuration file
|
||||
/// </summary>
|
||||
public required string FileName { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Content of the Caddy configuration file
|
||||
/// </summary>
|
||||
public string Content { get; set; } = string.Empty;
|
||||
}
|
||||
Reference in New Issue
Block a user