39 lines
1.8 KiB
C#
39 lines
1.8 KiB
C#
using ControlPlane.Core.Models;
|
|
|
|
namespace ControlPlane.Core.Messages;
|
|
|
|
/// <summary>API -> Worker: kick off the saga.</summary>
|
|
public record ProvisionClientCommand
|
|
{
|
|
public Guid JobId { get; init; }
|
|
public string ClientName { get; init; } = string.Empty;
|
|
public string StateCode { get; init; } = string.Empty;
|
|
public string Subdomain { get; init; } = string.Empty;
|
|
public string AdminEmail { get; init; } = string.Empty;
|
|
public string SiteCode { get; init; } = string.Empty;
|
|
public string Environment { get; init; } = "fdev";
|
|
public TenantTier Tier { get; init; } = TenantTier.Shared;
|
|
}
|
|
|
|
/// <summary>Worker -> API/Gateway: one log event per saga step transition.</summary>
|
|
public record ProvisioningProgressEvent
|
|
{
|
|
public Guid JobId { get; init; }
|
|
public string Type { get; init; } = string.Empty; // step_started | step_complete | step_failed | job_complete | job_failed | diagnostic | compensation_started | compensation_complete
|
|
public string? Step { get; init; }
|
|
public string? Message { get; init; }
|
|
/// <summary>Full exception string (stack trace) for diagnostic events.</summary>
|
|
public string? Detail { get; init; }
|
|
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
|
|
}
|
|
|
|
/// <summary>Worker -> Gateway: published once when a job completes successfully. Triggers route registration.</summary>
|
|
public record TenantProvisionedEvent
|
|
{
|
|
public Guid JobId { get; init; }
|
|
public string Subdomain { get; init; } = string.Empty;
|
|
public TenantTier Tier { get; init; }
|
|
/// <summary>Base URL of the API instance for this tenant. For Shared/Isolated this is the shared API. For Dedicated it is the per-tenant instance.</summary>
|
|
public string ApiBaseUrl { get; init; } = string.Empty;
|
|
}
|