NetworkResurrector.Agent.Wrapper

master
Tudor Stanciu 2021-12-09 15:42:06 +02:00
parent bb0cee70b7
commit 2e21ad3b60
6 changed files with 50 additions and 55 deletions

View File

@ -54,7 +54,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "agent", "agent", "{C04663A1
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Agent", "src\agent\NetworkResurrector.Agent\NetworkResurrector.Agent.csproj", "{C8C4CA6F-39E2-46FE-89E2-0A81D2F4161E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Agent", "src\agent\NetworkResurrector.Agent\NetworkResurrector.Agent.csproj", "{C8C4CA6F-39E2-46FE-89E2-0A81D2F4161E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkResurrector.Agent.Application", "src\agent\NetworkResurrector.Agent.Application\NetworkResurrector.Agent.Application.csproj", "{3795AB02-7F2A-424B-BFD2-1B915E155829}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Agent.Application", "src\agent\NetworkResurrector.Agent.Application\NetworkResurrector.Agent.Application.csproj", "{3795AB02-7F2A-424B-BFD2-1B915E155829}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkResurrector.Agent.Wrapper", "src\agent\NetworkResurrector.Agent.Wrapper\NetworkResurrector.Agent.Wrapper.csproj", "{BA96E3C3-3E18-4882-8BDB-ED7B40836892}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -110,6 +112,10 @@ Global
{3795AB02-7F2A-424B-BFD2-1B915E155829}.Debug|Any CPU.Build.0 = Debug|Any CPU {3795AB02-7F2A-424B-BFD2-1B915E155829}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3795AB02-7F2A-424B-BFD2-1B915E155829}.Release|Any CPU.ActiveCfg = Release|Any CPU {3795AB02-7F2A-424B-BFD2-1B915E155829}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3795AB02-7F2A-424B-BFD2-1B915E155829}.Release|Any CPU.Build.0 = Release|Any CPU {3795AB02-7F2A-424B-BFD2-1B915E155829}.Release|Any CPU.Build.0 = Release|Any CPU
{BA96E3C3-3E18-4882-8BDB-ED7B40836892}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA96E3C3-3E18-4882-8BDB-ED7B40836892}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA96E3C3-3E18-4882-8BDB-ED7B40836892}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA96E3C3-3E18-4882-8BDB-ED7B40836892}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -132,6 +138,7 @@ Global
{C04663A1-E0CD-41D6-A8D7-FADDF9DA8302} = {B0C5F0C1-0BF8-4651-AAFC-BE01F516D7B8} {C04663A1-E0CD-41D6-A8D7-FADDF9DA8302} = {B0C5F0C1-0BF8-4651-AAFC-BE01F516D7B8}
{C8C4CA6F-39E2-46FE-89E2-0A81D2F4161E} = {C04663A1-E0CD-41D6-A8D7-FADDF9DA8302} {C8C4CA6F-39E2-46FE-89E2-0A81D2F4161E} = {C04663A1-E0CD-41D6-A8D7-FADDF9DA8302}
{3795AB02-7F2A-424B-BFD2-1B915E155829} = {C04663A1-E0CD-41D6-A8D7-FADDF9DA8302} {3795AB02-7F2A-424B-BFD2-1B915E155829} = {C04663A1-E0CD-41D6-A8D7-FADDF9DA8302}
{BA96E3C3-3E18-4882-8BDB-ED7B40836892} = {C04663A1-E0CD-41D6-A8D7-FADDF9DA8302}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {351D76E9-FE02-4C30-A464-7B29AFC64BC7} SolutionGuid = {351D76E9-FE02-4C30-A464-7B29AFC64BC7}

View File

@ -0,0 +1,8 @@
using System;
namespace NetworkResurrector.Agent.Wrapper
{
public class Class1
{
}
}

View File

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,27 @@
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace NetworkResurrector.Agent.Controllers
{
[ApiController]
[Authorize]
[Route("host")]
public class HostController : ControllerBase
{
private readonly IMediator _mediator;
public HostController(IMediator mediator)
{
_mediator = mediator;
}
[HttpPost("shutdown")]
public async Task<IActionResult> Shutdown([FromBody] Shutdown shutdownMachine)
{
var result = await _mediator.Send(shutdownMachine);
return Ok(result);
}
}
}

View File

@ -1,39 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace NetworkResurrector.Agent.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}

View File

@ -1,15 +0,0 @@
using System;
namespace NetworkResurrector.Agent
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; }
}
}