testing remote stuff

This commit is contained in:
kkb 2023-11-17 17:12:41 +01:00
parent 1e05d4576d
commit 3c9ccaafeb
374 changed files with 10526 additions and 2037 deletions

View file

@ -0,0 +1,8 @@
namespace Insight.Domain.Enums;
public enum RemoteControlMode
{
Unknown,
Unattended,
Attended
}

View file

@ -0,0 +1,7 @@
namespace Insight.Domain.Enums;
public enum SessionEndReasons
{
Logoff = 1,
SystemShutdown = 2
}

View file

@ -0,0 +1,14 @@
namespace Insight.Domain.Enums;
public enum SessionSwitchReason
{
ConsoleConnect = 1,
ConsoleDisconnect = 2,
RemoteConnect = 3,
RemoteDisconnect = 4,
SessionLogon = 5,
SessionLogoff = 6,
SessionLock = 7,
SessionUnlock = 8,
SessionRemoteControl = 9
}

View file

@ -6,11 +6,11 @@
<Nullable>enable</Nullable>
<RootNamespace>Insight.Domain</RootNamespace>
<Product>Insight</Product>
<AssemblyVersion>2023.9.21.1</AssemblyVersion>
<AssemblyVersion>2023.11.17.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Vaitr.Network" Version="2023.9.21" />
<PackageReference Include="Vaitr.Network" Version="2023.10.22" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View file

@ -1,4 +1,4 @@
using Insight.Domain.Messages;
using Insight.Domain.Network;
namespace Insight.Domain.Interfaces;

View file

@ -1,23 +0,0 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
[MemoryPackable]
public partial class ConsoleQuery : IMessage
{
[MemoryPackOrder(0)]
public string? Data { get; set; }
[MemoryPackOrder(1)]
public string? Errors { get; set; }
[MemoryPackOrder(2)]
public bool HadErrors { get; set; }
}
[MemoryPackable]
public partial class ConsoleQueryRequest : IMessage
{
[MemoryPackOrder(0)]
public string? Query { get; set; }
}

View file

@ -1,46 +0,0 @@
using MemoryPack;
namespace Insight.Domain.Messages;
[MemoryPackable]
[MemoryPackUnion(0, typeof(Keepalive))]
[MemoryPackUnion(1, typeof(Agent.AuthenticationRequest))]
[MemoryPackUnion(2, typeof(Agent.Authentication))]
[MemoryPackUnion(10, typeof(Agent.InventoryRequest))]
[MemoryPackUnion(100, typeof(Agent.Application))]
[MemoryPackUnion(101, typeof(Agent.ApplicationList))]
[MemoryPackUnion(102, typeof(Agent.Drive))]
[MemoryPackUnion(103, typeof(Agent.DriveList))]
[MemoryPackUnion(104, typeof(Agent.Event))]
[MemoryPackUnion(105, typeof(Agent.Interface))]
[MemoryPackUnion(106, typeof(Agent.InterfaceList))]
[MemoryPackUnion(107, typeof(Agent.Mainboard))]
[MemoryPackUnion(108, typeof(Agent.Memory))]
[MemoryPackUnion(109, typeof(Agent.MemoryList))]
[MemoryPackUnion(110, typeof(Agent.OperationSystem))]
[MemoryPackUnion(111, typeof(Agent.Printer))]
[MemoryPackUnion(112, typeof(Agent.PrinterList))]
[MemoryPackUnion(113, typeof(Agent.Processor))]
[MemoryPackUnion(114, typeof(Agent.ProcessorList))]
[MemoryPackUnion(115, typeof(Agent.Service))]
[MemoryPackUnion(116, typeof(Agent.ServiceList))]
[MemoryPackUnion(117, typeof(Agent.Session))]
[MemoryPackUnion(118, typeof(Agent.SessionList))]
[MemoryPackUnion(119, typeof(Agent.Status))]
[MemoryPackUnion(120, typeof(Agent.StoragePool))]
[MemoryPackUnion(121, typeof(Agent.StoragePoolList))]
[MemoryPackUnion(122, typeof(Agent.SystemInfo))]
[MemoryPackUnion(123, typeof(Agent.Trap))]
[MemoryPackUnion(124, typeof(Agent.Update))]
[MemoryPackUnion(125, typeof(Agent.UpdateList))]
[MemoryPackUnion(126, typeof(Agent.User))]
[MemoryPackUnion(127, typeof(Agent.UserList))]
[MemoryPackUnion(128, typeof(Agent.Videocard))]
[MemoryPackUnion(129, typeof(Agent.VideocardList))]
[MemoryPackUnion(130, typeof(Agent.VirtualMaschine))]
[MemoryPackUnion(131, typeof(Agent.VirtualMaschineList))]
[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

@ -1,6 +0,0 @@
using MemoryPack;
namespace Insight.Domain.Messages;
[MemoryPackable]
public partial class Keepalive : IMessage { }

View file

@ -0,0 +1,148 @@
using MessagePack;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
namespace RemoteControl.Shared;
/// <summary>
/// Describes the success or failure of any kind of operation.
/// </summary>
[DataContract]
public class Result
{
/// <summary>
/// For serialization only.
/// </summary>
[SerializationConstructor]
[JsonConstructor]
public Result() { }
public Result(bool isSuccess, string reason = "", Exception? exception = null)
{
if (!isSuccess && exception is null && string.IsNullOrWhiteSpace(reason))
{
throw new ArgumentException("A reason or exception must be supplied for an unsuccessful result.");
}
IsSuccess = isSuccess;
Exception = exception;
Reason = reason;
}
[IgnoreDataMember]
public Exception? Exception { get; init; }
[IgnoreDataMember]
[MemberNotNullWhen(true, nameof(Exception))]
public bool HadException => Exception is not null;
[DataMember]
public bool IsSuccess { get; init; }
[DataMember]
public string Reason { get; init; } = string.Empty;
public static Result Fail(string reason)
{
return new Result(false, reason);
}
public static Result Fail(Exception ex)
{
return new Result(false, string.Empty, ex);
}
public static Result<T> Fail<T>(string reason)
{
return new Result<T>(reason);
}
public static Result<T> Fail<T>(Exception ex)
{
return new Result<T>(ex);
}
public static Result Ok()
{
return new Result(true);
}
public static Result<T> Ok<T>(T value)
{
return new Result<T>(value);
}
}
/// <summary>
/// Describes the success or failure of any kind of operation.
/// </summary>
[DataContract]
public class Result<T>
{
/// <summary>
/// Returns a successful result with the given value.
/// </summary>
/// <param name="value"></param>
public Result(T value)
{
IsSuccess = true;
Value = value;
}
/// <summary>
/// Returns an unsuccessful result with the given exception.
/// </summary>
/// <param name="exception"></param>
public Result(Exception exception)
{
IsSuccess = false;
Exception = exception;
Reason = exception.Message;
}
/// <summary>
/// Returns an unsuccessful result with the given reason.
/// </summary>
/// <param name="errorMessage"></param>
/// <exception cref="ArgumentException"></exception>
public Result(string reason)
{
IsSuccess = false;
Reason = reason;
}
/// <summary>
/// For serialization only.
/// </summary>
[SerializationConstructor]
[JsonConstructor]
public Result() { }
public Result(Exception? exception, bool isSuccess, string reason, T? value)
{
Exception = exception;
IsSuccess = isSuccess;
Reason = reason;
Value = value;
}
[IgnoreDataMember]
public Exception? Exception { get; init; }
[IgnoreDataMember]
[MemberNotNullWhen(true, nameof(Exception))]
public bool HadException => Exception is not null;
[DataMember]
[MemberNotNullWhen(true, nameof(Value))]
public bool IsSuccess { get; init; }
[DataMember]
public string Reason { get; init; } = string.Empty;
[DataMember]
public T? Value { get; init; }
}

View file

@ -1,7 +1,7 @@
using MemoryPack;
using System.Runtime.InteropServices;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Application : IMessage
@ -29,7 +29,4 @@ public partial class Application : IMessage
[MemoryPackOrder(7)]
public Architecture? Architecture { get; set; }
}
[MemoryPackable(GenerateType.Collection)]
public partial class ApplicationList : List<Application>, IMessage { }
}

