web-proxy rewrite

This commit is contained in:
Kevin Kai Berthold 2023-09-21 23:44:05 +02:00
parent 26c741ad03
commit 283fa1abc2
10 changed files with 63 additions and 134 deletions

View file

@ -6,27 +6,12 @@ namespace Insight.Domain.Messages.Agent;
public partial class ConsoleQuery : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public string? HostId { get; set; }
[MemoryPackOrder(2)]
public string? Query { get; set; }
[MemoryPackOrder(3)]
public string? Data { get; set; }
[MemoryPackOrder(4)]
[MemoryPackOrder(1)]
public string? Errors { get; set; }
[MemoryPackOrder(5)]
public bool IsString { get; set; }
[MemoryPackOrder(6)]
public bool IsArray { get; set; }
[MemoryPackOrder(7)]
[MemoryPackOrder(2)]
public bool HadErrors { get; set; }
}
@ -34,11 +19,5 @@ public partial class ConsoleQuery : IMessage
public partial class ConsoleQueryRequest : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public string? HostId { get; set; }
[MemoryPackOrder(2)]
public string? Query { get; set; }
}

View file

@ -4,11 +4,9 @@ namespace Insight.Domain.Messages;
[MemoryPackable]
[MemoryPackUnion(0, typeof(Keepalive))]
[MemoryPackUnion(1, typeof(Agent.Authentication))]
[MemoryPackUnion(2, typeof(Agent.AuthenticationRequest))]
[MemoryPackUnion(1, typeof(Agent.AuthenticationRequest))]
[MemoryPackUnion(2, typeof(Agent.Authentication))]
[MemoryPackUnion(10, typeof(Agent.InventoryRequest))]
[MemoryPackUnion(20, typeof(Agent.ConsoleQuery))]
[MemoryPackUnion(21, typeof(Agent.ConsoleQueryRequest))]
[MemoryPackUnion(100, typeof(Agent.Application))]
[MemoryPackUnion(101, typeof(Agent.ApplicationList))]
[MemoryPackUnion(102, typeof(Agent.Drive))]
@ -41,6 +39,8 @@ namespace Insight.Domain.Messages;
[MemoryPackUnion(129, typeof(Agent.VideocardList))]
[MemoryPackUnion(130, typeof(Agent.VirtualMaschine))]
[MemoryPackUnion(131, typeof(Agent.VirtualMaschineList))]
[MemoryPackUnion(400, typeof(Web.ConsoleQueryProxy))]
[MemoryPackUnion(401, typeof(Web.ConsoleQueryProxyRequest))]
[MemoryPackUnion(132, typeof(Agent.ConsoleQuery))]
[MemoryPackUnion(133, typeof(Agent.ConsoleQueryRequest))]
[MemoryPackUnion(1000, typeof(Proxy<Agent.ConsoleQuery>))]
[MemoryPackUnion(1001, typeof(Proxy<Agent.ConsoleQueryRequest>))]
public partial interface IMessage { }

View file

@ -0,0 +1,17 @@
using MemoryPack;
namespace Insight.Domain.Messages;
[MemoryPackable]
public partial class Proxy<TMessage> : IMessage
where TMessage : IMessage
{
[MemoryPackOrder(0)]
public string? RequestId { get; set; }
[MemoryPackOrder(1)]
public string? HostId { get; set; }
[MemoryPackOrder(2)]
public TMessage? Message { get; set; }
}

View file

@ -1,38 +0,0 @@
using MemoryPack;
namespace Insight.Domain.Messages.Web;
[MemoryPackable]
public partial class ConsoleQueryProxy : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public string? HostId { get; set; }
[MemoryPackOrder(2)]
public string? Query { get; set; }
[MemoryPackOrder(3)]
public string? Data { get; set; }
[MemoryPackOrder(4)]
public string? Errors { get; set; }
[MemoryPackOrder(7)]
public bool HadErrors { get; set; }
}
[MemoryPackable]
public partial class ConsoleQueryProxyRequest : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public string? HostId { get; set; }
[MemoryPackOrder(2)]
public string? Query { get; set; }
}