101 lines
2.4 KiB
Protocol Buffer
101 lines
2.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package homelab.v1;
|
|
|
|
option go_package = "pwa-homelab-mon/gen/homelab/v1;homelabv1";
|
|
|
|
message Item {
|
|
string name = 1;
|
|
string data = 2; // monitor: text | percentage
|
|
string value = 3; // monitor: last output
|
|
int32 args = 4; // exec: arg count
|
|
repeated string arg_types = 5; // exec: text | number per arg
|
|
}
|
|
|
|
message Link {
|
|
string name = 1;
|
|
string url = 2;
|
|
}
|
|
|
|
message ListContentRequest {}
|
|
message ListContentResponse {
|
|
repeated Link links = 1;
|
|
repeated Item monitors = 2;
|
|
repeated Item exec = 3;
|
|
repeated Service services = 4;
|
|
}
|
|
|
|
message DocMeta {
|
|
string name = 1;
|
|
string hash = 2; // sha256 hex of content
|
|
}
|
|
|
|
message ListDocsRequest {}
|
|
message ListDocsResponse {
|
|
repeated DocMeta docs = 1;
|
|
}
|
|
|
|
message GetDocRequest {
|
|
string name = 1;
|
|
}
|
|
message GetDocResponse {
|
|
string content = 1;
|
|
}
|
|
|
|
message SaveDocRequest {
|
|
string name = 1;
|
|
string content = 2;
|
|
}
|
|
message SaveDocResponse {
|
|
string hash = 1;
|
|
}
|
|
|
|
// One card in the Services view: a systemd user unit or a docker compose project.
|
|
enum ServiceKind {
|
|
SYSTEMD = 0;
|
|
DOCKER = 1;
|
|
}
|
|
|
|
message Service {
|
|
ServiceKind kind = 1;
|
|
string name = 2; // unit name without .service / compose project name (or container name if unlabeled)
|
|
string state = 3; // systemd: ActiveState. docker: active | partial | inactive
|
|
string substate = 4; // systemd: SubState. docker: "up/total"
|
|
string load_state = 5; // systemd only: loaded | not-found (= disabled by the user, not an error)
|
|
string unit_file_state = 6; // systemd only: enabled | disabled | static
|
|
repeated string containers = 7; // docker only: containers the card controls
|
|
string error = 8; // probe failure, empty = ok
|
|
}
|
|
|
|
enum ServiceOp {
|
|
START = 0;
|
|
STOP = 1;
|
|
RESTART = 2;
|
|
}
|
|
|
|
message ServiceActionRequest {
|
|
string name = 1;
|
|
ServiceKind kind = 2;
|
|
ServiceOp op = 3;
|
|
}
|
|
message ServiceActionResponse {
|
|
string output = 1;
|
|
}
|
|
|
|
service HomelabService {
|
|
rpc ListContent(ListContentRequest) returns (ListContentResponse);
|
|
rpc ListDocs(ListDocsRequest) returns (ListDocsResponse);
|
|
rpc GetDoc(GetDocRequest) returns (GetDocResponse);
|
|
rpc SaveDoc(SaveDocRequest) returns (SaveDocResponse);
|
|
rpc ServiceAction(ServiceActionRequest) returns (ServiceActionResponse);
|
|
rpc RunScript(RunScriptRequest) returns (RunScriptResponse);
|
|
}
|
|
|
|
message RunScriptRequest {
|
|
string name = 1;
|
|
repeated string args = 2;
|
|
}
|
|
message RunScriptResponse {
|
|
string output = 1;
|
|
}
|