Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
using paradigm_ehb.CommandCenter.Core.Interfaces;
using paradigm_ehb.CommandCenter.Core.Models;
using paradigm_ehb.CommandCenter.Core.Services;
using Resources.V1;
using Services.V2;
using Resources.V2;
using Services.V3;

namespace paradigm_ehb.CommandCenter.Core.Factories
{
Expand Down
4 changes: 2 additions & 2 deletions src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System;
using paradigm_ehb.CommandCenter.Core.Services;
using Journal.V1;
using Services.V2;
using Resources.V1;
using Services.V3;
using Resources.V2;

namespace paradigm_ehb.CommandCenter.Core.Models
{
Expand All @@ -16,19 +16,19 @@
/// <summary>
/// Gets or sets the network endpoint information for the agent connection.
/// </summary>
public AgentEndpoint Endpoint { get; set; }

Check warning on line 19 in src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Endpoint' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public GrpcChannel Channel { get; init; }

Check warning on line 21 in src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Channel' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public Health.HealthClient Health { get; init; }

Check warning on line 23 in src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Health' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public Greeter.GreeterClient Greeter { get; init; }

Check warning on line 25 in src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Greeter' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public JournalService.JournalServiceClient Journal { get; init; }

Check warning on line 27 in src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Journal' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public HandlerService.HandlerServiceClient Service { get; init; }

Check warning on line 29 in src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Service' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public ResourcesService.ResourcesServiceClient Resources { get; init; }

Check warning on line 31 in src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Resources' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public bool HealthWatchEnabled { get; set; } = true;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
syntax = "proto3";

package resources.v2;


service ResourcesService {
rpc GetSystemResources(GetSystemResourcesRequest)
returns (GetSystemResourcesResponse);
rpc ProcessAction(ProcessActionRequest)
returns (ProcessActionReply);
}

message GetSystemResourcesRequest {}

message GetSystemResourcesResponse {
SystemResources resources = 1;
}

/**
*
* Get a complete system snapshots
* @return Cpu, Memory, Device, Disk ( partitions ) and processes
*
* */
message SystemResources {
Cpu cpu = 1;
Memory memory = 2;
Device device = 3;
repeated Disk disks = 4;
repeated Process processes = 5;
}

/**
* Cpu information
*
* @return vendor, model, frequency, cores
* */
message Cpu {
string vendor = 1;
string model = 2;
string frequency = 3;
uint32 max_core = 4;
uint64 total_time = 5;
uint64 idle_time = 6;
}

/**
* Memory
* @return total memory on system, available memory on system
* */
message Memory {
string total = 1;
string free = 2;
}

/**
* Device specific information
* @return os version ( distro information ), and uptime in string format
*
* */

message Device {
string os_version = 1;
string uptime = 2;
}

/**
*
* Disk information
* @disk a list of all available partitions
*
* */

message Disk {
repeated DiskPartition partitions = 1;
}

/**
* Partition
* @return partition name, major, minor, blocks
* */
message DiskPartition {
string name = 1;
uint32 major = 2;
uint32 minor = 3;
uint64 blocks = 4;
}

enum ProcessState {
PROCESS_STATE_UNSPECIFIED = 0;
PROCESS_STATE_RUNNING = 1;
PROCESS_STATE_SLEEPING = 2;
PROCESS_STATE_DISK_SLEEPING = 3;
PROCESS_STATE_STOPPED = 4;
PROCESS_STATE_TRACING_STOPPED = 5;
PROCESS_STATE_ZOMBIE = 6;
PROCESS_STATE_DEAD = 7;
PROCESS_STATE_IDLE = 8;
PROCESS_STATE_UNDEFINED = 9;
}

/**
* Process information
* @return pid ( process identifier ), process name, the state, todo :)
* */
message Process {
int32 pid = 1;
string name = 2;
ProcessState state = 3;
uint64 utime = 4;
uint32 num_threads = 5;
}

message ProcessActionRequest {
int32 pid = 1;
int32 signal = 2;
}

message ProcessActionReply {
bool succes = 1;
}
122 changes: 122 additions & 0 deletions src/paradigm-ehb.CommandCenter.Core/Protos/Services/V3/services.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
syntax = "proto3";

package services.v3;


service HandlerService {
rpc PerformUnitAction (UnitActionRequest) returns (UnitActionReply);
rpc PerformUnitFileAction (UnitFileActionRequest) returns (UnitFileActionReply);
rpc GetAllUnits (GetUnitsRequest) returns (GetUnitsReply);
rpc GetLoadedUnits (GetUnitsRequest) returns (GetUnitsReply);
rpc GetFilteredUnits (GetUnitsFilteredRequest) returns (GetUnitsReply);
rpc GetUnitStatus (GetUnitStatusRequest) returns (GetUnitStatusReply);
}


message UnitActionRequest {
string unit_name = 1;

enum UnitAction {
UNIT_ACTION_UNSPECIFIED = 0;
UNIT_ACTION_START = 1;
UNIT_ACTION_STOP = 2;
UNIT_ACTION_RESTART = 3;
}

UnitAction action = 2;
bool force = 3;
}

message UnitActionReply {
bytes status = 1;
bool success = 2;
string error_message = 3;
}


message UnitFileActionRequest {
string unit_name = 1;

enum UnitFileAction {
UNIT_FILE_ACTION_UNSPECIFIED = 0;
UNIT_FILE_ACTION_ENABLE = 1;
UNIT_FILE_ACTION_DISABLE = 2;
}

UnitFileAction action = 2;
bool runtime = 3;
bool force = 4;
}

message UnitFileActionReply {
bytes status = 1;
bool success = 2;
string error_message = 3;
}


message LoadedUnit {
string name = 1;
string description = 2;
string load_state = 3;
string sub_state = 4;
string active_state = 5;
string dep_unit = 6;

string object_path = 7;

uint32 queued_job = 8;
string job_type = 9;
string job_path = 10;
}

message Unit {
string name = 1;
string state = 2;
}


message GetUnitsRequest {

enum UnitState {
UNIT_STATE_UNSPECIFIED = 0;
ENABLED = 1;
DISABLED = 2;
}

string name = 1;
UnitState state = 2;
}

message GetUnitsFilteredRequest {

enum UnitFileState {

UNIT_FILE_STATE_UNSPECIFIED = 0;
LOADED = 1;
NOT_FOUND = 2;
BAD_SETTING = 3;
ERROR = 4;
MASKED = 5;
}

repeated UnitFileState filters = 1;

}

message GetUnitsReply {
repeated LoadedUnit units = 1;
bool success = 2;
string error_message = 3;
}


message GetUnitStatusRequest {
string unit_name = 1;
}

message GetUnitStatusReply {
string state = 1;
bool success = 2;
string error_message = 3;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
<Protobuf Include="Protos\Health\V1\health.proto" GrpcServices="Client" />
<Protobuf Include="Protos\Journal\V1\journal.proto" GrpcServices="Client" />
<Protobuf Include="Protos\Resources\V1\resources.proto" GrpcServices="Client" />
<Protobuf Include="Protos\Resources\V2\resources.proto" GrpcServices="Client" />
<Protobuf Include="Protos\Services\V1\services.proto" GrpcServices="Client" />
<Protobuf Include="Protos\Services\V2\services.proto" GrpcServices="Client" />
<Protobuf Include="Protos\Services\V3\services.proto" GrpcServices="Client" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
</StackPanel>
</Grid>

<SelectorBar SelectionChanged="SelectorBar_SelectionChanged" Margin="-10, -8" x:Name="SelectorBar">
<SelectorBar SelectionChanged="SelectorBar_SelectionChanged" Margin="-10, -8, 0, -24" x:Name="SelectorBar">
<SelectorBarItem x:Name="SelectorBarItemOverview"
Text="Overview" Icon="Clock">
</SelectorBarItem>
<SelectorBarItem x:Name="SelectorBarItemServices"
Text="Services" Icon="AllApps"/>
<SelectorBarItem x:Name="SelectorBarItemProcesses"
Text="Processes" Icon="Favorite"/>
Text="Processes" Icon="ViewAll"/>
</SelectorBar>
</StackPanel>

Expand Down
Loading
Loading