View file

@ -1,9 +1,12 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Authentication : IMessage
public partial class AuthenticationRequest : IMessage { }
[MemoryPackable]
public partial class AuthenticationResponse : IMessage
{
[MemoryPackOrder(0)]
public PlatformType? Platform { get; set; }
@ -23,7 +26,4 @@ public partial class Authentication : IMessage
Windows = 1,
Unix = 2
}
}
[MemoryPackable]
public partial class AuthenticationRequest : IMessage { }
}

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class InventoryRequest : IMessage { }

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Drive : IMessage
@ -39,9 +39,6 @@ public partial class Drive : IMessage
public List<Volume>? Volumes { get; set; }
}
[MemoryPackable(GenerateType.Collection)]
public partial class DriveList : List<Drive>, IMessage { }
[MemoryPackable]
public partial class Volume : IMessage
{

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Event : IMessage

View file

@ -3,7 +3,7 @@ using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Interface : IMessage
@ -90,9 +90,6 @@ public partial class Interface : IMessage
public List<Route>? Routes { get; set; }
}
[MemoryPackable(GenerateType.Collection)]
public partial class InterfaceList : List<Interface>, IMessage { }
[MemoryPackable]
public partial class Unicast : IMessage
{

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Mainboard : IMessage

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Memory : IMessage
@ -39,9 +39,6 @@ public partial class Memory : IMessage
public uint? ConfiguredVoltage { get; set; }
}
[MemoryPackable(GenerateType.Collection)]
public partial class MemoryList : List<Memory>, IMessage { }
[MemoryPackable]
public partial class MemoryMetric : IMessage
{

View file

@ -1,7 +1,7 @@
using MemoryPack;
using System.Runtime.InteropServices;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class OperationSystem : IMessage

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Printer : IMessage
@ -19,7 +19,4 @@ public partial class Printer : IMessage
[MemoryPackOrder(4)]
public string? Comment { get; set; }
}
[MemoryPackable(GenerateType.Collection)]
public partial class PrinterList : List<Printer>, IMessage { }
}

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Processor : IMessage
@ -51,9 +51,6 @@ public partial class Processor : IMessage
public bool? Virtualization { get; set; }
}
[MemoryPackable(GenerateType.Collection)]
public partial class ProcessorList : List<Processor>, IMessage { }
[MemoryPackable]
public partial class ProcessorMetric : IMessage
{

View file

@ -0,0 +1,61 @@
using MemoryPack;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Request : IMessage
{
[MemoryPackOrder(0)]
public string? RequestId { get; set; }
[MemoryPackOrder(1)]
public string? RequestData { get; set; }
}
[MemoryPackable]
public partial class Response : IMessage
{
[MemoryPackOrder(0)]
public string? RequestId { get; set; }
[MemoryPackOrder(1)]
public string? RequestData { get; set; }
[MemoryPackOrder(2)]
public string? ResponseId { get; set; }
[MemoryPackOrder(3)]
public string? ResponseData { get; set; }
[MemoryPackOrder(4)]
public bool? ResponseError { get; set; }
[MemoryPackConstructor]
public Response() { }
public Response(Request request)
{
RequestId = request.RequestId;
RequestData = request.RequestData;
}
}
//[MemoryPackable]
//public partial class ConsoleQueryRequest : IMessage
//{
// [MemoryPackOrder(0)]
// public string? Query { get; set; }
//}
//[MemoryPackable]
//public partial class ConsoleQueryResponse : IMessage
//{
// [MemoryPackOrder(0)]
// public string? Data { get; set; }
// [MemoryPackOrder(1)]
// public string? Errors { get; set; }
// [MemoryPackOrder(2)]
// public bool HadErrors { get; set; }
//}

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Service : IMessage
@ -53,7 +53,4 @@ public partial class Service : IMessage
Manual = 3,
Disabled = 4
}
}
[MemoryPackable(GenerateType.Collection)]
public partial class ServiceList : List<Service>, IMessage { }
}

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Session : IMessage
@ -19,7 +19,4 @@ public partial class Session : IMessage
[MemoryPackOrder(4)]
public string? Remote { get; set; }
}
[MemoryPackable(GenerateType.Collection)]
public partial class SessionList : List<Session>, IMessage { }
}

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Status : IMessage

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class StoragePool : IMessage
@ -90,9 +90,6 @@ public partial class StoragePool : IMessage
}
}
[MemoryPackable(GenerateType.Collection)]
public partial class StoragePoolList : List<StoragePool>, IMessage { }
[MemoryPackable]
public partial class PhysicalDisk : IMessage
{

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class SystemInfo : IMessage

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Trap : IMessage

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Update : IMessage
@ -68,7 +68,7 @@ public partial class Update : IMessage
}
[MemoryPackable]
public partial class UpdateList : IMessage
public partial class UpdateCollection : IMessage
{
[MemoryPackOrder(0)]
public List<Update>? Installed { get; set; }

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class User : IMessage
@ -45,9 +45,6 @@ public partial class User : IMessage
public List<Group>? Groups { get; set; }
}
[MemoryPackable(GenerateType.Collection)]
public partial class UserList : List<User>, IMessage { }
[MemoryPackable]
public partial class Group : IMessage
{

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class Videocard : IMessage
@ -19,7 +19,4 @@ public partial class Videocard : IMessage
[MemoryPackOrder(4)]
public string? DriverVersion { get; set; }
}
[MemoryPackable(GenerateType.Collection)]
public partial class VideocardList : List<Videocard>, IMessage { }
}

