mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Added Call Home Endpoints - Server and Plugin
This commit is contained in:
parent
8bf57a71b9
commit
decf281598
2 changed files with 59 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ServerManager.WebApplication.Controllers
|
||||
{
|
||||
[Route("api/plugin")]
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Produces("application/json")]
|
||||
public class PluginController : ControllerBase
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ILogger<ServerController> _logger;
|
||||
|
||||
public PluginController(IConfiguration configuration, ILogger<ServerController> logger)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
// GET: api/plugin/call/00000000-0000-0000-0000-000000000000/192.168.1.1
|
||||
[HttpGet()]
|
||||
[Route("call/{pluginCode}/{ipString}", Name = "Call_V1")]
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public ActionResult<bool> Call_V1([FromRoute] string pluginCode, [FromRoute] string ipString)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,24 @@ namespace ServerManager.WebApplication.Controllers
|
|||
_serverQueryService = serverQueryService;
|
||||
}
|
||||
|
||||
// GET: api/server/call/00000000-0000-0000-0000-000000000000/192.168.1.1
|
||||
[HttpGet()]
|
||||
[Route("call/{managerCode}/{ipString}", Name = "Call_V1")]
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public ActionResult<bool> Call_V1([FromRoute] string managerCode, [FromRoute] string ipString)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, false);
|
||||
}
|
||||
}
|
||||
|
||||
// GET: api/server/192.168.1.1/27017
|
||||
[HttpGet()]
|
||||
[Route("{ipString}/{port}", Name = "GetServerStatus_V1")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue