9cff87fe85
Remove project bookkeeping citations from shipped code comments across the solution: hyphenated task IDs (WP-14, StoreAndForward-025), milestone/task/ issue refs (M3, Task 4, Audit Log #23, #21), Bundle X task-bundle labels, and C/D/K/S/T phase labels. Comment text only — no code logic, string/log literals, or XML-doc structure changed. Genuine descriptions are preserved (only the citation is stripped), and technical lookalikes are retained (UTF-8, SHA-256, T00:00:00, M365, UTC-5, pre-C4/pre-C5 schema versions). Flagged by the new CommentChecker TaskReferenceInComment / TrackingReferenceInComment checks plus targeted grep passes; full solution builds clean, append-only guard tests pass.
100 lines
4.5 KiB
C#
100 lines
4.5 KiB
C#
using ZB.MOM.WW.Audit;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Types.Audit;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.ManagementService;
|
|
|
|
/// <summary>
|
|
/// Flat, wire-shape view of a canonical <see cref="ZB.MOM.WW.Audit.AuditEvent"/> for the
|
|
/// management CLI's <c>/api/audit/query</c> + <c>/api/audit/export</c> endpoints. The
|
|
/// canonical record was later made the repository seam type; this DTO preserves the
|
|
/// existing 24-field JSON/CSV shape the CLI consumes by decomposing the canonical row
|
|
/// (via <see cref="AuditRowProjection"/>) at the endpoint boundary.
|
|
/// </summary>
|
|
public sealed record AuditExportRow
|
|
{
|
|
/// <summary>Idempotency key.</summary>
|
|
public Guid EventId { get; init; }
|
|
/// <summary>UTC timestamp when the audited action occurred.</summary>
|
|
public DateTime OccurredAtUtc { get; init; }
|
|
/// <summary>UTC ingest timestamp; null until ingest.</summary>
|
|
public DateTime? IngestedAtUtc { get; init; }
|
|
/// <summary>Trust-boundary channel.</summary>
|
|
public AuditChannel Channel { get; init; }
|
|
/// <summary>Specific event kind.</summary>
|
|
public AuditKind Kind { get; init; }
|
|
/// <summary>Per-operation correlation id.</summary>
|
|
public Guid? CorrelationId { get; init; }
|
|
/// <summary>Originating execution id.</summary>
|
|
public Guid? ExecutionId { get; init; }
|
|
/// <summary>Spawning execution id; null for top-level runs.</summary>
|
|
public Guid? ParentExecutionId { get; init; }
|
|
/// <summary>Site id where the action originated.</summary>
|
|
public string? SourceSiteId { get; init; }
|
|
/// <summary>Cluster node that emitted the event.</summary>
|
|
public string? SourceNode { get; init; }
|
|
/// <summary>Instance id where the action originated.</summary>
|
|
public string? SourceInstanceId { get; init; }
|
|
/// <summary>Script that initiated the action.</summary>
|
|
public string? SourceScript { get; init; }
|
|
/// <summary>Authenticated actor.</summary>
|
|
public string? Actor { get; init; }
|
|
/// <summary>Target of the action.</summary>
|
|
public string? Target { get; init; }
|
|
/// <summary>Lifecycle status.</summary>
|
|
public AuditStatus Status { get; init; }
|
|
/// <summary>HTTP status code where applicable.</summary>
|
|
public int? HttpStatus { get; init; }
|
|
/// <summary>Duration of the action in ms.</summary>
|
|
public int? DurationMs { get; init; }
|
|
/// <summary>Human-readable error summary.</summary>
|
|
public string? ErrorMessage { get; init; }
|
|
/// <summary>Verbose error detail.</summary>
|
|
public string? ErrorDetail { get; init; }
|
|
/// <summary>Truncated/redacted request summary.</summary>
|
|
public string? RequestSummary { get; init; }
|
|
/// <summary>Truncated/redacted response summary.</summary>
|
|
public string? ResponseSummary { get; init; }
|
|
/// <summary>True when summaries were truncated.</summary>
|
|
public bool PayloadTruncated { get; init; }
|
|
/// <summary>Free-form JSON extension.</summary>
|
|
public string? Extra { get; init; }
|
|
/// <summary>Site-local forwarding state; always null on the central read path.</summary>
|
|
public AuditForwardState? ForwardState { get; init; }
|
|
|
|
/// <summary>Decomposes a canonical <see cref="AuditEvent"/> into this flat export shape.</summary>
|
|
/// <param name="evt">The audit event to decompose into the flat export row.</param>
|
|
/// <returns>A new <see cref="AuditExportRow"/> populated from the decomposed canonical row.</returns>
|
|
public static AuditExportRow From(AuditEvent evt)
|
|
{
|
|
var r = AuditRowProjection.Decompose(evt);
|
|
return new AuditExportRow
|
|
{
|
|
EventId = r.EventId,
|
|
OccurredAtUtc = r.OccurredAtUtc,
|
|
IngestedAtUtc = r.IngestedAtUtc,
|
|
Channel = r.Channel,
|
|
Kind = r.Kind,
|
|
CorrelationId = r.CorrelationId,
|
|
ExecutionId = r.ExecutionId,
|
|
ParentExecutionId = r.ParentExecutionId,
|
|
SourceSiteId = r.SourceSiteId,
|
|
SourceNode = r.SourceNode,
|
|
SourceInstanceId = r.SourceInstanceId,
|
|
SourceScript = r.SourceScript,
|
|
Actor = r.Actor,
|
|
Target = r.Target,
|
|
Status = r.Status,
|
|
HttpStatus = r.HttpStatus,
|
|
DurationMs = r.DurationMs,
|
|
ErrorMessage = r.ErrorMessage,
|
|
ErrorDetail = r.ErrorDetail,
|
|
RequestSummary = r.RequestSummary,
|
|
ResponseSummary = r.ResponseSummary,
|
|
PayloadTruncated = r.PayloadTruncated,
|
|
Extra = r.Extra,
|
|
ForwardState = null,
|
|
};
|
|
}
|
|
}
|