audit notes work completed, test fixes work (95% done), new sprints, new data sources setup and configuration
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// SourcesPlugin.cs
|
||||
// Sprint: SPRINT_20260114_SOURCES_SETUP
|
||||
// Task: 12.1 - Sources Doctor Plugin
|
||||
// Description: Doctor plugin providing advisory source connectivity diagnostics
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StellaOps.Concelier.Core.Sources;
|
||||
using StellaOps.Doctor.Models;
|
||||
using StellaOps.Doctor.Plugins;
|
||||
using StellaOps.Doctor.Plugins.Sources.Checks;
|
||||
|
||||
namespace StellaOps.Doctor.Plugins.Sources;
|
||||
|
||||
/// <summary>
|
||||
/// Doctor plugin for advisory data source diagnostics.
|
||||
/// Provides connectivity checks for all configured CVE/advisory data sources.
|
||||
/// </summary>
|
||||
public sealed class SourcesPlugin : IDoctorPlugin
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string PluginId => "stellaops.doctor.sources";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DisplayName => "Advisory Sources";
|
||||
|
||||
/// <inheritdoc />
|
||||
public DoctorCategory Category => DoctorCategory.Data;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Version Version => new(1, 0, 0);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Version MinEngineVersion => new(1, 0, 0);
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsAvailable(IServiceProvider services)
|
||||
{
|
||||
// Plugin is available if ISourceRegistry is registered
|
||||
return services.GetService<ISourceRegistry>() is not null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<IDoctorCheck> GetChecks(DoctorPluginContext context)
|
||||
{
|
||||
var registry = context.Services.GetService<ISourceRegistry>();
|
||||
if (registry is null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
var checks = new List<IDoctorCheck>
|
||||
{
|
||||
// Overall source mode configuration check
|
||||
new SourceModeConfiguredCheck(),
|
||||
|
||||
// Mirror server checks
|
||||
new MirrorServerAuthCheck(),
|
||||
new MirrorServerRateLimitCheck()
|
||||
};
|
||||
|
||||
// Generate dynamic checks for each registered source
|
||||
foreach (var source in registry.GetAllSources())
|
||||
{
|
||||
checks.Add(new SourceConnectivityCheck(source.Id, source.DisplayName));
|
||||
}
|
||||
|
||||
return checks;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task InitializeAsync(DoctorPluginContext context, CancellationToken ct)
|
||||
{
|
||||
// No initialization required
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user