Restructure solution layout by module
This commit is contained in:
18
src/Scanner/StellaOps.Scanner.WebService/Domain/ScanId.cs
Normal file
18
src/Scanner/StellaOps.Scanner.WebService/Domain/ScanId.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace StellaOps.Scanner.WebService.Domain;
|
||||
|
||||
public readonly record struct ScanId(string Value)
|
||||
{
|
||||
public override string ToString() => Value;
|
||||
|
||||
public static bool TryParse(string? value, out ScanId scanId)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
scanId = new ScanId(value.Trim());
|
||||
return true;
|
||||
}
|
||||
|
||||
scanId = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StellaOps.Scanner.WebService.Domain;
|
||||
|
||||
public sealed record ScanProgressEvent(
|
||||
ScanId ScanId,
|
||||
int Sequence,
|
||||
DateTimeOffset Timestamp,
|
||||
string State,
|
||||
string? Message,
|
||||
string CorrelationId,
|
||||
IReadOnlyDictionary<string, object?> Data);
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace StellaOps.Scanner.WebService.Domain;
|
||||
|
||||
public sealed record ScanSnapshot(
|
||||
ScanId ScanId,
|
||||
ScanTarget Target,
|
||||
ScanStatus Status,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset UpdatedAt,
|
||||
string? FailureReason);
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace StellaOps.Scanner.WebService.Domain;
|
||||
|
||||
public enum ScanStatus
|
||||
{
|
||||
Pending,
|
||||
Running,
|
||||
Succeeded,
|
||||
Failed,
|
||||
Cancelled
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StellaOps.Scanner.WebService.Domain;
|
||||
|
||||
public sealed record ScanSubmission(
|
||||
ScanTarget Target,
|
||||
bool Force,
|
||||
string? ClientRequestId,
|
||||
IReadOnlyDictionary<string, string> Metadata);
|
||||
|
||||
public sealed record ScanSubmissionResult(
|
||||
ScanSnapshot Snapshot,
|
||||
bool Created);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace StellaOps.Scanner.WebService.Domain;
|
||||
|
||||
public sealed record ScanTarget(string? Reference, string? Digest)
|
||||
{
|
||||
public ScanTarget Normalize()
|
||||
{
|
||||
var normalizedReference = string.IsNullOrWhiteSpace(Reference) ? null : Reference.Trim();
|
||||
var normalizedDigest = string.IsNullOrWhiteSpace(Digest) ? null : Digest.Trim().ToLowerInvariant();
|
||||
return new ScanTarget(normalizedReference, normalizedDigest);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user