dotfiles/proto/agent.proto
Nikos Papadakis 5c64f02579 Feature: Agent Tasks (#8)
Reviewed-on: https://git.nikos.gg/prymn/prymn/pulls/8
Co-authored-by: Nikos Papadakis <nikos@papadakis.xyz>
Co-committed-by: Nikos Papadakis <nikos@papadakis.xyz>
2023-11-14 15:23:50 +00:00

76 lines
1.5 KiB
Protocol Buffer

syntax = "proto3";
import "google/protobuf/empty.proto";
package prymn;
message SystemHealth {
// Comma-separated statuses
string status = 1;
}
message TaskHealth {
string started_on = 1;
float progress = 2;
}
message HealthResponse {
string version = 1;
SystemHealth system = 2;
map<string, TaskHealth> tasks = 3;
}
message SysInfoResponse {
message Cpu {
uint64 freq_mhz = 1;
float usage = 2;
}
message Disk {
string name = 1;
uint64 total_bytes = 2;
uint64 avail_bytes = 3;
string mount_point = 4;
}
uint64 uptime = 1;
string hostname = 2;
string os = 3;
uint64 mem_total_bytes = 4;
uint64 mem_avail_bytes = 5;
uint64 swap_total_bytes = 6;
uint64 swap_free_bytes = 7;
repeated Cpu cpus = 8;
repeated Disk disks = 9;
uint32 updates_available = 10;
}
message ExecRequest {
string program = 1;
repeated string args = 2;
}
message ExecResponse {
oneof out {
string stdout = 1;
string stderr = 2;
string error = 3;
int32 exit_code = 4;
}
}
message SysUpdateRequest {
bool dry_run = 1;
}
message SysUpdateResponse {
string output = 1;
int32 progress = 2;
}
service Agent {
rpc Health(google.protobuf.Empty) returns (stream HealthResponse);
rpc Exec(ExecRequest) returns (stream ExecResponse);
rpc GetSysInfo(google.protobuf.Empty) returns (SysInfoResponse);
rpc SysUpdate(SysUpdateRequest) returns (stream SysUpdateResponse);
}