1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-10-17 20:05:55 +02:00
juanfont.headscale/proto/headscale/v1/headscale.proto
Kristoffer Dalby a6aa6a4f7b Add proto rpc interface for cli
This commit adds proto rpc definitions for the communication needed for
the CLI interface.
This will allow us to move the rest of the CLI interface over to gRPC
and in the future allow remote access
2021-11-04 22:02:10 +00:00

153 lines
4.5 KiB
Protocol Buffer

syntax = "proto3";
package headscale.v1;
option go_package = "github.com/juanfont/headscale/gen/go/v1";
import "google/api/annotations.proto";
import "headscale/v1/namespace.proto";
import "headscale/v1/preauthkey.proto";
import "headscale/v1/machine.proto";
import "headscale/v1/routes.proto";
// import "headscale/v1/device.proto";
service HeadscaleService {
// --- Namespace start ---
rpc GetNamespace(GetNamespaceRequest) returns(GetNamespaceResponse) {
option(google.api.http) = {
get : "/api/v1/namespace/{name}"
};
}
rpc CreateNamespace(CreateNamespaceRequest) returns(CreateNamespaceResponse) {
option(google.api.http) = {
post : "/api/v1/namespace"
body : "*"
};
}
rpc RenameNamespace(RenameNamespaceRequest) returns(RenameNamespaceResponse) {
option(google.api.http) = {
post : "/api/v1/namespace/{old_name}/rename/{new_name}"
};
}
rpc DeleteNamespace(DeleteNamespaceRequest) returns(DeleteNamespaceResponse) {
option(google.api.http) = {
delete : "/api/v1/namespace/{name}"
};
}
rpc ListNamespaces(ListNamespacesRequest) returns(ListNamespacesResponse) {
option(google.api.http) = {
get : "/api/v1/namespace"
};
}
// --- Namespace end ---
// --- PreAuthKeys start ---
rpc CreatePreAuthKey(CreatePreAuthKeyRequest) returns(CreatePreAuthKeyResponse) {
option(google.api.http) = {
post : "/api/v1/preauthkey"
body : "*"
};
}
rpc ExpirePreAuthKey(ExpirePreAuthKeyRequest) returns(ExpirePreAuthKeyResponse) {
option(google.api.http) = {
post : "/api/v1/preauthkey/expire"
body : "*"
};
}
rpc ListPreAuthKeys(ListPreAuthKeysRequest) returns(ListPreAuthKeysResponse) {
option(google.api.http) = {
get : "/api/v1/preauthkey"
};
}
// --- PreAuthKeys end ---
// --- Machine start ---
rpc DebugCreateMachine(DebugCreateMachineRequest) returns(DebugCreateMachineResponse) {
option(google.api.http) = {
post : "/api/v1/debug/machine"
body : "*"
};
}
rpc GetMachine(GetMachineRequest) returns(GetMachineResponse) {
option(google.api.http) = {
get : "/api/v1/machine/{machine_id}"
};
}
rpc RegisterMachine(RegisterMachineRequest) returns(RegisterMachineResponse) {
option(google.api.http) = {
post : "/api/v1/machine/register"
};
}
rpc DeleteMachine(DeleteMachineRequest) returns(DeleteMachineResponse) {
option(google.api.http) = {
delete : "/api/v1/machine/{machine_id}"
};
}
rpc ListMachines(ListMachinesRequest) returns(ListMachinesResponse) {
option(google.api.http) = {
get : "/api/v1/machine"
};
}
rpc ShareMachine(ShareMachineRequest) returns(ShareMachineResponse) {
option(google.api.http) = {
post : "/api/v1/machine/{machine_id}/share/{namespace}"
};
}
rpc UnshareMachine(UnshareMachineRequest) returns(UnshareMachineResponse) {
option(google.api.http) = {
post : "/api/v1/machine/{machine_id}/unshare/{namespace}"
};
}
// --- Machine end ---
// --- Route start ---
rpc GetMachineRoute(GetMachineRouteRequest) returns(GetMachineRouteResponse) {
option(google.api.http) = {
get : "/api/v1/machine/{machine_id}/routes"
};
}
rpc EnableMachineRoutes(EnableMachineRoutesRequest) returns(EnableMachineRoutesResponse) {
option(google.api.http) = {
post : "/api/v1/machine/{machine_id}/routes"
};
}
// --- Route end ---
// Implement Tailscale API
// rpc GetDevice(GetDeviceRequest) returns(GetDeviceResponse) {
// option(google.api.http) = {
// get : "/api/v1/device/{id}"
// };
// }
// rpc DeleteDevice(DeleteDeviceRequest) returns(DeleteDeviceResponse) {
// option(google.api.http) = {
// delete : "/api/v1/device/{id}"
// };
// }
// rpc GetDeviceRoutes(GetDeviceRoutesRequest) returns(GetDeviceRoutesResponse) {
// option(google.api.http) = {
// get : "/api/v1/device/{id}/routes"
// };
// }
// rpc EnableDeviceRoutes(EnableDeviceRoutesRequest) returns(EnableDeviceRoutesResponse) {
// option(google.api.http) = {
// post : "/api/v1/device/{id}/routes"
// };
// }
}