2014-02-26 05:40:47 +00:00
|
|
|
|
using System;
|
2016-03-25 00:56:29 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2014-02-26 05:40:47 +00:00
|
|
|
|
using NzbDrone.Api.REST;
|
2016-02-29 23:33:28 +00:00
|
|
|
|
using NzbDrone.Common.Http;
|
2014-02-26 05:40:47 +00:00
|
|
|
|
using NzbDrone.Core.HealthCheck;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Health
|
|
|
|
|
{
|
|
|
|
|
public class HealthResource : RestResource
|
|
|
|
|
{
|
2014-04-10 00:15:13 +00:00
|
|
|
|
public HealthCheckResult Type { get; set; }
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public string Message { get; set; }
|
2016-02-29 23:33:28 +00:00
|
|
|
|
public HttpUri WikiUrl { get; set; }
|
2014-02-26 05:40:47 +00:00
|
|
|
|
}
|
2016-03-25 00:56:29 +00:00
|
|
|
|
|
|
|
|
|
public static class HealthResourceMapper
|
|
|
|
|
{
|
|
|
|
|
public static HealthResource ToResource(this HealthCheck model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null) return null;
|
|
|
|
|
|
|
|
|
|
return new HealthResource
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
|
|
|
|
|
Type = model.Type,
|
|
|
|
|
Message = model.Message,
|
|
|
|
|
WikiUrl = model.WikiUrl
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<HealthResource> ToResource(this IEnumerable<HealthCheck> models)
|
|
|
|
|
{
|
|
|
|
|
return models.Select(ToResource).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-02-26 05:40:47 +00:00
|
|
|
|
}
|