- Added `SchedulerWorkerOptions` class to encapsulate configuration for the scheduler worker. - Introduced `PlannerBackgroundService` to manage the planner loop, fetching and processing planning runs. - Created `PlannerExecutionService` to handle the execution logic for planning runs, including impact targeting and run persistence. - Developed `PlannerExecutionResult` and `PlannerExecutionStatus` to standardize execution outcomes. - Implemented validation logic within `SchedulerWorkerOptions` to ensure proper configuration. - Added documentation for the planner loop and impact targeting features. - Established health check endpoints and authentication mechanisms for the Signals service. - Created unit tests for the Signals API to ensure proper functionality and response handling. - Configured options for authority integration and fallback authentication methods.
		
			
				
	
	
		
			110 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			110 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Text.Json.Serialization;
 | 
						|
 | 
						|
namespace StellaOps.Cli.Services.Models;
 | 
						|
 | 
						|
internal sealed record AdvisoryObservationsQuery(
 | 
						|
    string Tenant,
 | 
						|
    IReadOnlyList<string> ObservationIds,
 | 
						|
    IReadOnlyList<string> Aliases,
 | 
						|
    IReadOnlyList<string> Purls,
 | 
						|
    IReadOnlyList<string> Cpes);
 | 
						|
 | 
						|
internal sealed class AdvisoryObservationsResponse
 | 
						|
{
 | 
						|
    [JsonPropertyName("observations")]
 | 
						|
    public IReadOnlyList<AdvisoryObservationDocument> Observations { get; init; } =
 | 
						|
        Array.Empty<AdvisoryObservationDocument>();
 | 
						|
 | 
						|
    [JsonPropertyName("linkset")]
 | 
						|
    public AdvisoryObservationLinksetAggregate Linkset { get; init; } =
 | 
						|
        new();
 | 
						|
}
 | 
						|
 | 
						|
internal sealed class AdvisoryObservationDocument
 | 
						|
{
 | 
						|
    [JsonPropertyName("observationId")]
 | 
						|
    public string ObservationId { get; init; } = string.Empty;
 | 
						|
 | 
						|
    [JsonPropertyName("tenant")]
 | 
						|
    public string Tenant { get; init; } = string.Empty;
 | 
						|
 | 
						|
    [JsonPropertyName("source")]
 | 
						|
    public AdvisoryObservationSource Source { get; init; } = new();
 | 
						|
 | 
						|
    [JsonPropertyName("upstream")]
 | 
						|
    public AdvisoryObservationUpstream Upstream { get; init; } = new();
 | 
						|
 | 
						|
    [JsonPropertyName("linkset")]
 | 
						|
    public AdvisoryObservationLinkset Linkset { get; init; } = new();
 | 
						|
 | 
						|
    [JsonPropertyName("createdAt")]
 | 
						|
    public DateTimeOffset CreatedAt { get; init; }
 | 
						|
}
 | 
						|
 | 
						|
internal sealed class AdvisoryObservationSource
 | 
						|
{
 | 
						|
    [JsonPropertyName("vendor")]
 | 
						|
    public string Vendor { get; init; } = string.Empty;
 | 
						|
 | 
						|
    [JsonPropertyName("stream")]
 | 
						|
    public string Stream { get; init; } = string.Empty;
 | 
						|
 | 
						|
    [JsonPropertyName("api")]
 | 
						|
    public string Api { get; init; } = string.Empty;
 | 
						|
 | 
						|
    [JsonPropertyName("collectorVersion")]
 | 
						|
    public string? CollectorVersion { get; init; }
 | 
						|
}
 | 
						|
 | 
						|
internal sealed class AdvisoryObservationUpstream
 | 
						|
{
 | 
						|
    [JsonPropertyName("upstreamId")]
 | 
						|
    public string UpstreamId { get; init; } = string.Empty;
 | 
						|
 | 
						|
    [JsonPropertyName("documentVersion")]
 | 
						|
    public string? DocumentVersion { get; init; }
 | 
						|
}
 | 
						|
 | 
						|
internal sealed class AdvisoryObservationLinkset
 | 
						|
{
 | 
						|
    [JsonPropertyName("aliases")]
 | 
						|
    public IReadOnlyList<string> Aliases { get; init; } = Array.Empty<string>();
 | 
						|
 | 
						|
    [JsonPropertyName("purls")]
 | 
						|
    public IReadOnlyList<string> Purls { get; init; } = Array.Empty<string>();
 | 
						|
 | 
						|
    [JsonPropertyName("cpes")]
 | 
						|
    public IReadOnlyList<string> Cpes { get; init; } = Array.Empty<string>();
 | 
						|
 | 
						|
    [JsonPropertyName("references")]
 | 
						|
    public IReadOnlyList<AdvisoryObservationReference> References { get; init; } =
 | 
						|
        Array.Empty<AdvisoryObservationReference>();
 | 
						|
}
 | 
						|
 | 
						|
internal sealed class AdvisoryObservationReference
 | 
						|
{
 | 
						|
    [JsonPropertyName("type")]
 | 
						|
    public string Type { get; init; } = string.Empty;
 | 
						|
 | 
						|
    [JsonPropertyName("url")]
 | 
						|
    public string Url { get; init; } = string.Empty;
 | 
						|
}
 | 
						|
 | 
						|
internal sealed class AdvisoryObservationLinksetAggregate
 | 
						|
{
 | 
						|
    [JsonPropertyName("aliases")]
 | 
						|
    public IReadOnlyList<string> Aliases { get; init; } = Array.Empty<string>();
 | 
						|
 | 
						|
    [JsonPropertyName("purls")]
 | 
						|
    public IReadOnlyList<string> Purls { get; init; } = Array.Empty<string>();
 | 
						|
 | 
						|
    [JsonPropertyName("cpes")]
 | 
						|
    public IReadOnlyList<string> Cpes { get; init; } = Array.Empty<string>();
 | 
						|
 | 
						|
    [JsonPropertyName("references")]
 | 
						|
    public IReadOnlyList<AdvisoryObservationReference> References { get; init; } =
 | 
						|
        Array.Empty<AdvisoryObservationReference>();
 | 
						|
}
 |