Add HealthCheckCompletedWebhookEvent (#15337)

This commit is contained in:
Erik-Jan Westendorp
2023-12-04 14:04:57 +01:00
committed by GitHub
parent c20d96c705
commit 80dcc04df0
3 changed files with 33 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;
namespace Umbraco.Cms.Core.Webhooks.Events.HealthCheck;
[WebhookEvent("Health Check Completed")]
public class HealthCheckCompletedWebhookEvent : WebhookEventBase<HealthCheckCompletedNotification>
{
public HealthCheckCompletedWebhookEvent(IWebhookFiringService webhookFiringService, IWebhookService webhookService, IOptionsMonitor<WebhookSettings> webhookSettings, IServerRoleAccessor serverRoleAccessor) : base(webhookFiringService, webhookService, webhookSettings, serverRoleAccessor)
{
}
public override string Alias => "healthCheckCompleted";
public override object? ConvertNotificationToRequestPayload(HealthCheckCompletedNotification notification) => notification.HealthCheckResults;
}

View File

@@ -1,5 +1,6 @@
using Umbraco.Cms.Core.Webhooks;
using Umbraco.Cms.Core.Webhooks.Events;
using Umbraco.Cms.Core.Webhooks.Events.HealthCheck;
using static Umbraco.Cms.Core.DependencyInjection.WebhookEventCollectionBuilderExtensions;
namespace Umbraco.Cms.Core.DependencyInjection;
@@ -313,6 +314,17 @@ public static class WebhookEventCollectionBuilderCmsExtensions
return builder;
}
/// <summary>
/// Adds the healthcheck webhook events.
/// </summary>
/// <param name="builder">The builder.</param>
/// <returns>
/// The builder.
/// </returns>
public static WebhookEventCollectionBuilder AddHealthCheck(this WebhookEventCollectionBuilder builder)
=> builder
.Append<HealthCheckCompletedWebhookEvent>();
/// <summary>
/// Adds all available user (including password, login and user group) webhook events.
/// </summary>

View File

@@ -38,7 +38,8 @@ public static class WebhookEventCollectionBuilderExtensions
.AddPublicAccess()
.AddRelation()
.AddRelationType()
.AddUser();
.AddUser()
.AddHealthCheck();
}
});