2021-10-30 16:29:41 +02:00
|
|
|
syntax = "proto3";
|
|
|
|
package headscale.v1;
|
|
|
|
option go_package = "github.com/juanfont/headscale/gen/go/v1";
|
|
|
|
|
|
|
|
import "google/api/annotations.proto";
|
|
|
|
|
2021-11-04 23:02:10 +01:00
|
|
|
import "headscale/v1/namespace.proto";
|
|
|
|
import "headscale/v1/preauthkey.proto";
|
|
|
|
import "headscale/v1/machine.proto";
|
|
|
|
import "headscale/v1/routes.proto";
|
2022-01-25 23:11:15 +01:00
|
|
|
import "headscale/v1/apikey.proto";
|
2021-11-04 23:02:10 +01:00
|
|
|
// import "headscale/v1/device.proto";
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-04 23:02:10 +01:00
|
|
|
service HeadscaleService {
|
|
|
|
// --- Namespace start ---
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc GetNamespace(GetNamespaceRequest) returns (GetNamespaceResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/api/v1/namespace/{name}"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc CreateNamespace(CreateNamespaceRequest) returns (CreateNamespaceResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/namespace"
|
|
|
|
body: "*"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc RenameNamespace(RenameNamespaceRequest) returns (RenameNamespaceResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/namespace/{old_name}/rename/{new_name}"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc DeleteNamespace(DeleteNamespaceRequest) returns (DeleteNamespaceResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
delete: "/api/v1/namespace/{name}"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc ListNamespaces(ListNamespacesRequest) returns (ListNamespacesResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/api/v1/namespace"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
// --- Namespace end ---
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-04 23:02:10 +01:00
|
|
|
// --- PreAuthKeys start ---
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc CreatePreAuthKey(CreatePreAuthKeyRequest) returns (CreatePreAuthKeyResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/preauthkey"
|
|
|
|
body: "*"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc ExpirePreAuthKey(ExpirePreAuthKeyRequest) returns (ExpirePreAuthKeyResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/preauthkey/expire"
|
|
|
|
body: "*"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc ListPreAuthKeys(ListPreAuthKeysRequest) returns (ListPreAuthKeysResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/api/v1/preauthkey"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
// --- PreAuthKeys end ---
|
|
|
|
|
|
|
|
// --- Machine start ---
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc DebugCreateMachine(DebugCreateMachineRequest) returns (DebugCreateMachineResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/debug/machine"
|
|
|
|
body: "*"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc GetMachine(GetMachineRequest) returns (GetMachineResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/api/v1/machine/{machine_id}"
|
2021-10-30 16:29:41 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-04-25 20:45:07 +02:00
|
|
|
rpc SetTags(SetTagsRequest) returns (SetTagsResponse) {
|
2022-04-15 13:11:41 +02:00
|
|
|
option (google.api.http) = {
|
2022-04-25 20:45:07 +02:00
|
|
|
post: "/api/v1/machine/{machine_id}/tags"
|
2022-04-15 13:11:41 +02:00
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc RegisterMachine(RegisterMachineRequest) returns (RegisterMachineResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/machine/register"
|
2021-10-30 16:29:41 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc DeleteMachine(DeleteMachineRequest) returns (DeleteMachineResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
delete: "/api/v1/machine/{machine_id}"
|
2021-10-30 16:29:41 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-21 14:40:04 +01:00
|
|
|
rpc ExpireMachine(ExpireMachineRequest) returns (ExpireMachineResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/machine/{machine_id}/expire"
|
|
|
|
};
|
|
|
|
}
|
2022-03-13 22:03:20 +01:00
|
|
|
|
|
|
|
rpc RenameMachine(RenameMachineRequest) returns (RenameMachineResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/machine/{machine_id}/rename/{new_name}"
|
|
|
|
};
|
|
|
|
}
|
2021-11-21 14:40:04 +01:00
|
|
|
|
2021-11-13 09:36:56 +01:00
|
|
|
rpc ListMachines(ListMachinesRequest) returns (ListMachinesResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/api/v1/machine"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2022-05-01 15:34:40 +02:00
|
|
|
|
|
|
|
rpc MoveMachine(MoveMachineRequest) returns (MoveMachineResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/machine/{machine_id}/namespace"
|
|
|
|
};
|
|
|
|
}
|
2021-11-04 23:02:10 +01:00
|
|
|
// --- Machine end ---
|
|
|
|
|
|
|
|
// --- Route start ---
|
2022-11-25 18:50:12 +01:00
|
|
|
rpc GetRoutes(GetRoutesRequest) returns (GetRoutesResponse) {
|
2021-11-13 09:36:56 +01:00
|
|
|
option (google.api.http) = {
|
2022-11-25 18:50:12 +01:00
|
|
|
get: "/api/v1/routes"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc EnableRoute(EnableRouteRequest) returns (EnableRouteResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/routes/{route_id}/enable"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc DisableRoute(DisableRouteRequest) returns (DisableRouteResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/routes/{route_id}/disable"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-11-25 18:50:12 +01:00
|
|
|
|
|
|
|
rpc GetMachineRoutes(GetMachineRoutesRequest) returns (GetMachineRoutesResponse) {
|
2021-11-13 09:36:56 +01:00
|
|
|
option (google.api.http) = {
|
2022-11-25 18:50:12 +01:00
|
|
|
get: "/api/v1/machine/{machine_id}/routes"
|
2021-10-30 16:29:41 +02:00
|
|
|
};
|
|
|
|
}
|
2022-11-25 18:50:12 +01:00
|
|
|
|
2021-11-04 23:02:10 +01:00
|
|
|
// --- Route end ---
|
|
|
|
|
2022-01-25 23:11:15 +01:00
|
|
|
// --- ApiKeys start ---
|
|
|
|
rpc CreateApiKey(CreateApiKeyRequest) returns (CreateApiKeyResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/apikey"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc ExpireApiKey(ExpireApiKeyRequest) returns (ExpireApiKeyResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/apikey/expire"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc ListApiKeys(ListApiKeysRequest) returns (ListApiKeysResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/api/v1/apikey"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// --- ApiKeys end ---
|
|
|
|
|
2021-11-04 23:02:10 +01:00
|
|
|
// 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"
|
|
|
|
// };
|
|
|
|
// }
|
2021-10-30 16:29:41 +02:00
|
|
|
}
|