V14: Server information (#15497)
* Rename information endpoint to troubleshooting * Rename information endpoint to troubleshooting * Add new information endpoint * Fix bad merge * Add InformationServerController.cs back * Update serverTime offset to non hard-coded value. * Add dictionary to swagger models * Update OpenApi.json file * Rename map definition * Add ServerConfigurationBaseModel * Implement ServerConfigurationBaseModel.cs * Updated OpenApi * Updated endpoint to return correct type in openapi * Use explicit class for server information * Remove version endpoint, as that is contained in server information. --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
@@ -10,21 +10,21 @@ namespace Umbraco.Cms.Api.Management.Controllers.Server;
|
||||
[ApiVersion("1.0")]
|
||||
public class InformationServerController : ServerControllerBase
|
||||
{
|
||||
private readonly ISystemInformationService _systemInformationService;
|
||||
private readonly IUmbracoMapper _mapper;
|
||||
private readonly IServerInformationService _serverInformationService;
|
||||
private readonly IUmbracoMapper _umbracoMapper;
|
||||
|
||||
public InformationServerController(ISystemInformationService systemInformationService, IUmbracoMapper mapper)
|
||||
public InformationServerController(IServerInformationService serverInformationService, IUmbracoMapper umbracoMapper)
|
||||
{
|
||||
_systemInformationService = systemInformationService;
|
||||
_mapper = mapper;
|
||||
_serverInformationService = serverInformationService;
|
||||
_umbracoMapper = umbracoMapper;
|
||||
}
|
||||
|
||||
[HttpGet("information")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(ServerInformationResponseModel), StatusCodes.Status200OK)]
|
||||
public Task<IActionResult> GetServerInformation()
|
||||
public Task<IActionResult> Information()
|
||||
{
|
||||
ServerInformationResponseModel responseModel = _mapper.Map<ServerInformationResponseModel>(_systemInformationService.GetSystemInformation())!;
|
||||
ServerInformationResponseModel responseModel = _umbracoMapper.Map<ServerInformationResponseModel>(_serverInformationService.GetServerInformation())!;
|
||||
|
||||
return Task.FromResult<IActionResult>(Ok(responseModel));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Server;
|
||||
using Umbraco.Cms.Core.Mapping;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Controllers.Server;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
public class TroubleshootingServerController : ServerControllerBase
|
||||
{
|
||||
private readonly ISystemTroubleshootingInformationService _systemTroubleshootingInformationService;
|
||||
private readonly IUmbracoMapper _mapper;
|
||||
|
||||
public TroubleshootingServerController(ISystemTroubleshootingInformationService systemTroubleshootingInformationService, IUmbracoMapper mapper)
|
||||
{
|
||||
_systemTroubleshootingInformationService = systemTroubleshootingInformationService;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
[HttpGet("troubleshooting")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(ServerTroubleshootingResponseModel), StatusCodes.Status200OK)]
|
||||
public Task<IActionResult> GetTroubleshooting()
|
||||
{
|
||||
ServerTroubleshootingResponseModel responseModel = _mapper.Map<ServerTroubleshootingResponseModel>(_systemTroubleshootingInformationService.GetTroubleshootingInformation())!;
|
||||
|
||||
return Task.FromResult<IActionResult>(Ok(responseModel));
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Core.Configuration;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Server;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Controllers.Server;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
public class VersionServerController : ServerControllerBase
|
||||
{
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
|
||||
public VersionServerController(IUmbracoVersion umbracoVersion) => _umbracoVersion = umbracoVersion;
|
||||
|
||||
[HttpGet("version")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(typeof(VersionResponseModel), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<VersionResponseModel>> Get() =>
|
||||
await Task.FromResult(new VersionResponseModel
|
||||
{
|
||||
Version = _umbracoVersion.SemanticVersion.ToSemanticStringWithoutBuild()
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user