View file

@ -1,6 +1,6 @@
using MemoryPack;
namespace Insight.Domain.Messages.Agent;
namespace Insight.Domain.Network.Agent.Messages;
[MemoryPackable]
public partial class VirtualMaschine : IMessage
@ -150,9 +150,6 @@ public partial class VirtualMaschine : IMessage
}
}
[MemoryPackable(GenerateType.Collection)]
public partial class VirtualMaschineList : List<VirtualMaschine>, IMessage { }
[MemoryPackable]
public partial class VirtualMaschineConfiguration : IMessage
{

View file

@ -0,0 +1,7 @@
using MemoryPack;
namespace Insight.Domain.Network;
[MemoryPackable(GenerateType.Collection)]
public partial class Collection<TMessage> : List<TMessage>, IMessage where TMessage : IMessage
{ }

View file

@ -0,0 +1,54 @@
using MemoryPack;
namespace Insight.Domain.Network;
// AGENT [0 - 99]
[MemoryPackUnion(0, typeof(Agent.Messages.AuthenticationRequest))]
[MemoryPackUnion(1, typeof(Agent.Messages.AuthenticationResponse))]
[MemoryPackUnion(2, typeof(Agent.Messages.InventoryRequest))]
//[MemoryPackUnion(3, typeof(Agent.Messages.ConsoleQueryRequest))]
//[MemoryPackUnion(4, typeof(Agent.Messages.ConsoleQueryResponse))]
//[MemoryPackUnion(5, typeof(Proxy<Agent.Messages.ConsoleQueryResponse>))]
//[MemoryPackUnion(6, typeof(Proxy<Agent.Messages.ConsoleQueryRequest>))]
[MemoryPackUnion(7, typeof(Agent.Messages.Event))]
[MemoryPackUnion(8, typeof(Agent.Messages.Trap))]
[MemoryPackUnion(9, typeof(Agent.Messages.Mainboard))]
[MemoryPackUnion(10, typeof(Agent.Messages.OperationSystem))]
[MemoryPackUnion(11, typeof(Agent.Messages.Status))]
[MemoryPackUnion(12, typeof(Agent.Messages.SystemInfo))]
[MemoryPackUnion(13, typeof(Collection<Agent.Messages.Application>))]
[MemoryPackUnion(14, typeof(Collection<Agent.Messages.Drive>))]
[MemoryPackUnion(15, typeof(Collection<Agent.Messages.Interface>))]
[MemoryPackUnion(16, typeof(Collection<Agent.Messages.Memory>))]
[MemoryPackUnion(17, typeof(Collection<Agent.Messages.Printer>))]
[MemoryPackUnion(18, typeof(Collection<Agent.Messages.Processor>))]
[MemoryPackUnion(19, typeof(Collection<Agent.Messages.Service>))]
[MemoryPackUnion(20, typeof(Collection<Agent.Messages.Session>))]
[MemoryPackUnion(21, typeof(Collection<Agent.Messages.StoragePool>))]
[MemoryPackUnion(22, typeof(Agent.Messages.UpdateCollection))]
[MemoryPackUnion(23, typeof(Collection<Agent.Messages.User>))]
[MemoryPackUnion(24, typeof(Collection<Agent.Messages.Videocard>))]
[MemoryPackUnion(25, typeof(Collection<Agent.Messages.VirtualMaschine>))]
[MemoryPackUnion(50, typeof(Agent.Messages.Request))]
[MemoryPackUnion(51, typeof(Agent.Messages.Response))]
[MemoryPackUnion(52, typeof(Proxy<Agent.Messages.Request>))]
[MemoryPackUnion(53, typeof(Proxy<Agent.Messages.Response>))]
// REMOTE [100 - 199]
[MemoryPackUnion(102, typeof(Remote.Messages.RemoteSessionRequest))]
[MemoryPackUnion(103, typeof(Remote.Messages.RemoteSessionResponse))]
[MemoryPackUnion(104, typeof(Remote.Messages.CastRequest))]
[MemoryPackUnion(105, typeof(Remote.Messages.CastRequestResponse))]
[MemoryPackUnion(107, typeof(Remote.Messages.CastAbort))]
[MemoryPackUnion(108, typeof(Remote.Messages.CastMetric))]
[MemoryPackUnion(109, typeof(Remote.Messages.CastDisplay))]
[MemoryPackUnion(110, typeof(Remote.Messages.CastScreen))]
[MemoryPackUnion(111, typeof(Remote.Messages.CastScreenReceived))]
[MemoryPackUnion(112, typeof(Remote.Messages.CastCursor))]
[MemoryPackUnion(113, typeof(Remote.Messages.CastCursorReceived))]
[MemoryPackUnion(114, typeof(Remote.Messages.CastClipboardReceived))]
[MemoryPackUnion(115, typeof(Remote.Messages.CastAudio))]
[MemoryPackable]
public partial interface IMessage { }

View file

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

View file

@ -0,0 +1,24 @@
using Insight.Domain.Enums;
using MemoryPack;
namespace Insight.Domain.Network.Remote.Messages;
[MemoryPackable]
public partial class RemoteSessionRequest : IMessage
{
[MemoryPackOrder(0)]
public RemoteControlMode Mode { get; set; }
[MemoryPackOrder(1)]
public string? AccessKey { get; set; }
[MemoryPackOrder(2)]
public string? Hostname { get; set; }
}
[MemoryPackable]
public partial class RemoteSessionResponse : IMessage
{
[MemoryPackOrder(0)]
public string? SessionId { get; set; }
}

View file

@ -0,0 +1,185 @@
using Insight.Domain.Enums;
using MemoryPack;
namespace Insight.Domain.Network.Remote.Messages;
[MemoryPackable]
public partial class CastRequest : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public RemoteControlMode Mode { get; set; }
[MemoryPackOrder(2)]
public string? RequesterName { get; set; }
[MemoryPackOrder(3)]
public string? AccessKey { get; set; }
}
[MemoryPackable]
public partial class CastRequestResponse : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(0)]
public bool Accepted { get; set; }
[MemoryPackConstructor]
public CastRequestResponse() { }
public CastRequestResponse(CastRequest request)
{
Id = request.Id;
}
}
[MemoryPackable]
public partial class CastAbort : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
}
[MemoryPackable]
public partial class CastMetric : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public DateTimeOffset? Timestamp { get; set; }
[MemoryPackOrder(2)]
public double? Mbps { get; set; }
[MemoryPackOrder(3)]
public double? Fps { get; set; }
[MemoryPackOrder(4)]
public double? RTT { get; set; }
}
[MemoryPackable]
public partial class CastDisplay : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public IEnumerable<string>? DisplayNames { get; set; }
[MemoryPackOrder(2)]
public string? SelectedDisplay { get; set; }
[MemoryPackOrder(3)]
public int ScreenWidth { get; set; }
[MemoryPackOrder(4)]
public int ScreenHeight { get; set; }
[MemoryPackOrder(5)]
public string? MachineName { get; set; }
}
[MemoryPackable]
public partial class CastScreen : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public DateTimeOffset? Timestamp { get; set; }
[MemoryPackOrder(2)]
public float? ViewWidth { get; set; }
[MemoryPackOrder(3)]
public float? ViewHeight { get; set; }
[MemoryPackOrder(4)]
public float? Left { get; set; }
[MemoryPackOrder(5)]
public float? Top { get; set; }
[MemoryPackOrder(6)]
public float? Width { get; set; }
[MemoryPackOrder(7)]
public float? Height { get; set; }
[MemoryPackOrder(8)]
public byte[]? Image { get; set; }
}
[MemoryPackable]
public partial class CastScreenReceived : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public DateTimeOffset? Timestamp { get; set; }
[MemoryPackConstructor]
public CastScreenReceived() { }
public CastScreenReceived(CastScreen screenData)
{
Id = screenData.Id;
Timestamp = screenData.Timestamp;
}
}
[MemoryPackable]
public partial class CastCursor : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public int X { get; set; }
[MemoryPackOrder(2)]
public int Y { get; set; }
[MemoryPackOrder(3)]
public byte[]? Icon { get; set; }
}
[MemoryPackable]
public partial class CastCursorReceived : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public int X { get; set; }
[MemoryPackOrder(2)]
public int Y { get; set; }
}
[MemoryPackable]
public partial class CastClipboardReceived : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public string? Text { get; set; }
}
[MemoryPackable]
public partial class CastAudio : IMessage
{
[MemoryPackOrder(0)]
public string? Id { get; set; }
[MemoryPackOrder(1)]
public byte[]? Buffer { get; set; }
}

