| | | 1 | | using System.Collections.ObjectModel; |
| | | 2 | | using System.Text.Json; |
| | | 3 | | using AsiBackbone.Core.Actors; |
| | | 4 | | using AsiBackbone.Core.Audit; |
| | | 5 | | using AsiBackbone.Core.Results; |
| | | 6 | | using AsiBackbone.EntityFrameworkCore.Persistence; |
| | | 7 | | using Microsoft.EntityFrameworkCore; |
| | | 8 | | using Microsoft.Extensions.Logging; |
| | | 9 | | |
| | | 10 | | namespace AsiBackbone.EntityFrameworkCore.Audit; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Entity Framework Core-backed audit ledger store that persists records through a host-owned <see cref="DbContext" />. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <remarks> |
| | | 16 | | /// This store is append-oriented and intentionally relies on the host application to expose the ASI Backbone entities f |
| | | 17 | | /// its own <see cref="DbContext" /> and migrations. It does not create a package-owned context or select a database pro |
| | | 18 | | /// </remarks> |
| | | 19 | | public sealed class EfCoreAuditLedgerStore : IAsiBackboneAuditLedgerStore |
| | | 20 | | { |
| | | 21 | | private const string AppendFailedReasonCode = "asi_backbone.audit_ledger.append_failed"; |
| | | 22 | | private const string AppendFailedReasonMessage = |
| | | 23 | | "The audit ledger record could not be persisted by the configured EF Core store."; |
| | | 24 | | |
| | 2 | 25 | | private static readonly Action<ILogger, string, Exception?> LogAuditLedgerAppendFailed = |
| | 2 | 26 | | LoggerMessage.Define<string>( |
| | 2 | 27 | | LogLevel.Error, |
| | 2 | 28 | | new EventId(1001, nameof(LogAuditLedgerAppendFailed)), |
| | 2 | 29 | | "EF Core audit ledger append failed for record {AuditLedgerRecordId}."); |
| | | 30 | | |
| | 2 | 31 | | private static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web); |
| | | 32 | | |
| | | 33 | | private readonly DbContext dbContext; |
| | | 34 | | private readonly ILogger<EfCoreAuditLedgerStore>? logger; |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Initializes a new instance of the <see cref="EfCoreAuditLedgerStore" /> class. |
| | | 38 | | /// </summary> |
| | | 39 | | /// <param name="dbContext">The host-owned database context.</param> |
| | | 40 | | /// <param name="logger">The optional host-owned logger used for internal persistence diagnostics.</param> |
| | 16 | 41 | | public EfCoreAuditLedgerStore( |
| | 16 | 42 | | DbContext dbContext, |
| | 16 | 43 | | ILogger<EfCoreAuditLedgerStore>? logger = null) |
| | | 44 | | { |
| | 16 | 45 | | ArgumentNullException.ThrowIfNull(dbContext); |
| | | 46 | | |
| | 16 | 47 | | this.dbContext = dbContext; |
| | 16 | 48 | | this.logger = logger; |
| | 16 | 49 | | } |
| | | 50 | | |
| | | 51 | | /// <inheritdoc /> |
| | | 52 | | public async ValueTask<OperationResult<AuditLedgerRecord>> AppendAsync( |
| | | 53 | | AuditLedgerRecord record, |
| | | 54 | | CancellationToken cancellationToken = default) |
| | | 55 | | { |
| | 16 | 56 | | ArgumentNullException.ThrowIfNull(record); |
| | 16 | 57 | | cancellationToken.ThrowIfCancellationRequested(); |
| | | 58 | | |
| | 16 | 59 | | AsiBackboneAuditLedgerRecordEntity entity = ToEntity(record); |
| | | 60 | | |
| | 16 | 61 | | _ = await dbContext |
| | 16 | 62 | | .Set<AsiBackboneAuditLedgerRecordEntity>() |
| | 16 | 63 | | .AddAsync(entity, cancellationToken) |
| | 16 | 64 | | .ConfigureAwait(false); |
| | | 65 | | |
| | 52 | 66 | | foreach (AsiBackboneAuditLedgerReasonCodeEntity reasonCode in ToReasonCodeEntities(entity.Id, record.ReasonCodes |
| | | 67 | | { |
| | 10 | 68 | | _ = await dbContext |
| | 10 | 69 | | .Set<AsiBackboneAuditLedgerReasonCodeEntity>() |
| | 10 | 70 | | .AddAsync(reasonCode, cancellationToken) |
| | 10 | 71 | | .ConfigureAwait(false); |
| | | 72 | | } |
| | | 73 | | |
| | 48 | 74 | | foreach (AsiBackboneAuditLedgerMetadataEntity metadata in ToMetadataEntities(entity.Id, record.Metadata)) |
| | | 75 | | { |
| | 8 | 76 | | _ = await dbContext |
| | 8 | 77 | | .Set<AsiBackboneAuditLedgerMetadataEntity>() |
| | 8 | 78 | | .AddAsync(metadata, cancellationToken) |
| | 8 | 79 | | .ConfigureAwait(false); |
| | | 80 | | } |
| | | 81 | | |
| | | 82 | | try |
| | | 83 | | { |
| | 16 | 84 | | _ = await dbContext.SaveChangesAsync(cancellationToken).ConfigureAwait(false); |
| | 12 | 85 | | } |
| | 4 | 86 | | catch (DbUpdateException ex) |
| | | 87 | | { |
| | 4 | 88 | | dbContext.ChangeTracker.Clear(); |
| | | 89 | | |
| | 4 | 90 | | if (logger is not null) |
| | | 91 | | { |
| | 0 | 92 | | LogAuditLedgerAppendFailed(logger, record.RecordId, ex); |
| | | 93 | | } |
| | | 94 | | |
| | 4 | 95 | | return OperationResult.Failure<AuditLedgerRecord>( |
| | 4 | 96 | | AppendFailedReasonCode, |
| | 4 | 97 | | AppendFailedReasonMessage); |
| | | 98 | | } |
| | | 99 | | |
| | 12 | 100 | | return OperationResult.Success(record); |
| | 16 | 101 | | } |
| | | 102 | | |
| | | 103 | | /// <inheritdoc /> |
| | | 104 | | public async ValueTask<AuditLedgerRecord?> FindByRecordIdAsync( |
| | | 105 | | string recordId, |
| | | 106 | | CancellationToken cancellationToken = default) |
| | | 107 | | { |
| | 8 | 108 | | ArgumentException.ThrowIfNullOrWhiteSpace(recordId); |
| | | 109 | | |
| | 8 | 110 | | string normalizedRecordId = recordId.Trim(); |
| | | 111 | | |
| | 8 | 112 | | AsiBackboneAuditLedgerRecordEntity? entity = await LedgerRecords() |
| | 8 | 113 | | .Where(record => record.RecordId == normalizedRecordId) |
| | 8 | 114 | | .SingleOrDefaultAsync(cancellationToken) |
| | 8 | 115 | | .ConfigureAwait(false); |
| | | 116 | | |
| | 8 | 117 | | return entity is null ? null : ToRecord(entity); |
| | 8 | 118 | | } |
| | | 119 | | |
| | | 120 | | /// <inheritdoc /> |
| | | 121 | | public async ValueTask<IReadOnlyList<AuditLedgerRecord>> FindByCorrelationIdAsync( |
| | | 122 | | string correlationId, |
| | | 123 | | CancellationToken cancellationToken = default) |
| | | 124 | | { |
| | 2 | 125 | | ArgumentException.ThrowIfNullOrWhiteSpace(correlationId); |
| | | 126 | | |
| | 2 | 127 | | string normalizedCorrelationId = correlationId.Trim(); |
| | | 128 | | |
| | 2 | 129 | | List<AsiBackboneAuditLedgerRecordEntity> entities = await LedgerRecords() |
| | 2 | 130 | | .Where(record => record.CorrelationId == normalizedCorrelationId) |
| | 2 | 131 | | .OrderBy(record => record.RecordedUtc) |
| | 2 | 132 | | .ThenBy(record => record.RecordId) |
| | 2 | 133 | | .ToListAsync(cancellationToken) |
| | 2 | 134 | | .ConfigureAwait(false); |
| | | 135 | | |
| | 2 | 136 | | return ToRecords(entities); |
| | 2 | 137 | | } |
| | | 138 | | |
| | | 139 | | /// <inheritdoc /> |
| | | 140 | | public async ValueTask<IReadOnlyList<AuditLedgerRecord>> FindByTraceIdAsync( |
| | | 141 | | string traceId, |
| | | 142 | | CancellationToken cancellationToken = default) |
| | | 143 | | { |
| | 2 | 144 | | ArgumentException.ThrowIfNullOrWhiteSpace(traceId); |
| | | 145 | | |
| | 2 | 146 | | string normalizedTraceId = traceId.Trim(); |
| | | 147 | | |
| | 2 | 148 | | List<AsiBackboneAuditLedgerRecordEntity> entities = await LedgerRecords() |
| | 2 | 149 | | .Where(record => record.TraceId == normalizedTraceId) |
| | 2 | 150 | | .OrderBy(record => record.RecordedUtc) |
| | 2 | 151 | | .ThenBy(record => record.RecordId) |
| | 2 | 152 | | .ToListAsync(cancellationToken) |
| | 2 | 153 | | .ConfigureAwait(false); |
| | | 154 | | |
| | 2 | 155 | | return ToRecords(entities); |
| | 2 | 156 | | } |
| | | 157 | | |
| | | 158 | | /// <inheritdoc /> |
| | | 159 | | public async ValueTask<IReadOnlyList<AuditLedgerRecord>> FindByActorIdAsync( |
| | | 160 | | string actorId, |
| | | 161 | | CancellationToken cancellationToken = default) |
| | | 162 | | { |
| | 2 | 163 | | ArgumentException.ThrowIfNullOrWhiteSpace(actorId); |
| | | 164 | | |
| | 2 | 165 | | string normalizedActorId = actorId.Trim(); |
| | | 166 | | |
| | 2 | 167 | | List<AsiBackboneAuditLedgerRecordEntity> entities = await LedgerRecords() |
| | 2 | 168 | | .Where(record => record.ActorId == normalizedActorId) |
| | 2 | 169 | | .OrderBy(record => record.RecordedUtc) |
| | 2 | 170 | | .ThenBy(record => record.RecordId) |
| | 2 | 171 | | .ToListAsync(cancellationToken) |
| | 2 | 172 | | .ConfigureAwait(false); |
| | | 173 | | |
| | 2 | 174 | | return ToRecords(entities); |
| | 2 | 175 | | } |
| | | 176 | | |
| | | 177 | | /// <inheritdoc /> |
| | | 178 | | public async ValueTask<IReadOnlyList<AuditLedgerRecord>> FindByRecordedUtcRangeAsync( |
| | | 179 | | DateTimeOffset recordedFromUtc, |
| | | 180 | | DateTimeOffset recordedToUtc, |
| | | 181 | | CancellationToken cancellationToken = default) |
| | | 182 | | { |
| | 4 | 183 | | DateTimeOffset normalizedFromUtc = recordedFromUtc.ToUniversalTime(); |
| | 4 | 184 | | DateTimeOffset normalizedToUtc = recordedToUtc.ToUniversalTime(); |
| | | 185 | | |
| | 4 | 186 | | if (normalizedFromUtc > normalizedToUtc) |
| | | 187 | | { |
| | 2 | 188 | | throw new ArgumentException( |
| | 2 | 189 | | "The recorded UTC range start must be less than or equal to the range end.", |
| | 2 | 190 | | nameof(recordedFromUtc)); |
| | | 191 | | } |
| | | 192 | | |
| | 2 | 193 | | List<AsiBackboneAuditLedgerRecordEntity> entities = await LedgerRecords() |
| | 2 | 194 | | .Where(record => record.RecordedUtc >= normalizedFromUtc && record.RecordedUtc <= normalizedToUtc) |
| | 2 | 195 | | .OrderBy(record => record.RecordedUtc) |
| | 2 | 196 | | .ThenBy(record => record.RecordId) |
| | 2 | 197 | | .ToListAsync(cancellationToken) |
| | 2 | 198 | | .ConfigureAwait(false); |
| | | 199 | | |
| | 2 | 200 | | return ToRecords(entities); |
| | 2 | 201 | | } |
| | | 202 | | |
| | | 203 | | private IQueryable<AsiBackboneAuditLedgerRecordEntity> LedgerRecords() |
| | | 204 | | { |
| | 16 | 205 | | return dbContext.Set<AsiBackboneAuditLedgerRecordEntity>().AsNoTracking(); |
| | | 206 | | } |
| | | 207 | | |
| | | 208 | | private static AsiBackboneAuditLedgerRecordEntity ToEntity(AuditLedgerRecord record) |
| | | 209 | | { |
| | 16 | 210 | | return new AsiBackboneAuditLedgerRecordEntity |
| | 16 | 211 | | { |
| | 16 | 212 | | RecordId = record.RecordId, |
| | 16 | 213 | | SchemaVersion = record.SchemaVersion, |
| | 16 | 214 | | EventId = record.EventId, |
| | 16 | 215 | | AuditResidueId = record.AuditResidueId, |
| | 16 | 216 | | OccurredUtc = record.OccurredUtc, |
| | 16 | 217 | | RecordedUtc = record.RecordedUtc, |
| | 16 | 218 | | ActorId = record.ActorId, |
| | 16 | 219 | | ActorType = record.ActorType, |
| | 16 | 220 | | ActorDisplayName = record.ActorDisplayName, |
| | 16 | 221 | | OperationName = record.OperationName, |
| | 16 | 222 | | Outcome = record.Outcome, |
| | 16 | 223 | | ReasonCodesJson = JsonSerializer.Serialize(record.ReasonCodes, JsonOptions), |
| | 16 | 224 | | CorrelationId = record.CorrelationId, |
| | 16 | 225 | | TraceId = record.TraceId, |
| | 16 | 226 | | SpanId = record.SpanId, |
| | 16 | 227 | | ParentSpanId = record.ParentSpanId, |
| | 16 | 228 | | DecisionLatencyMs = record.DecisionLatencyMs, |
| | 16 | 229 | | ConstraintSetHash = record.ConstraintSetHash, |
| | 16 | 230 | | ConstraintCount = record.ConstraintCount, |
| | 16 | 231 | | RiskScore = record.RiskScore, |
| | 16 | 232 | | PolicyScope = record.PolicyScope, |
| | 16 | 233 | | TenantHash = record.TenantHash, |
| | 16 | 234 | | OrganizationHash = record.OrganizationHash, |
| | 16 | 235 | | EmitterStatus = record.EmitterStatus, |
| | 16 | 236 | | EmitterProvider = record.EmitterProvider, |
| | 16 | 237 | | OutboxSequence = record.OutboxSequence, |
| | 16 | 238 | | GatewayExecutionId = record.GatewayExecutionId, |
| | 16 | 239 | | DecisionStage = record.DecisionStage, |
| | 16 | 240 | | PolicyVersion = record.PolicyVersion, |
| | 16 | 241 | | PolicyHash = record.PolicyHash, |
| | 16 | 242 | | HandshakeId = record.HandshakeId, |
| | 16 | 243 | | AcknowledgmentId = record.AcknowledgmentId, |
| | 16 | 244 | | CapabilityTokenId = record.CapabilityTokenId, |
| | 16 | 245 | | PreviousRecordHash = record.PreviousRecordHash, |
| | 16 | 246 | | RecordHash = record.RecordHash, |
| | 16 | 247 | | SigningHash = record.SigningHash, |
| | 16 | 248 | | SignatureKeyId = record.SignatureKeyId, |
| | 16 | 249 | | SignatureKeyVersion = record.SignatureKeyVersion, |
| | 16 | 250 | | SignatureAlgorithm = record.SignatureAlgorithm, |
| | 16 | 251 | | SignatureValue = record.SignatureValue, |
| | 16 | 252 | | SignatureProvider = record.SignatureProvider, |
| | 16 | 253 | | SignedUtc = record.SignedUtc, |
| | 16 | 254 | | MetadataJson = JsonSerializer.Serialize(record.Metadata, JsonOptions) |
| | 16 | 255 | | }; |
| | | 256 | | } |
| | | 257 | | |
| | | 258 | | private static AsiBackboneAuditLedgerReasonCodeEntity[] ToReasonCodeEntities( |
| | | 259 | | Guid auditLedgerRecordId, |
| | | 260 | | IReadOnlyList<string> reasonCodes) |
| | | 261 | | { |
| | 16 | 262 | | return [.. reasonCodes |
| | 26 | 263 | | .Select((reasonCode, index) => new AsiBackboneAuditLedgerReasonCodeEntity |
| | 26 | 264 | | { |
| | 26 | 265 | | AuditLedgerRecordId = auditLedgerRecordId, |
| | 26 | 266 | | Sequence = index, |
| | 26 | 267 | | ReasonCode = reasonCode |
| | 26 | 268 | | })]; |
| | | 269 | | } |
| | | 270 | | |
| | | 271 | | private static AsiBackboneAuditLedgerMetadataEntity[] ToMetadataEntities( |
| | | 272 | | Guid auditLedgerRecordId, |
| | | 273 | | IReadOnlyDictionary<string, string> metadata) |
| | | 274 | | { |
| | 16 | 275 | | return [.. metadata |
| | 24 | 276 | | .Select(item => new AsiBackboneAuditLedgerMetadataEntity |
| | 24 | 277 | | { |
| | 24 | 278 | | AuditLedgerRecordId = auditLedgerRecordId, |
| | 24 | 279 | | MetadataKey = item.Key, |
| | 24 | 280 | | MetadataValue = item.Value |
| | 24 | 281 | | })]; |
| | | 282 | | } |
| | | 283 | | |
| | | 284 | | private static AuditLedgerRecord[] ToRecords(IEnumerable<AsiBackboneAuditLedgerRecordEntity> entities) |
| | | 285 | | { |
| | 8 | 286 | | return [.. entities.Select(ToRecord)]; |
| | | 287 | | } |
| | | 288 | | |
| | | 289 | | private static AuditLedgerRecord ToRecord(AsiBackboneAuditLedgerRecordEntity entity) |
| | | 290 | | { |
| | 20 | 291 | | string[] reasonCodes = DeserializeReasonCodes(entity.ReasonCodesJson); |
| | 20 | 292 | | ReadOnlyDictionary<string, string> metadata = DeserializeMetadata(entity.MetadataJson); |
| | | 293 | | |
| | 20 | 294 | | var residue = new EntityAuditResidue( |
| | 20 | 295 | | entity.EventId, |
| | 20 | 296 | | entity.AuditResidueId, |
| | 20 | 297 | | entity.SchemaVersion, |
| | 20 | 298 | | entity.OccurredUtc, |
| | 20 | 299 | | entity.ActorId, |
| | 20 | 300 | | entity.ActorType, |
| | 20 | 301 | | entity.ActorDisplayName, |
| | 20 | 302 | | entity.OperationName, |
| | 20 | 303 | | entity.Outcome, |
| | 20 | 304 | | Array.AsReadOnly(reasonCodes), |
| | 20 | 305 | | entity.CorrelationId, |
| | 20 | 306 | | entity.TraceId, |
| | 20 | 307 | | entity.SpanId, |
| | 20 | 308 | | entity.ParentSpanId, |
| | 20 | 309 | | entity.DecisionLatencyMs, |
| | 20 | 310 | | entity.ConstraintSetHash, |
| | 20 | 311 | | entity.ConstraintCount, |
| | 20 | 312 | | entity.RiskScore, |
| | 20 | 313 | | entity.PolicyScope, |
| | 20 | 314 | | entity.TenantHash, |
| | 20 | 315 | | entity.OrganizationHash, |
| | 20 | 316 | | entity.EmitterStatus, |
| | 20 | 317 | | entity.EmitterProvider, |
| | 20 | 318 | | entity.OutboxSequence, |
| | 20 | 319 | | entity.GatewayExecutionId, |
| | 20 | 320 | | entity.DecisionStage, |
| | 20 | 321 | | entity.PolicyVersion, |
| | 20 | 322 | | entity.PolicyHash, |
| | 20 | 323 | | metadata); |
| | | 324 | | |
| | 20 | 325 | | return AuditLedgerRecord.FromResidue( |
| | 20 | 326 | | residue, |
| | 20 | 327 | | entity.RecordId, |
| | 20 | 328 | | entity.RecordedUtc, |
| | 20 | 329 | | entity.HandshakeId, |
| | 20 | 330 | | entity.AcknowledgmentId, |
| | 20 | 331 | | entity.CapabilityTokenId, |
| | 20 | 332 | | entity.PreviousRecordHash, |
| | 20 | 333 | | entity.RecordHash, |
| | 20 | 334 | | entity.SignatureKeyId, |
| | 20 | 335 | | entity.SignatureAlgorithm, |
| | 20 | 336 | | entity.SignatureValue, |
| | 20 | 337 | | signingHash: entity.SigningHash, |
| | 20 | 338 | | signatureKeyVersion: entity.SignatureKeyVersion, |
| | 20 | 339 | | signatureProvider: entity.SignatureProvider, |
| | 20 | 340 | | signedUtc: entity.SignedUtc, |
| | 20 | 341 | | schemaVersion: entity.SchemaVersion); |
| | | 342 | | } |
| | | 343 | | |
| | | 344 | | private static string[] DeserializeReasonCodes(string? json) |
| | | 345 | | { |
| | 20 | 346 | | return string.IsNullOrWhiteSpace(json) |
| | 20 | 347 | | ? [] |
| | 20 | 348 | | : JsonSerializer.Deserialize<string[]>(json, JsonOptions) ?? []; |
| | | 349 | | } |
| | | 350 | | |
| | | 351 | | private static ReadOnlyDictionary<string, string> DeserializeMetadata(string? json) |
| | | 352 | | { |
| | 20 | 353 | | if (string.IsNullOrWhiteSpace(json)) |
| | | 354 | | { |
| | 2 | 355 | | return new ReadOnlyDictionary<string, string>(new Dictionary<string, string>(StringComparer.Ordinal)); |
| | | 356 | | } |
| | | 357 | | |
| | 18 | 358 | | Dictionary<string, string>? metadata = JsonSerializer.Deserialize<Dictionary<string, string>>(json, JsonOptions) |
| | | 359 | | |
| | 18 | 360 | | return metadata is null || metadata.Count == 0 |
| | 18 | 361 | | ? new ReadOnlyDictionary<string, string>(new Dictionary<string, string>(StringComparer.Ordinal)) |
| | 18 | 362 | | : new ReadOnlyDictionary<string, string>(new Dictionary<string, string>(metadata, StringComparer.Ordinal)); |
| | | 363 | | } |
| | | 364 | | |
| | 20 | 365 | | private sealed class EntityAuditResidue( |
| | 20 | 366 | | string eventId, |
| | 20 | 367 | | string? auditResidueId, |
| | 20 | 368 | | string schemaVersion, |
| | 20 | 369 | | DateTimeOffset occurredUtc, |
| | 20 | 370 | | string actorId, |
| | 20 | 371 | | AsiBackboneActorType actorType, |
| | 20 | 372 | | string? actorDisplayName, |
| | 20 | 373 | | string operationName, |
| | 20 | 374 | | string outcome, |
| | 20 | 375 | | IReadOnlyList<string> reasonCodes, |
| | 20 | 376 | | string? correlationId, |
| | 20 | 377 | | string? traceId, |
| | 20 | 378 | | string? spanId, |
| | 20 | 379 | | string? parentSpanId, |
| | 20 | 380 | | long? decisionLatencyMs, |
| | 20 | 381 | | string? constraintSetHash, |
| | 20 | 382 | | int? constraintCount, |
| | 20 | 383 | | double? riskScore, |
| | 20 | 384 | | string? policyScope, |
| | 20 | 385 | | string? tenantHash, |
| | 20 | 386 | | string? organizationHash, |
| | 20 | 387 | | string? emitterStatus, |
| | 20 | 388 | | string? emitterProvider, |
| | 20 | 389 | | long? outboxSequence, |
| | 20 | 390 | | string? gatewayExecutionId, |
| | 20 | 391 | | string? decisionStage, |
| | 20 | 392 | | string? policyVersion, |
| | 20 | 393 | | string? policyHash, |
| | 20 | 394 | | IReadOnlyDictionary<string, string> metadata) : IAsiBackboneAuditResidue |
| | | 395 | | { |
| | 40 | 396 | | public string EventId { get; } = eventId; |
| | | 397 | | |
| | 40 | 398 | | public string? AuditResidueId { get; } = auditResidueId; |
| | | 399 | | |
| | 20 | 400 | | public string SchemaVersion { get; } = schemaVersion; |
| | | 401 | | |
| | 40 | 402 | | public DateTimeOffset OccurredUtc { get; } = occurredUtc; |
| | | 403 | | |
| | 40 | 404 | | public string ActorId { get; } = actorId; |
| | | 405 | | |
| | 40 | 406 | | public AsiBackboneActorType ActorType { get; } = actorType; |
| | | 407 | | |
| | 40 | 408 | | public string? ActorDisplayName { get; } = actorDisplayName; |
| | | 409 | | |
| | 40 | 410 | | public string OperationName { get; } = operationName; |
| | | 411 | | |
| | 40 | 412 | | public string Outcome { get; } = outcome; |
| | | 413 | | |
| | 40 | 414 | | public IReadOnlyList<string> ReasonCodes { get; } = reasonCodes; |
| | | 415 | | |
| | 40 | 416 | | public string? CorrelationId { get; } = correlationId; |
| | | 417 | | |
| | 40 | 418 | | public string? TraceId { get; } = traceId; |
| | | 419 | | |
| | 40 | 420 | | public string? SpanId { get; } = spanId; |
| | | 421 | | |
| | 40 | 422 | | public string? ParentSpanId { get; } = parentSpanId; |
| | | 423 | | |
| | 40 | 424 | | public long? DecisionLatencyMs { get; } = decisionLatencyMs; |
| | | 425 | | |
| | 40 | 426 | | public string? ConstraintSetHash { get; } = constraintSetHash; |
| | | 427 | | |
| | 40 | 428 | | public int? ConstraintCount { get; } = constraintCount; |
| | | 429 | | |
| | 40 | 430 | | public double? RiskScore { get; } = riskScore; |
| | | 431 | | |
| | 40 | 432 | | public string? PolicyScope { get; } = policyScope; |
| | | 433 | | |
| | 40 | 434 | | public string? TenantHash { get; } = tenantHash; |
| | | 435 | | |
| | 40 | 436 | | public string? OrganizationHash { get; } = organizationHash; |
| | | 437 | | |
| | 40 | 438 | | public string? EmitterStatus { get; } = emitterStatus; |
| | | 439 | | |
| | 40 | 440 | | public string? EmitterProvider { get; } = emitterProvider; |
| | | 441 | | |
| | 40 | 442 | | public long? OutboxSequence { get; } = outboxSequence; |
| | | 443 | | |
| | 40 | 444 | | public string? GatewayExecutionId { get; } = gatewayExecutionId; |
| | | 445 | | |
| | 40 | 446 | | public string? DecisionStage { get; } = decisionStage; |
| | | 447 | | |
| | 40 | 448 | | public string? PolicyVersion { get; } = policyVersion; |
| | | 449 | | |
| | 40 | 450 | | public string? PolicyHash { get; } = policyHash; |
| | | 451 | | |
| | 40 | 452 | | public IReadOnlyDictionary<string, string> Metadata { get; } = metadata; |
| | | 453 | | } |
| | | 454 | | } |