talos/api/os/api.proto
Andrew Rynhard 9ffa064a70 feat: return a struct for processes RPC
This makes working with the API much cleaner as a client. Using gob
doesn't give the client a well-known type to work with in the API
definition.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2019-09-20 16:18:05 -07:00

109 lines
2.7 KiB
Protocol Buffer

syntax = "proto3";
package proto;
option go_package = "osapi";
option java_multiple_files = true;
option java_outer_classname = "OsApi";
option java_package = "com.os.api";
import "google/protobuf/empty.proto";
// The OS service definition.
//
// OS Service also implements all the API of Init Service
service OS {
rpc Dmesg(google.protobuf.Empty) returns (Data);
rpc Kubeconfig(google.protobuf.Empty) returns (Data);
rpc Logs(LogsRequest) returns (stream Data);
rpc Containers(ContainersRequest) returns (ContainersReply);
rpc Restart(RestartRequest) returns (RestartReply);
rpc Stats(StatsRequest) returns (StatsReply);
rpc Processes(google.protobuf.Empty) returns (ProcessesReply);
}
enum ContainerDriver {
CONTAINERD = 0;
CRI = 1;
}
// The request message containing the containerd namespace.
message ContainersRequest {
string namespace = 1;
// driver might be default "containerd" or "cri"
ContainerDriver driver = 2;
}
// The response message containing the requested containers.
message ContainersReply { repeated Container containers = 1; }
// The response message containing the requested containers.
message Container {
string namespace = 1;
string id = 2;
string image = 3;
uint32 pid = 4;
string status = 5;
string pod_id = 6;
string name = 7;
}
// The request message containing the containerd namespace.
message StatsRequest {
string namespace = 1;
// driver might be default "containerd" or "cri"
ContainerDriver driver = 2;
}
// The response message containing the requested stats.
message StatsReply { repeated Stat stats = 1; }
// The response message containing the requested stat.
message Stat {
string namespace = 1;
string id = 2;
uint64 memory_usage = 4;
uint64 cpu_usage = 5;
string pod_id = 6;
string name = 7;
}
// The request message containing the process to restart.
message RestartRequest {
string namespace = 1;
string id = 2;
// driver might be default "containerd" or "cri"
ContainerDriver driver = 3;
}
// The response message containing the restart status.
message RestartReply {}
// The request message containing the process name.
message LogsRequest {
string namespace = 1;
string id = 2;
// driver might be default "containerd" or "cri"
ContainerDriver driver = 3;
}
// The response message containing the requested logs.
message Data { bytes bytes = 1; }
message ProcessesRequest {}
message ProcessesReply { repeated Process processes = 1; }
message Process {
int32 pid = 1;
int32 ppid = 2;
string state = 3;
int32 threads = 4;
double cpu_time = 5;
uint64 virtual_memory = 6;
uint64 resident_memory = 7;
string command = 8;
string executable = 9;
string args = 10;
}