Merge branch 'main' of https://git.stella-ops.org/stella-ops.org/git.stella-ops.org
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
oas-ci / oas-validate (push) Has been cancelled
Policy Simulation / policy-simulate (push) Has been cancelled
sdk-generator-smoke / sdk-smoke (push) Has been cancelled
SDK Publish & Sign / sdk-publish (push) Has been cancelled
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
oas-ci / oas-validate (push) Has been cancelled
Policy Simulation / policy-simulate (push) Has been cancelled
sdk-generator-smoke / sdk-smoke (push) Has been cancelled
SDK Publish & Sign / sdk-publish (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace StellaOps.Notifier.Worker.Escalation;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for registering escalation services.
|
||||
/// </summary>
|
||||
public static class EscalationServiceExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds escalation and on-call services.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddEscalationServices(
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
// Core services
|
||||
services.AddSingleton<IEscalationPolicyService, InMemoryEscalationPolicyService>();
|
||||
services.AddSingleton<IOnCallScheduleService, InMemoryOnCallScheduleService>();
|
||||
services.AddSingleton<IEscalationEngine, EscalationEngine>();
|
||||
|
||||
// Ack bridge
|
||||
services.Configure<AckBridgeOptions>(configuration.GetSection(AckBridgeOptions.SectionName));
|
||||
services.AddSingleton<IAckBridge, AckBridge>();
|
||||
|
||||
// Inbox channels
|
||||
services.AddSingleton<InAppInboxChannel>();
|
||||
services.AddSingleton<CliNotificationChannel>();
|
||||
services.AddSingleton<IInboxChannel>(sp => sp.GetRequiredService<InAppInboxChannel>());
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds PagerDuty integration.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddPagerDutyIntegration(
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
services.Configure<PagerDutyOptions>(configuration.GetSection(PagerDutyOptions.SectionName));
|
||||
services.AddHttpClient<PagerDutyAdapter>();
|
||||
services.AddSingleton<IExternalIntegrationAdapter, PagerDutyAdapter>(sp =>
|
||||
sp.GetRequiredService<PagerDutyAdapter>());
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds OpsGenie integration.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddOpsGenieIntegration(
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
services.Configure<OpsGenieOptions>(configuration.GetSection(OpsGenieOptions.SectionName));
|
||||
services.AddHttpClient<OpsGenieAdapter>();
|
||||
services.AddSingleton<IExternalIntegrationAdapter, OpsGenieAdapter>(sp =>
|
||||
sp.GetRequiredService<OpsGenieAdapter>());
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user