View file

@ -10,4 +10,8 @@ public class Appsettings
public const string ServerHost = "server.host";
public const string ServerPort = "server.port";
public const string RemoteServerPort = "remote.port";
public const string RemoteServerCertificate = "remote.certificate";
public const string RemoteServerCertificatePassword = "remote.certificate.password";
}

View file

@ -1,10 +1,16 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<AgentEntity> Agent(this IMongoDatabase database) => database.GetCollection<AgentEntity>("agent");
}
[BsonIgnoreExtraElements]
public class AgentEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<AgentLogEntity> AgentLog(this IMongoDatabase database) => database.GetCollection<AgentLogEntity>("agent_log");
}
[BsonIgnoreExtraElements]
public class AgentLogEntity
{

View file

@ -1,10 +1,16 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<CustomerEntity> Customer(this IMongoDatabase database) => database.GetCollection<CustomerEntity>("customer");
}
[BsonIgnoreExtraElements]
public class CustomerEntity
{

View file

@ -1,10 +1,16 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostEntity> Host(this IMongoDatabase database) => database.GetCollection<HostEntity>("host");
}
[BsonIgnoreExtraElements]
public class HostEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostApplicationEntity> HostApplication(this IMongoDatabase database) => database.GetCollection<HostApplicationEntity>("host_app");
}
[BsonIgnoreExtraElements]
public class HostApplicationEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostDriveEntity> HostDrive(this IMongoDatabase database) => database.GetCollection<HostDriveEntity>("host_drv");
}
[BsonIgnoreExtraElements]
public class HostDriveEntity
{

View file

@ -1,9 +1,16 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostHypervisorVirtualMaschineEntity> HostHypervisorVirtualMaschine(this IMongoDatabase database) => database.GetCollection<HostHypervisorVirtualMaschineEntity>("host_hv_vm");
public static IMongoCollection<HostHypervisorVirtualMaschineConfigEntity> HostVirtualMaschineConfig(this IMongoDatabase database) => database.GetCollection<HostHypervisorVirtualMaschineConfigEntity>("host_hv_vm_cfg");
}
[BsonIgnoreExtraElements]
public class HostHypervisorVirtualMaschineEntity
{

View file

@ -1,9 +1,19 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostInterfaceEntity> HostInterface(this IMongoDatabase database) => database.GetCollection<HostInterfaceEntity>("host_if");
public static IMongoCollection<HostInterfaceAddressEntity> HostInterfaceAddress(this IMongoDatabase database) => database.GetCollection<HostInterfaceAddressEntity>("host_if_addr");
public static IMongoCollection<HostInterfaceGatewayEntity> HostInterfaceGateway(this IMongoDatabase database) => database.GetCollection<HostInterfaceGatewayEntity>("host_if_gw");
public static IMongoCollection<HostInterfaceNameserverEntity> HostInterfaceNameserver(this IMongoDatabase database) => database.GetCollection<HostInterfaceNameserverEntity>("host_if_ns");
public static IMongoCollection<HostInterfaceRouteEntity> HostInterfaceRoute(this IMongoDatabase database) => database.GetCollection<HostInterfaceRouteEntity>("host_if_rt");
}
[BsonIgnoreExtraElements]
public class HostInterfaceEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostLogEntity> HostLog(this IMongoDatabase database) => database.GetCollection<HostLogEntity>("host_log");
}
[BsonIgnoreExtraElements]
public class HostLogEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostLogMonitoringEntity> HostLogMonitoring(this IMongoDatabase database) => database.GetCollection<HostLogMonitoringEntity>("host_log_mon");
}
[BsonIgnoreExtraElements]
public class HostLogMonitoringEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostMainboardEntity> HostMainboard(this IMongoDatabase database) => database.GetCollection<HostMainboardEntity>("host_board");
}
[BsonIgnoreExtraElements]
public class HostMainboardEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostMemoryEntity> HostMemory(this IMongoDatabase database) => database.GetCollection<HostMemoryEntity>("host_mem");
}
[BsonIgnoreExtraElements]
public class HostMemoryEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostOsEntity> HostOs(this IMongoDatabase database) => database.GetCollection<HostOsEntity>("host_os");
}
[BsonIgnoreExtraElements]
public class HostOsEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostPrinterEntity> HostPrinter(this IMongoDatabase database) => database.GetCollection<HostPrinterEntity>("host_prn");
}
[BsonIgnoreExtraElements]
public class HostPrinterEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostProcessorEntity> HostProcessor(this IMongoDatabase database) => database.GetCollection<HostProcessorEntity>("host_cpu");
}
[BsonIgnoreExtraElements]
public class HostProcessorEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostServiceEntity> HostService(this IMongoDatabase database) => database.GetCollection<HostServiceEntity>("host_svc");
}
[BsonIgnoreExtraElements]
public class HostServiceEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostSessionEntity> HostSession(this IMongoDatabase database) => database.GetCollection<HostSessionEntity>("host_session");
}
[BsonIgnoreExtraElements]
public class HostSessionEntity
{

View file

@ -1,9 +1,17 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostStoragePoolEntity> HostStoragePool(this IMongoDatabase database) => database.GetCollection<HostStoragePoolEntity>("host_sp");
public static IMongoCollection<HostStoragePoolPhysicalDiskEntity> HostStoragePoolPhysicalDisk(this IMongoDatabase database) => database.GetCollection<HostStoragePoolPhysicalDiskEntity>("host_sp.pd");
public static IMongoCollection<HostStoragePoolVirtualDiskEntity> HostStoragePoolVirtualDisk(this IMongoDatabase database) => database.GetCollection<HostStoragePoolVirtualDiskEntity>("host_sp.vd");
}
[BsonIgnoreExtraElements]
public class HostStoragePoolEntity
{

View file

@ -0,0 +1,45 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostSysGroupEntity> HostSystemGroup(this IMongoDatabase database) => database.GetCollection<HostSysGroupEntity>("host_sysgrp");
}
[BsonIgnoreExtraElements]
public class HostSysGroupEntity
{
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
public string? Id { get; set; }
[BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
public string? Host { get; set; }
[BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
public string? Batch { get; set; }
[BsonElement("insert")]
public DateTime? Insert { get; set; }
[BsonElement("update")]
public DateTime? Update { get; set; }
[BsonElement("sid")]
public string? Sid { get; set; }
[BsonElement("name")]
public string? Name { get; set; }
[BsonElement("domain")]
public string? Domain { get; set; }
[BsonElement("description")]
public string? Description { get; set; }
[BsonElement("localaccount")]
public bool? LocalAccount { get; set; }
}

View file

@ -0,0 +1,66 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostSysUserEntity> HostSystemUser(this IMongoDatabase database) => database.GetCollection<HostSysUserEntity>("host_sysusr");
}
[BsonIgnoreExtraElements]
public class HostSysUserEntity
{
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
public string? Id { get; set; }
[BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
public string? Host { get; set; }
[BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
public string? Batch { get; set; }
[BsonElement("insert")]
public DateTime? Insert { get; set; }
[BsonElement("update")]
public DateTime? Update { get; set; }
[BsonElement("sid")]
public string? Sid { get; set; }
[BsonElement("name")]
public string? Name { get; set; }
[BsonElement("domain")]
public string? Domain { get; set; }
[BsonElement("fullname")]
public string? FullName { get; set; }
[BsonElement("description")]
public string? Description { get; set; }
[BsonElement("status")]
public string? Status { get; set; }
[BsonElement("localaccount")]
public bool? LocalAccount { get; set; }
[BsonElement("disabled")]
public bool? Disabled { get; set; }
[BsonElement("lockout")]
public bool? Lockout { get; set; }
[BsonElement("password_changeable")]
public bool? PasswordChangeable { get; set; }
[BsonElement("password_expires")]
public bool? PasswordExpires { get; set; }
[BsonElement("password_required")]
public bool? PasswordRequired { get; set; }
}

View file

@ -0,0 +1,36 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostSysUserSysGroupEntity> HostSystemUserSystemGroup(this IMongoDatabase database) => database.GetCollection<HostSysUserSysGroupEntity>("host_sysusr_sysgrp");
}
[BsonIgnoreExtraElements]
public class HostSysUserSysGroupEntity
{
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
public string? Id { get; set; }
[BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
public string? Host { get; set; }
[BsonElement("_user"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("user")]
public string? User { get; set; }
[BsonElement("_group"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("group")]
public string? Group { get; set; }
[BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
public string? Batch { get; set; }
[BsonElement("insert")]
public DateTime? Insert { get; set; }
[BsonElement("update")]
public DateTime? Update { get; set; }
}

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostSystemEntity> HostSystem(this IMongoDatabase database) => database.GetCollection<HostSystemEntity>("host_sys");
}
[BsonIgnoreExtraElements]
public class HostSystemEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostUpdateEntity> HostUpdate(this IMongoDatabase database) => database.GetCollection<HostUpdateEntity>("host_upd");
}
[BsonIgnoreExtraElements]
public class HostUpdateEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostVideocardEntity> HostVideocard(this IMongoDatabase database) => database.GetCollection<HostVideocardEntity>("host_gpu");
}
[BsonIgnoreExtraElements]
public class HostVideocardEntity
{

View file

@ -1,9 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostVolumeEntity> HostVolume(this IMongoDatabase database) => database.GetCollection<HostVolumeEntity>("host_vol");
}
[BsonIgnoreExtraElements]
public class HostVolumeEntity
{

View file

@ -0,0 +1,31 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostGroupEntity> HostGroup(this IMongoDatabase database) => database.GetCollection<HostGroupEntity>("hostgroup");
}
[BsonIgnoreExtraElements]
public class HostGroupEntity
{
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
public string? Id { get; set; }
[BsonElement("name"), Required]
public string? Name { get; set; }
[BsonElement("description")]
public string? Description { get; set; }
[BsonElement("insert")]
public DateTime? Insert { get; set; }
[BsonElement("update")]
public DateTime? Update { get; set; }
}

View file

@ -0,0 +1,30 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<HostGroupHostEntity> HostGroupHost(this IMongoDatabase database) => database.GetCollection<HostGroupHostEntity>("hostgroup_host");
}
[BsonIgnoreExtraElements]
public class HostGroupHostEntity
{
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
public string? Id { get; set; }
[BsonElement("_hostgroup"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("hostgroup")]
public string? HostGroup { get; set; }
[BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
public string? Host { get; set; }
[BsonElement("insert")]
public DateTime? Insert { get; set; }
[BsonElement("update")]
public DateTime? Update { get; set; }
}

View file

@ -1,119 +0,0 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
[BsonIgnoreExtraElements]
public class HostUserEntity
{
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
public string? Id { get; set; }
[BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
public string? Host { get; set; }
[BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
public string? Batch { get; set; }
[BsonElement("insert")]
public DateTime? Insert { get; set; }
[BsonElement("update")]
public DateTime? Update { get; set; }
[BsonElement("sid")]
public string? Sid { get; set; }
[BsonElement("name")]
public string? Name { get; set; }
[BsonElement("domain")]
public string? Domain { get; set; }
[BsonElement("fullname")]
public string? FullName { get; set; }
[BsonElement("description")]
public string? Description { get; set; }
[BsonElement("status")]
public string? Status { get; set; }
[BsonElement("localaccount")]
public bool? LocalAccount { get; set; }
[BsonElement("disabled")]
public bool? Disabled { get; set; }
[BsonElement("lockout")]
public bool? Lockout { get; set; }
[BsonElement("password_changeable")]
public bool? PasswordChangeable { get; set; }
[BsonElement("password_expires")]
public bool? PasswordExpires { get; set; }
[BsonElement("password_required")]
public bool? PasswordRequired { get; set; }
}
[BsonIgnoreExtraElements]
public class HostGroupEntity
{
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
public string? Id { get; set; }
[BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
public string? Host { get; set; }
[BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
public string? Batch { get; set; }
[BsonElement("insert")]
public DateTime? Insert { get; set; }
[BsonElement("update")]
public DateTime? Update { get; set; }
[BsonElement("sid")]
public string? Sid { get; set; }
[BsonElement("name")]
public string? Name { get; set; }
[BsonElement("domain")]
public string? Domain { get; set; }
[BsonElement("description")]
public string? Description { get; set; }
[BsonElement("localaccount")]
public bool? LocalAccount { get; set; }
}
[BsonIgnoreExtraElements]
public class HostUserGroupEntity
{
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
public string? Id { get; set; }
[BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
public string? Host { get; set; }
[BsonElement("_user"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("user")]
public string? User { get; set; }
[BsonElement("_group"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("group")]
public string? Group { get; set; }
[BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
public string? Batch { get; set; }
[BsonElement("insert")]
public DateTime? Insert { get; set; }
[BsonElement("update")]
public DateTime? Update { get; set; }
}

View file

@ -1,11 +1,20 @@
using AspNetCore.Identity.MongoDbCore.Models;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using MongoDbGenericRepository.Attributes;
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities;
public static partial class MongoDatabaseExtensions
{
public static IMongoCollection<InsightUser> User(this IMongoDatabase database) => database.GetCollection<InsightUser>("user");
public static IMongoCollection<InsightUserLogEntity> UserLog(this IMongoDatabase database) => database.GetCollection<InsightUserLogEntity>("user_log");
public static IMongoCollection<InsightUserPreferences> UserPreference(this IMongoDatabase database) => database.GetCollection<InsightUserPreferences>("user_pref");
public static IMongoCollection<InsightRole> Role(this IMongoDatabase database) => database.GetCollection<InsightRole>("role");
}
[CollectionName("user"), BsonIgnoreExtraElements]
public class InsightUser : MongoIdentityUser<ObjectId>
{

View file

@ -1,56 +0,0 @@
using Insight.Infrastructure.Entities;
using MongoDB.Driver;
namespace Insight.Infrastructure;
public static class MongoDatabaseExtensions
{
// internal users (roles), groups...
public static IMongoCollection<InsightUser> User(this IMongoDatabase database) => database.GetCollection<InsightUser>("user");
public static IMongoCollection<InsightUserLogEntity> UserLog(this IMongoDatabase database) => database.GetCollection<InsightUserLogEntity>("user_log");
public static IMongoCollection<InsightUserPreferences> UserPreference(this IMongoDatabase database) => database.GetCollection<InsightUserPreferences>("user_pref");
public static IMongoCollection<InsightRole> Role(this IMongoDatabase database) => database.GetCollection<InsightRole>("role");
// customers
public static IMongoCollection<CustomerEntity> Customer(this IMongoDatabase database) => database.GetCollection<CustomerEntity>("customer");
// agents
public static IMongoCollection<AgentEntity> Agent(this IMongoDatabase database) => database.GetCollection<AgentEntity>("agent");
public static IMongoCollection<AgentLogEntity> AgentLog(this IMongoDatabase database) => database.GetCollection<AgentLogEntity>("agent_log");
// host groups
public static IMongoCollection<HostEntity> HostGroup(this IMongoDatabase database) => database.GetCollection<HostEntity>("host");
// hosts
public static IMongoCollection<HostEntity> Host(this IMongoDatabase database) => database.GetCollection<HostEntity>("host");
public static IMongoCollection<HostLogEntity> HostLog(this IMongoDatabase database) => database.GetCollection<HostLogEntity>("host_log");
// hosts extensions
public static IMongoCollection<HostLogMonitoringEntity> HostLogMonitoring(this IMongoDatabase database) => database.GetCollection<HostLogMonitoringEntity>("host_log_mon");
public static IMongoCollection<HostApplicationEntity> HostApplication(this IMongoDatabase database) => database.GetCollection<HostApplicationEntity>("host_app");
public static IMongoCollection<HostDriveEntity> HostDrive(this IMongoDatabase database) => database.GetCollection<HostDriveEntity>("host_drv");
public static IMongoCollection<HostVolumeEntity> HostVolume(this IMongoDatabase database) => database.GetCollection<HostVolumeEntity>("host_vol");
public static IMongoCollection<HostOsEntity> HostOs(this IMongoDatabase database) => database.GetCollection<HostOsEntity>("host_os");
public static IMongoCollection<HostUpdateEntity> HostUpdate(this IMongoDatabase database) => database.GetCollection<HostUpdateEntity>("host_upd");
public static IMongoCollection<HostSessionEntity> HostSession(this IMongoDatabase database) => database.GetCollection<HostSessionEntity>("host_session");
public static IMongoCollection<HostServiceEntity> HostService(this IMongoDatabase database) => database.GetCollection<HostServiceEntity>("host_svc");
public static IMongoCollection<HostPrinterEntity> HostPrinter(this IMongoDatabase database) => database.GetCollection<HostPrinterEntity>("host_prn");
public static IMongoCollection<HostMainboardEntity> HostMainboard(this IMongoDatabase database) => database.GetCollection<HostMainboardEntity>("host_board");
public static IMongoCollection<HostProcessorEntity> HostProcessor(this IMongoDatabase database) => database.GetCollection<HostProcessorEntity>("host_cpu");
public static IMongoCollection<HostMemoryEntity> HostMemory(this IMongoDatabase database) => database.GetCollection<HostMemoryEntity>("host_mem");
public static IMongoCollection<HostVideocardEntity> HostVideocard(this IMongoDatabase database) => database.GetCollection<HostVideocardEntity>("host_gpu");
public static IMongoCollection<HostUserEntity> HostSystemUser(this IMongoDatabase database) => database.GetCollection<HostUserEntity>("host_sysusr");
public static IMongoCollection<HostGroupEntity> HostSystemGroup(this IMongoDatabase database) => database.GetCollection<HostGroupEntity>("host_sysgrp");
public static IMongoCollection<HostUserGroupEntity> HostSystemUserSystemGroup(this IMongoDatabase database) => database.GetCollection<HostUserGroupEntity>("host_sysusr_sysgrp");
public static IMongoCollection<HostSystemEntity> HostSystem(this IMongoDatabase database) => database.GetCollection<HostSystemEntity>("host_sys");
public static IMongoCollection<HostStoragePoolEntity> HostStoragePool(this IMongoDatabase database) => database.GetCollection<HostStoragePoolEntity>("host_sp");
public static IMongoCollection<HostStoragePoolPhysicalDiskEntity> HostStoragePoolPhysicalDisk(this IMongoDatabase database) => database.GetCollection<HostStoragePoolPhysicalDiskEntity>("host_sp.pd");
public static IMongoCollection<HostStoragePoolVirtualDiskEntity> HostStoragePoolVirtualDisk(this IMongoDatabase database) => database.GetCollection<HostStoragePoolVirtualDiskEntity>("host_sp.vd");
public static IMongoCollection<HostHypervisorVirtualMaschineEntity> HostHypervisorVirtualMaschine(this IMongoDatabase database) => database.GetCollection<HostHypervisorVirtualMaschineEntity>("host_hv_vm");
public static IMongoCollection<HostHypervisorVirtualMaschineConfigEntity> HostVirtualMaschineConfig(this IMongoDatabase database) => database.GetCollection<HostHypervisorVirtualMaschineConfigEntity>("host_hv_vm_cfg");
public static IMongoCollection<HostInterfaceEntity> HostInterface(this IMongoDatabase database) => database.GetCollection<HostInterfaceEntity>("host_if");
public static IMongoCollection<HostInterfaceAddressEntity> HostInterfaceAddress(this IMongoDatabase database) => database.GetCollection<HostInterfaceAddressEntity>("host_if_addr");
public static IMongoCollection<HostInterfaceGatewayEntity> HostInterfaceGateway(this IMongoDatabase database) => database.GetCollection<HostInterfaceGatewayEntity>("host_if_gw");
public static IMongoCollection<HostInterfaceNameserverEntity> HostInterfaceNameserver(this IMongoDatabase database) => database.GetCollection<HostInterfaceNameserverEntity>("host_if_ns");
public static IMongoCollection<HostInterfaceRouteEntity> HostInterfaceRoute(this IMongoDatabase database) => database.GetCollection<HostInterfaceRouteEntity>("host_if_rt");
}

View file

@ -4,7 +4,7 @@
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>Insight.Infrastructure</RootNamespace>
<Product>Insight</Product>
<AssemblyVersion>2023.9.21.1</AssemblyVersion>
<AssemblyVersion>2023.11.17.0</AssemblyVersion>
<ImplicitUsings>true</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
@ -18,10 +18,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.11" />
<PackageReference Include="MongoDB.Driver" Version="2.21.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.13" />
<PackageReference Include="MongoDB.Driver" Version="2.22.0" />
<PackageReference Include="AspNetCore.Identity.MongoDbCore" Version="3.1.2" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
</ItemGroup>
<ItemGroup>