diff --git a/NetworkResurrector.Agent.Application/Class1.cs b/NetworkResurrector.Agent.Application/Class1.cs new file mode 100644 index 0000000..863eda3 --- /dev/null +++ b/NetworkResurrector.Agent.Application/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace NetworkResurrector.Agent.Application +{ + public class Class1 + { + } +} diff --git a/NetworkResurrector.Agent.Application/NetworkResurrector.Agent.Application.csproj b/NetworkResurrector.Agent.Application/NetworkResurrector.Agent.Application.csproj new file mode 100644 index 0000000..9f5c4f4 --- /dev/null +++ b/NetworkResurrector.Agent.Application/NetworkResurrector.Agent.Application.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/NetworkResurrector.Agent.Domain.Data/Class1.cs b/NetworkResurrector.Agent.Domain.Data/Class1.cs new file mode 100644 index 0000000..47148de --- /dev/null +++ b/NetworkResurrector.Agent.Domain.Data/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace NetworkResurrector.Agent.Domain.Data +{ + public class Class1 + { + } +} diff --git a/NetworkResurrector.Agent.Domain.Data/NetworkResurrector.Agent.Domain.Data.csproj b/NetworkResurrector.Agent.Domain.Data/NetworkResurrector.Agent.Domain.Data.csproj new file mode 100644 index 0000000..9f5c4f4 --- /dev/null +++ b/NetworkResurrector.Agent.Domain.Data/NetworkResurrector.Agent.Domain.Data.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/NetworkResurrector.Agent.Domain/Class1.cs b/NetworkResurrector.Agent.Domain/Class1.cs new file mode 100644 index 0000000..0bcb93e --- /dev/null +++ b/NetworkResurrector.Agent.Domain/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace NetworkResurrector.Agent.Domain +{ + public class Class1 + { + } +} diff --git a/NetworkResurrector.Agent.Domain/NetworkResurrector.Agent.Domain.csproj b/NetworkResurrector.Agent.Domain/NetworkResurrector.Agent.Domain.csproj new file mode 100644 index 0000000..9f5c4f4 --- /dev/null +++ b/NetworkResurrector.Agent.Domain/NetworkResurrector.Agent.Domain.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/NetworkResurrector.Agent/Controllers/WeatherForecastController.cs b/NetworkResurrector.Agent/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..633d97c --- /dev/null +++ b/NetworkResurrector.Agent/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 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 _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/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj b/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj new file mode 100644 index 0000000..d12c450 --- /dev/null +++ b/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj @@ -0,0 +1,8 @@ + + + + netcoreapp3.1 + + + + diff --git a/NetworkResurrector.Agent/Program.cs b/NetworkResurrector.Agent/Program.cs new file mode 100644 index 0000000..fe10858 --- /dev/null +++ b/NetworkResurrector.Agent/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 NetworkResurrector.Agent +{ + 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/NetworkResurrector.Agent/Properties/launchSettings.json b/NetworkResurrector.Agent/Properties/launchSettings.json new file mode 100644 index 0000000..4210700 --- /dev/null +++ b/NetworkResurrector.Agent/Properties/launchSettings.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52975", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "NetworkResurrector.Agent": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/NetworkResurrector.Agent/Startup.cs b/NetworkResurrector.Agent/Startup.cs new file mode 100644 index 0000000..6ded2be --- /dev/null +++ b/NetworkResurrector.Agent/Startup.cs @@ -0,0 +1,48 @@ +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 System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace NetworkResurrector.Agent +{ + 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(); + } + + // 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.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/NetworkResurrector.Agent/WeatherForecast.cs b/NetworkResurrector.Agent/WeatherForecast.cs new file mode 100644 index 0000000..146091e --- /dev/null +++ b/NetworkResurrector.Agent/WeatherForecast.cs @@ -0,0 +1,15 @@ +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; } + } +} diff --git a/NetworkResurrector.Agent/appsettings.Development.json b/NetworkResurrector.Agent/appsettings.Development.json new file mode 100644 index 0000000..8983e0f --- /dev/null +++ b/NetworkResurrector.Agent/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/NetworkResurrector.Agent/appsettings.json b/NetworkResurrector.Agent/appsettings.json new file mode 100644 index 0000000..d9d9a9b --- /dev/null +++ b/NetworkResurrector.Agent/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/NetworkResurrector.sln b/NetworkResurrector.sln index 04f641d..999e3dc 100644 --- a/NetworkResurrector.sln +++ b/NetworkResurrector.sln @@ -30,6 +30,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B0C5F0C1-0BF EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{6889D39C-D8DA-4B99-AFC1-F0B6355E73C0}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "agent", "agent", "{43C78941-52E6-4AB8-9170-CC7C006E4784}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkResurrector.Agent", "NetworkResurrector.Agent\NetworkResurrector.Agent.csproj", "{E10CEE53-8167-446F-BFF3-B80725BB6C90}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkResurrector.Agent.Application", "NetworkResurrector.Agent.Application\NetworkResurrector.Agent.Application.csproj", "{EE31B126-12EC-46B3-8FB4-AD5BCF14C029}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkResurrector.Agent.Domain", "NetworkResurrector.Agent.Domain\NetworkResurrector.Agent.Domain.csproj", "{885D5625-028A-4B35-8C89-7EF718BC6E34}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkResurrector.Agent.Domain.Data", "NetworkResurrector.Agent.Domain.Data\NetworkResurrector.Agent.Domain.Data.csproj", "{509767A7-D11C-4143-8D45-01E62DFC2C74}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -60,6 +70,22 @@ Global {8A593A37-7ECA-4EDD-A0A7-86CA88ECC1BD}.Debug|Any CPU.Build.0 = Debug|Any CPU {8A593A37-7ECA-4EDD-A0A7-86CA88ECC1BD}.Release|Any CPU.ActiveCfg = Release|Any CPU {8A593A37-7ECA-4EDD-A0A7-86CA88ECC1BD}.Release|Any CPU.Build.0 = Release|Any CPU + {E10CEE53-8167-446F-BFF3-B80725BB6C90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E10CEE53-8167-446F-BFF3-B80725BB6C90}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E10CEE53-8167-446F-BFF3-B80725BB6C90}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E10CEE53-8167-446F-BFF3-B80725BB6C90}.Release|Any CPU.Build.0 = Release|Any CPU + {EE31B126-12EC-46B3-8FB4-AD5BCF14C029}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE31B126-12EC-46B3-8FB4-AD5BCF14C029}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE31B126-12EC-46B3-8FB4-AD5BCF14C029}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE31B126-12EC-46B3-8FB4-AD5BCF14C029}.Release|Any CPU.Build.0 = Release|Any CPU + {885D5625-028A-4B35-8C89-7EF718BC6E34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {885D5625-028A-4B35-8C89-7EF718BC6E34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {885D5625-028A-4B35-8C89-7EF718BC6E34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {885D5625-028A-4B35-8C89-7EF718BC6E34}.Release|Any CPU.Build.0 = Release|Any CPU + {509767A7-D11C-4143-8D45-01E62DFC2C74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {509767A7-D11C-4143-8D45-01E62DFC2C74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {509767A7-D11C-4143-8D45-01E62DFC2C74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {509767A7-D11C-4143-8D45-01E62DFC2C74}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -72,6 +98,11 @@ Global {59049C2B-CEFB-456D-B3D5-D2CF5325AEEB} = {6889D39C-D8DA-4B99-AFC1-F0B6355E73C0} {8A593A37-7ECA-4EDD-A0A7-86CA88ECC1BD} = {6889D39C-D8DA-4B99-AFC1-F0B6355E73C0} {6889D39C-D8DA-4B99-AFC1-F0B6355E73C0} = {B0C5F0C1-0BF8-4651-AAFC-BE01F516D7B8} + {43C78941-52E6-4AB8-9170-CC7C006E4784} = {B0C5F0C1-0BF8-4651-AAFC-BE01F516D7B8} + {E10CEE53-8167-446F-BFF3-B80725BB6C90} = {43C78941-52E6-4AB8-9170-CC7C006E4784} + {EE31B126-12EC-46B3-8FB4-AD5BCF14C029} = {43C78941-52E6-4AB8-9170-CC7C006E4784} + {885D5625-028A-4B35-8C89-7EF718BC6E34} = {43C78941-52E6-4AB8-9170-CC7C006E4784} + {509767A7-D11C-4143-8D45-01E62DFC2C74} = {43C78941-52E6-4AB8-9170-CC7C006E4784} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {351D76E9-FE02-4C30-A464-7B29AFC64BC7}