diff --git a/src/integration/ProxmoxConnector.Integration.Corsinvest/Services/PveConnector.cs b/src/integration/ProxmoxConnector.Integration.Corsinvest/Services/PveConnector.cs index 5672ce5..d777726 100644 --- a/src/integration/ProxmoxConnector.Integration.Corsinvest/Services/PveConnector.cs +++ b/src/integration/ProxmoxConnector.Integration.Corsinvest/Services/PveConnector.cs @@ -13,7 +13,7 @@ namespace ProxmoxConnector.Integration.Corsinvest.Services var client = new PveClient("***REMOVED***"); ***REMOVED*** if (await client.Login(***REMOVED***)) { - var vm = client.Nodes["pve1"].Qemu[100]; + var vm = client.Nodes["pve-test1"].Qemu[100]; //config vm var config = await vm.Config.VmConfig(); @@ -37,16 +37,16 @@ namespace ProxmoxConnector.Integration.Corsinvest.Services //change response type from json to png client.ResponseType = ResponseType.Png; - var dataImg = (await client.Nodes["pve1"].Rrd.Rrd("cpu", "day")).Response; - Console.WriteLine(""); + var dataImg = (await client.Nodes["pve-test1"].Rrd.Rrd("cpu", "day")).Response; + Console.WriteLine($""); } } public async Task TestWithToken() { //using Api Token - var client2 = new PveClient("10.92.100.33"); - client2.ApiToken = "root@pam!qqqqqq=***REMOVED***"; + var client2 = new PveClient("***REMOVED***"); + client2.ApiToken = "root@pam!test-token=***REMOVED***"; var version = await client2.Version.Version(); Console.WriteLine(JsonConvert.SerializeObject(version.Response.data, Formatting.Indented)); } diff --git a/src/integration/ProxmoxConnector.Integration.Corsinvest/notes/ResponseAsPng.html b/src/integration/ProxmoxConnector.Integration.Corsinvest/notes/ResponseAsPng.html new file mode 100644 index 0000000..0ddf001 --- /dev/null +++ b/src/integration/ProxmoxConnector.Integration.Corsinvest/notes/ResponseAsPng.html @@ -0,0 +1,12 @@ + + + + +Response as PNG + + + + + + + diff --git a/src/server/ProxmoxConnector.Server.Application/Queries/TestQ.cs b/src/server/ProxmoxConnector.Server.Application/Queries/TestQ.cs index 7fa0e78..d725f35 100644 --- a/src/server/ProxmoxConnector.Server.Application/Queries/TestQ.cs +++ b/src/server/ProxmoxConnector.Server.Application/Queries/TestQ.cs @@ -29,6 +29,7 @@ namespace ProxmoxConnector.Server.Application.Queries public async Task Handle(Query request, CancellationToken cancellationToken) { await _pveConnector.TestWithLogin(); + await _pveConnector.TestWithToken(); return await Task.FromResult(new Model() { Msg = "-!-" }); } diff --git a/src/server/ProxmoxConnector.Server/Controllers/HealthController.cs b/src/server/ProxmoxConnector.Server/Controllers/HealthController.cs index 3baae81..81facf5 100644 --- a/src/server/ProxmoxConnector.Server/Controllers/HealthController.cs +++ b/src/server/ProxmoxConnector.Server/Controllers/HealthController.cs @@ -2,9 +2,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using ProxmoxConnector.Server.Application.Queries.System; using System; -using System.Threading.Tasks; namespace ProxmoxConnector.Server.Controllers { @@ -29,13 +27,5 @@ namespace ProxmoxConnector.Server.Controllers _logger.LogInformation("Ping"); return Ok($"Ping success. System datetime: {DateTime.Now}"); } - - [AllowAnonymous] - [HttpGet("version")] - public async Task GetSystemVersion([FromRoute] GetSystemVersion.Query query) - { - var result = await _mediator.Send(query); - return Ok(result); - } } } diff --git a/src/server/ProxmoxConnector.Server/Controllers/SystemController.cs b/src/server/ProxmoxConnector.Server/Controllers/SystemController.cs new file mode 100644 index 0000000..cd41ec4 --- /dev/null +++ b/src/server/ProxmoxConnector.Server/Controllers/SystemController.cs @@ -0,0 +1,29 @@ +using MediatR; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using ProxmoxConnector.Server.Application.Queries.System; +using System.Threading.Tasks; + +namespace ProxmoxConnector.Server.Controllers +{ + [Authorize] + [ApiController] + [Route("system")] + public class SystemController : ControllerBase + { + private readonly IMediator _mediator; + + public SystemController(IMediator mediator) + { + _mediator=mediator; + } + + [AllowAnonymous] + [HttpGet("version")] + public async Task GetSystemVersion([FromRoute] GetSystemVersion.Query query) + { + var result = await _mediator.Send(query); + return Ok(result); + } + } +}