diff --git a/ProxmoxConnector.sln b/ProxmoxConnector.sln index 4a22946..6ad8896 100644 --- a/ProxmoxConnector.sln +++ b/ProxmoxConnector.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Tester", "ProxmoxConnector.Tester\ProxmoxConnector.Tester.csproj", "{A0C0198B-8327-4DC5-8577-0B55DF0F06A4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxmoxConnector.Tester", "ProxmoxConnector.Tester\ProxmoxConnector.Tester.csproj", "{A0C0198B-8327-4DC5-8577-0B55DF0F06A4}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution items", "{E73280D9-92D3-4894-B0CA-43AEADB86FD2}" ProjectSection(SolutionItems) = preProject @@ -16,6 +16,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "notes", "notes", "{3C571A15 notes\pve-api.txt = notes\pve-api.txt EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FA6E3503-ADFD-46D3-912B-D4A05BF4407F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "server", "server", "{2D975A5D-3612-4536-A501-248F6B9A5AC2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Server", "src\server\ProxmoxConnector.Server\ProxmoxConnector.Server.csproj", "{340A176C-AE9F-4F01-A82F-AAAAF140A728}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Server.Application", "src\server\ProxmoxConnector.Server.Application\ProxmoxConnector.Server.Application.csproj", "{96718232-FFFA-4E3C-B068-53C679B60669}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Server.Domain", "src\server\ProxmoxConnector.Server.Domain\ProxmoxConnector.Server.Domain.csproj", "{57F68716-671A-476C-9F07-E0E86FDE6940}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -26,12 +36,28 @@ Global {A0C0198B-8327-4DC5-8577-0B55DF0F06A4}.Debug|Any CPU.Build.0 = Debug|Any CPU {A0C0198B-8327-4DC5-8577-0B55DF0F06A4}.Release|Any CPU.ActiveCfg = Release|Any CPU {A0C0198B-8327-4DC5-8577-0B55DF0F06A4}.Release|Any CPU.Build.0 = Release|Any CPU + {340A176C-AE9F-4F01-A82F-AAAAF140A728}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {340A176C-AE9F-4F01-A82F-AAAAF140A728}.Debug|Any CPU.Build.0 = Debug|Any CPU + {340A176C-AE9F-4F01-A82F-AAAAF140A728}.Release|Any CPU.ActiveCfg = Release|Any CPU + {340A176C-AE9F-4F01-A82F-AAAAF140A728}.Release|Any CPU.Build.0 = Release|Any CPU + {96718232-FFFA-4E3C-B068-53C679B60669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96718232-FFFA-4E3C-B068-53C679B60669}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96718232-FFFA-4E3C-B068-53C679B60669}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96718232-FFFA-4E3C-B068-53C679B60669}.Release|Any CPU.Build.0 = Release|Any CPU + {57F68716-671A-476C-9F07-E0E86FDE6940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {57F68716-671A-476C-9F07-E0E86FDE6940}.Debug|Any CPU.Build.0 = Debug|Any CPU + {57F68716-671A-476C-9F07-E0E86FDE6940}.Release|Any CPU.ActiveCfg = Release|Any CPU + {57F68716-671A-476C-9F07-E0E86FDE6940}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {3C571A15-3810-4F6D-8C61-DC97A8428C7A} = {E73280D9-92D3-4894-B0CA-43AEADB86FD2} + {2D975A5D-3612-4536-A501-248F6B9A5AC2} = {FA6E3503-ADFD-46D3-912B-D4A05BF4407F} + {340A176C-AE9F-4F01-A82F-AAAAF140A728} = {2D975A5D-3612-4536-A501-248F6B9A5AC2} + {96718232-FFFA-4E3C-B068-53C679B60669} = {2D975A5D-3612-4536-A501-248F6B9A5AC2} + {57F68716-671A-476C-9F07-E0E86FDE6940} = {2D975A5D-3612-4536-A501-248F6B9A5AC2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2BE248DF-16B1-42EF-9A34-C3FE5359D418} diff --git a/src/server/ProxmoxConnector.Server.Application/Class1.cs b/src/server/ProxmoxConnector.Server.Application/Class1.cs new file mode 100644 index 0000000..e066fea --- /dev/null +++ b/src/server/ProxmoxConnector.Server.Application/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace ProxmoxConnector.Server.Application +{ + public class Class1 + { + } +} diff --git a/src/server/ProxmoxConnector.Server.Application/ProxmoxConnector.Server.Application.csproj b/src/server/ProxmoxConnector.Server.Application/ProxmoxConnector.Server.Application.csproj new file mode 100644 index 0000000..f208d30 --- /dev/null +++ b/src/server/ProxmoxConnector.Server.Application/ProxmoxConnector.Server.Application.csproj @@ -0,0 +1,7 @@ + + + + net5.0 + + + diff --git a/src/server/ProxmoxConnector.Server.Domain/Class1.cs b/src/server/ProxmoxConnector.Server.Domain/Class1.cs new file mode 100644 index 0000000..bb47c73 --- /dev/null +++ b/src/server/ProxmoxConnector.Server.Domain/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace ProxmoxConnector.Server.Domain +{ + public class Class1 + { + } +} diff --git a/src/server/ProxmoxConnector.Server.Domain/ProxmoxConnector.Server.Domain.csproj b/src/server/ProxmoxConnector.Server.Domain/ProxmoxConnector.Server.Domain.csproj new file mode 100644 index 0000000..f208d30 --- /dev/null +++ b/src/server/ProxmoxConnector.Server.Domain/ProxmoxConnector.Server.Domain.csproj @@ -0,0 +1,7 @@ + + + + net5.0 + + + diff --git a/src/server/ProxmoxConnector.Server/Controllers/WeatherForecastController.cs b/src/server/ProxmoxConnector.Server/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..26f1eb5 --- /dev/null +++ b/src/server/ProxmoxConnector.Server/Controllers/WeatherForecastController.cs @@ -0,0 +1,39 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace ProxmoxConnector.Server.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 _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable 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(); + } + } +} diff --git a/src/server/ProxmoxConnector.Server/Program.cs b/src/server/ProxmoxConnector.Server/Program.cs new file mode 100644 index 0000000..d71492b --- /dev/null +++ b/src/server/ProxmoxConnector.Server/Program.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace ProxmoxConnector.Server +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/src/server/ProxmoxConnector.Server/Properties/launchSettings.json b/src/server/ProxmoxConnector.Server/Properties/launchSettings.json new file mode 100644 index 0000000..2536590 --- /dev/null +++ b/src/server/ProxmoxConnector.Server/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:65222", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "ProxmoxConnector.Server": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/server/ProxmoxConnector.Server/ProxmoxConnector.Server.csproj b/src/server/ProxmoxConnector.Server/ProxmoxConnector.Server.csproj new file mode 100644 index 0000000..2884716 --- /dev/null +++ b/src/server/ProxmoxConnector.Server/ProxmoxConnector.Server.csproj @@ -0,0 +1,11 @@ + + + + net5.0 + + + + + + + diff --git a/src/server/ProxmoxConnector.Server/Startup.cs b/src/server/ProxmoxConnector.Server/Startup.cs new file mode 100644 index 0000000..6f41cb5 --- /dev/null +++ b/src/server/ProxmoxConnector.Server/Startup.cs @@ -0,0 +1,56 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace ProxmoxConnector.Server +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + + services.AddControllers(); + services.AddSwaggerGen(c => + { + c.SwaggerDoc("v1", new OpenApiInfo { Title = "ProxmoxConnector.Server", Version = "v1" }); + }); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ProxmoxConnector.Server v1")); + } + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/src/server/ProxmoxConnector.Server/WeatherForecast.cs b/src/server/ProxmoxConnector.Server/WeatherForecast.cs new file mode 100644 index 0000000..5e35eed --- /dev/null +++ b/src/server/ProxmoxConnector.Server/WeatherForecast.cs @@ -0,0 +1,15 @@ +using System; + +namespace ProxmoxConnector.Server +{ + 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; } + } +} diff --git a/src/server/ProxmoxConnector.Server/appsettings.Development.json b/src/server/ProxmoxConnector.Server/appsettings.Development.json new file mode 100644 index 0000000..8983e0f --- /dev/null +++ b/src/server/ProxmoxConnector.Server/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/src/server/ProxmoxConnector.Server/appsettings.json b/src/server/ProxmoxConnector.Server/appsettings.json new file mode 100644 index 0000000..d9d9a9b --- /dev/null +++ b/src/server/ProxmoxConnector.Server/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +}