- Added NotifyPanelComponent for managing notification channels and rules. - Implemented reactive forms for channel and rule management. - Created unit tests for NotifyPanelComponent to validate functionality. - Developed MockNotifyApiService to simulate API interactions for testing. - Added mock data for channels, rules, and deliveries to facilitate testing. - Introduced RuntimeEventFactoryTests to ensure correct event creation with build ID.
92 lines
3.0 KiB
C#
92 lines
3.0 KiB
C#
using System.Collections.Generic;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace StellaOps.Scanner.WebService.Contracts;
|
|
|
|
public sealed record RuntimePolicyRequestDto
|
|
{
|
|
[JsonPropertyName("namespace")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? Namespace { get; init; }
|
|
|
|
[JsonPropertyName("labels")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public IDictionary<string, string>? Labels { get; init; }
|
|
|
|
[JsonPropertyName("images")]
|
|
public IReadOnlyList<string> Images { get; init; } = Array.Empty<string>();
|
|
}
|
|
|
|
public sealed record RuntimePolicyResponseDto
|
|
{
|
|
[JsonPropertyName("ttlSeconds")]
|
|
public int TtlSeconds { get; init; }
|
|
|
|
[JsonPropertyName("expiresAtUtc")]
|
|
public DateTimeOffset ExpiresAtUtc { get; init; }
|
|
|
|
[JsonPropertyName("policyRevision")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? PolicyRevision { get; init; }
|
|
|
|
[JsonPropertyName("results")]
|
|
public IReadOnlyDictionary<string, RuntimePolicyImageResponseDto> Results { get; init; } = new Dictionary<string, RuntimePolicyImageResponseDto>(StringComparer.Ordinal);
|
|
}
|
|
|
|
public sealed record RuntimePolicyImageResponseDto
|
|
{
|
|
[JsonPropertyName("policyVerdict")]
|
|
public string PolicyVerdict { get; init; } = "unknown";
|
|
|
|
[JsonPropertyName("signed")]
|
|
public bool Signed { get; init; }
|
|
|
|
[JsonPropertyName("hasSbomReferrers")]
|
|
public bool HasSbomReferrers { get; init; }
|
|
|
|
[JsonPropertyName("hasSbom")]
|
|
public bool HasSbomLegacy { get; init; }
|
|
|
|
[JsonPropertyName("reasons")]
|
|
public IReadOnlyList<string> Reasons { get; init; } = Array.Empty<string>();
|
|
|
|
[JsonPropertyName("rekor")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public RuntimePolicyRekorDto? Rekor { get; init; }
|
|
|
|
[JsonPropertyName("confidence")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public double? Confidence { get; init; }
|
|
|
|
[JsonPropertyName("quieted")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public bool? Quieted { get; init; }
|
|
|
|
[JsonPropertyName("quietedBy")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? QuietedBy { get; init; }
|
|
|
|
[JsonPropertyName("metadata")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? Metadata { get; init; }
|
|
|
|
[JsonPropertyName("buildIds")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public IReadOnlyList<string>? BuildIds { get; init; }
|
|
}
|
|
|
|
public sealed record RuntimePolicyRekorDto
|
|
{
|
|
[JsonPropertyName("uuid")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? Uuid { get; init; }
|
|
|
|
[JsonPropertyName("url")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? Url { get; init; }
|
|
|
|
[JsonPropertyName("verified")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public bool? Verified { get; init; }
|
|
}
|