MdpIngestServiceCollectionExtensions.cs 1.5 KB

1234567891011121314151617181920212223242526272829
  1. using Microsoft.AspNetCore.Authentication;
  2. using Microsoft.Extensions.DependencyInjection;
  3. namespace Admin.NET.Plugin.AiDOP.DataPlatform.UnifiedIngress;
  4. public static class MdpIngestServiceCollectionExtensions
  5. {
  6. public static IServiceCollection AddMdpUnifiedIngress(this IServiceCollection services)
  7. {
  8. services.AddTransient<MdpIngestReceiveService>();
  9. services.AddSingleton<MdpApiPullEgress>();
  10. services.AddSingleton<MdpApiPullClient>();
  11. services.AddScoped<MdpApiPullService>();
  12. services.AddScoped<MdpEdgeDeviceService>();
  13. services.AddTransient<MdpIngestBatchStatusService>();
  14. services.AddTransient<MdpIngestBatchTraceService>();
  15. services.AddTransient<MdpIngestRawRetentionService>();
  16. services.AddTransient<MdpIngestReplayService>();
  17. services.AddScoped<MdpIngestAdmissionStore>();
  18. services.AddSingleton<MdpIngestExternalIdentities>();
  19. services.AddHttpClient(MdpIngestExternalIdentities.MetadataClient, client => client.Timeout = TimeSpan.FromSeconds(8))
  20. .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false });
  21. services.AddScoped<ISecretStore, MdpIngestSecretStore>();
  22. services.AddSingleton<IMdpIngestSecretProvider, EnvironmentMdpIngestSecretProvider>();
  23. services.AddAuthentication().AddScheme<AuthenticationSchemeOptions, MdpIngestAuthenticationHandler>(
  24. MdpIngestProtocol.AuthenticationScheme, _ => { });
  25. return services;
  26. }
  27. }