NetworkResurrector.Agent.Wrapper
parent
aad3610684
commit
9d892ba1e8
|
@ -71,6 +71,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "notes", "notes", "{6973CB33
|
||||||
notes\nugets.txt = notes\nugets.txt
|
notes\nugets.txt = notes\nugets.txt
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkResurrector.Agent.Wrapper", "src\agent\NetworkResurrector.Agent.Wrapper\NetworkResurrector.Agent.Wrapper.csproj", "{3624DFF4-C692-42F8-BDC2-1C2107E6EDC8}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -145,6 +147,10 @@ Global
|
||||||
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3624DFF4-C692-42F8-BDC2-1C2107E6EDC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3624DFF4-C692-42F8-BDC2-1C2107E6EDC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3624DFF4-C692-42F8-BDC2-1C2107E6EDC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3624DFF4-C692-42F8-BDC2-1C2107E6EDC8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -173,6 +179,7 @@ Global
|
||||||
{388D632D-8104-45E2-8017-D04848941F29} = {6889D39C-D8DA-4B99-AFC1-F0B6355E73C0}
|
{388D632D-8104-45E2-8017-D04848941F29} = {6889D39C-D8DA-4B99-AFC1-F0B6355E73C0}
|
||||||
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6} = {43C78941-52E6-4AB8-9170-CC7C006E4784}
|
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6} = {43C78941-52E6-4AB8-9170-CC7C006E4784}
|
||||||
{6973CB33-B940-41B0-B3BB-22ED2ECB8E1D} = {FDDE879C-E0A3-4BF1-945F-7FEA324C8EBA}
|
{6973CB33-B940-41B0-B3BB-22ED2ECB8E1D} = {FDDE879C-E0A3-4BF1-945F-7FEA324C8EBA}
|
||||||
|
{3624DFF4-C692-42F8-BDC2-1C2107E6EDC8} = {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}
|
||||||
|
|
|
@ -6,4 +6,7 @@ dotnet pack /*--include-symbols*/
|
||||||
# Server:
|
# Server:
|
||||||
dotnet nuget push NetworkResurrector.Server.PublishedLanguage.1.0.3.nupkg -k ***REMOVED*** -s https://toodle.ddns.net/public-nuget-server/nuget
|
dotnet nuget push NetworkResurrector.Server.PublishedLanguage.1.0.3.nupkg -k ***REMOVED*** -s https://toodle.ddns.net/public-nuget-server/nuget
|
||||||
dotnet nuget push NetworkResurrector.Server.Wrapper.1.0.3.2.nupkg -k ***REMOVED*** -s https://toodle.ddns.net/public-nuget-server/nuget
|
dotnet nuget push NetworkResurrector.Server.Wrapper.1.0.3.2.nupkg -k ***REMOVED*** -s https://toodle.ddns.net/public-nuget-server/nuget
|
||||||
|
|
||||||
|
# Agent
|
||||||
|
dotnet nuget push NetworkResurrector.Agent.PublishedLanguage.1.0.3.nupkg -k ***REMOVED*** -s https://toodle.ddns.net/public-nuget-server/nuget
|
||||||
#######################################################################################################################################################
|
#######################################################################################################################################################
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
<Description>Network resurrector agent published language nuget package</Description>
|
||||||
|
<PackageProjectUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</RepositoryUrl>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
namespace NetworkResurrector.Agent.Wrapper.Constants
|
||||||
|
{
|
||||||
|
internal struct ApiRoutes
|
||||||
|
{
|
||||||
|
public const string
|
||||||
|
Shutdown = "host/shutdown",
|
||||||
|
Restart = "host/restart",
|
||||||
|
Sleep = "host/sleep",
|
||||||
|
Logout = "host/logout",
|
||||||
|
Lock = "host/lock",
|
||||||
|
Cancel = "host/cancel";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using NetworkResurrector.Agent.Wrapper.Services;
|
||||||
|
|
||||||
|
namespace NetworkResurrector.Agent.Wrapper
|
||||||
|
{
|
||||||
|
public static class DependencyInjectionExtension
|
||||||
|
{
|
||||||
|
public static void UseResurrectorAgentServices(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddHttpClient<IResurrectorAgentService, ResurrectorAgentService>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Http" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
|
<PackageReference Include="NDB.Extensions.Http" Version="1.0.0" />
|
||||||
|
<PackageReference Include="NetworkResurrector.Agent.PublishedLanguage" Version="1.0.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace NetworkResurrector.Agent.Wrapper.Services
|
||||||
|
{
|
||||||
|
public interface IResurrectorAgentService
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
using NDB.Extensions.Http;
|
||||||
|
using NetworkResurrector.Agent.PublishedLanguage.Commands;
|
||||||
|
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
||||||
|
using NetworkResurrector.Agent.Wrapper.Constants;
|
||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NetworkResurrector.Agent.Wrapper.Services
|
||||||
|
{
|
||||||
|
internal class ResurrectorAgentService : IResurrectorAgentService
|
||||||
|
{
|
||||||
|
private const string _contentType = "application/json";
|
||||||
|
private readonly HttpClient _httpClient;
|
||||||
|
|
||||||
|
public ResurrectorAgentService(HttpClient httpClient)
|
||||||
|
{
|
||||||
|
httpClient.BaseAddress = new Uri("");
|
||||||
|
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(_contentType));
|
||||||
|
|
||||||
|
_httpClient = httpClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ShutdownResult> Shutdown(string ipAddressOrMachineName)
|
||||||
|
{
|
||||||
|
var body = new Shutdown();
|
||||||
|
var result = await _httpClient.ExecutePostRequest<ShutdownResult, Shutdown>(ApiRoutes.Shutdown, body);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue