You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
5 years ago
|
using Lidarr.Http;
|
||
3 years ago
|
using Lidarr.Http.REST;
|
||
|
using Microsoft.AspNetCore.Mvc;
|
||
7 years ago
|
using NzbDrone.Core.Datastore.Events;
|
||
|
using NzbDrone.Core.HealthCheck;
|
||
|
using NzbDrone.Core.Messaging.Events;
|
||
|
using NzbDrone.SignalR;
|
||
|
|
||
7 years ago
|
namespace Lidarr.Api.V1.Health
|
||
7 years ago
|
{
|
||
3 years ago
|
[V1ApiController]
|
||
|
public class HealthController : RestControllerWithSignalR<HealthResource, HealthCheck>,
|
||
7 years ago
|
IHandle<HealthCheckCompleteEvent>
|
||
|
{
|
||
|
private readonly IHealthCheckService _healthCheckService;
|
||
|
|
||
3 years ago
|
public HealthController(IBroadcastSignalRMessage signalRBroadcaster, IHealthCheckService healthCheckService)
|
||
7 years ago
|
: base(signalRBroadcaster)
|
||
|
{
|
||
|
_healthCheckService = healthCheckService;
|
||
|
}
|
||
|
|
||
3 years ago
|
public override HealthResource GetResourceById(int id)
|
||
|
{
|
||
|
throw new NotImplementedException();
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
public List<HealthResource> GetHealth()
|
||
7 years ago
|
{
|
||
|
return _healthCheckService.Results().ToResource();
|
||
|
}
|
||
|
|
||
3 years ago
|
[NonAction]
|
||
7 years ago
|
public void Handle(HealthCheckCompleteEvent message)
|
||
|
{
|
||
|
BroadcastResourceChange(ModelAction.Sync);
|
||
|
}
|
||
|
}
|
||
5 years ago
|
}
|