Add Authority Advisory AI and API Lifecycle Configuration
- Introduced AuthorityAdvisoryAiOptions and related classes for managing advisory AI configurations, including remote inference options and tenant-specific settings. - Added AuthorityApiLifecycleOptions to control API lifecycle settings, including legacy OAuth endpoint configurations. - Implemented validation and normalization methods for both advisory AI and API lifecycle options to ensure proper configuration. - Created AuthorityNotificationsOptions and its related classes for managing notification settings, including ack tokens, webhooks, and escalation options. - Developed IssuerDirectoryClient and related models for interacting with the issuer directory service, including caching mechanisms and HTTP client configurations. - Added support for dependency injection through ServiceCollectionExtensions for the Issuer Directory Client. - Updated project file to include necessary package references for the new Issuer Directory Client library.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Immutable;
|
||||
using StellaOps.Scanner.EntryTrace;
|
||||
using StellaOps.Scanner.EntryTrace.Serialization;
|
||||
using StellaOps.Scanner.Storage.Catalog;
|
||||
using StellaOps.Scanner.Storage.Repositories;
|
||||
|
||||
namespace StellaOps.Scanner.Storage.Services;
|
||||
|
||||
public sealed class EntryTraceResultStore : IEntryTraceResultStore
|
||||
{
|
||||
private readonly EntryTraceRepository _repository;
|
||||
|
||||
public EntryTraceResultStore(EntryTraceRepository repository)
|
||||
{
|
||||
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
|
||||
}
|
||||
|
||||
public async Task StoreAsync(EntryTraceResult result, CancellationToken cancellationToken)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(result);
|
||||
|
||||
var document = new EntryTraceDocument
|
||||
{
|
||||
ScanId = result.ScanId,
|
||||
ImageDigest = result.ImageDigest,
|
||||
GeneratedAtUtc = result.GeneratedAtUtc.UtcDateTime,
|
||||
GraphJson = EntryTraceGraphSerializer.Serialize(result.Graph),
|
||||
Ndjson = result.Ndjson.ToList()
|
||||
};
|
||||
|
||||
await _repository.UpsertAsync(document, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<EntryTraceResult?> GetAsync(string scanId, CancellationToken cancellationToken)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(scanId);
|
||||
|
||||
var document = await _repository.GetAsync(scanId, cancellationToken).ConfigureAwait(false);
|
||||
if (document is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var graph = EntryTraceGraphSerializer.Deserialize(document.GraphJson);
|
||||
var ndjson = document.Ndjson?.ToImmutableArray() ?? ImmutableArray<string>.Empty;
|
||||
var generatedAt = DateTime.SpecifyKind(document.GeneratedAtUtc, DateTimeKind.Utc);
|
||||
return new EntryTraceResult(
|
||||
document.ScanId,
|
||||
document.ImageDigest,
|
||||
new DateTimeOffset(generatedAt),
|
||||
graph,
|
||||
ndjson);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user