using Asp.Versioning; using GerstITS.Authentication.ApiKey; using GerstITS.Examples.Api.Versioning; using GerstITS.System.Environment; using GerstITS.Validation; using GerstITS.Web.Api; using GerstITS.Web.Api.FluentApi; using Microsoft.AspNetCore.Mvc; namespace GerstITS.Examples.Api.Controllers._1._1; /// /// Is responsible to provide maintenance functions protected by an api key header. /// [ApiController, ApiVersion(Versions._1_1), ApiKey, Route(ApplicationEnvironment.WebApi.ControllerRouteTemplate)] public class MaintenanceController : FluentApiControllerBase { #region Fields private readonly ISystemClock _systemClock; #endregion #region Constructors public MaintenanceController(ISystemClock systemClock, IValidator validator) : base(validator) { _systemClock = systemClock; } #endregion #region Methods /// /// Gets the current server time. Requires a valid api key header. /// /// Returns the current server time. [HttpGet, Route("Ping")] public IActionResult Ping() { return Api().Get(() => _systemClock.UtcNow); } #endregion }