80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace TheCr3w.Shared.Models;
|
|
|
|
/// <summary>
|
|
/// Model manifestu wdrożeniowego dla kontenerów Docker.
|
|
/// Podlega podpisywaniu Ed25519 oraz bramce akceptacyjnej SHA256.
|
|
/// </summary>
|
|
public class DeploymentManifest
|
|
{
|
|
[JsonPropertyName("manifest_id")]
|
|
public Guid ManifestId { get; set; } = Guid.NewGuid();
|
|
|
|
[JsonPropertyName("project")]
|
|
public string Project { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("environment")]
|
|
public string Environment { get; set; } = "production";
|
|
|
|
[JsonPropertyName("service_name")]
|
|
public string ServiceName { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("image")]
|
|
public string Image { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("immutable_digest")]
|
|
public string ImmutableDigest { get; set; } = string.Empty; // sha256:...
|
|
|
|
[JsonPropertyName("config_hash")]
|
|
public string ConfigHash { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("secrets_references")]
|
|
public List<string> SecretsReferences { get; set; } = new();
|
|
|
|
[JsonPropertyName("required_migrations")]
|
|
public List<string> RequiredMigrations { get; set; } = new();
|
|
|
|
[JsonPropertyName("healthcheck")]
|
|
public HealthcheckConfig Healthcheck { get; set; } = new();
|
|
|
|
[JsonPropertyName("rollback_strategy")]
|
|
public RollbackStrategyConfig RollbackStrategy { get; set; } = new();
|
|
|
|
[JsonPropertyName("created_at")]
|
|
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
|
|
|
|
[JsonPropertyName("created_by")]
|
|
public string CreatedBy { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("signature_ed25519")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? SignatureEd25519 { get; set; }
|
|
}
|
|
|
|
public class HealthcheckConfig
|
|
{
|
|
[JsonPropertyName("path")]
|
|
public string Path { get; set; } = "/health";
|
|
|
|
[JsonPropertyName("port")]
|
|
public int Port { get; set; } = 5000;
|
|
|
|
[JsonPropertyName("interval_seconds")]
|
|
public int IntervalSeconds { get; set; } = 10;
|
|
|
|
[JsonPropertyName("timeout_seconds")]
|
|
public int TimeoutSeconds { get; set; } = 5;
|
|
|
|
[JsonPropertyName("retries")]
|
|
public int Retries { get; set; } = 3;
|
|
}
|
|
|
|
public class RollbackStrategyConfig
|
|
{
|
|
[JsonPropertyName("mode")]
|
|
public string Mode { get; set; } = "automatic_on_health_failure";
|
|
|
|
[JsonPropertyName("target_immutable_digest")]
|
|
public string TargetImmutableDigest { get; set; } = "none";
|
|
}
|