private static IAuditProcessor GetProcessor(IServiceScope scope, ScannerMetadata metadata) { switch (metadata.Type) { case ScannerType.Azsk: return(scope.ServiceProvider.GetRequiredService <AzskAuditProcessor>()); case ScannerType.Polaris: return(scope.ServiceProvider.GetRequiredService <PolarisAuditProcessor>()); case ScannerType.Trivy: return(scope.ServiceProvider.GetRequiredService <TrivyAuditProcessor>()); default: Logger.Warning("AuditProcessorFactory was requested to instantiate {ScannerType} processor, which is not supported", metadata.Type); throw new NotSupportedException($"{metadata.Type} audit processor is not supported"); } }
private static TimeSpan GetProcessorPeriodicity(ScannerMetadata metadata) { return(metadata.Periodicity == "on-message" ? TimeSpan.FromMinutes(1) : TimeSpan.FromMinutes(10)); }