1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-12-20 19:09:07 +01:00

Rename namespace in protobuf files

While this truly breaks the point of the backwards compatible stuff with
protobuf, it does not seem worth it to attempt to glue together a
compatible API.

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2023-01-17 17:50:52 +01:00 committed by Juan Font
parent af1ec5a593
commit 428d7c86ce
5 changed files with 142 additions and 143 deletions

View File

@ -4,7 +4,7 @@ option go_package = "github.com/juanfont/headscale/gen/go/v1";
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "headscale/v1/namespace.proto"; import "headscale/v1/user.proto";
import "headscale/v1/preauthkey.proto"; import "headscale/v1/preauthkey.proto";
import "headscale/v1/machine.proto"; import "headscale/v1/machine.proto";
import "headscale/v1/routes.proto"; import "headscale/v1/routes.proto";
@ -12,165 +12,164 @@ import "headscale/v1/apikey.proto";
// import "headscale/v1/device.proto"; // import "headscale/v1/device.proto";
service HeadscaleService { service HeadscaleService {
// --- Namespace start --- // --- User start ---
rpc GetNamespace(GetNamespaceRequest) returns (GetNamespaceResponse) { rpc GetUser(GetUserRequest) returns(GetUserResponse) {
option (google.api.http) = { option(google.api.http) = {
get: "/api/v1/namespace/{name}" get : "/api/v1/user/{name}"
}; };
} }
rpc CreateNamespace(CreateNamespaceRequest) returns (CreateNamespaceResponse) { rpc CreateUser(CreateUserRequest) returns(CreateUserResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/namespace" post : "/api/v1/user"
body: "*" body : "*"
}; };
} }
rpc RenameNamespace(RenameNamespaceRequest) returns (RenameNamespaceResponse) { rpc RenameUser(RenameUserRequest) returns(RenameUserResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/namespace/{old_name}/rename/{new_name}" post : "/api/v1/user/{old_name}/rename/{new_name}"
}; };
} }
rpc DeleteNamespace(DeleteNamespaceRequest) returns (DeleteNamespaceResponse) { rpc DeleteUser(DeleteUserRequest) returns(DeleteUserResponse) {
option (google.api.http) = { option(google.api.http) = {
delete: "/api/v1/namespace/{name}" delete : "/api/v1/user/{name}"
}; };
} }
rpc ListNamespaces(ListNamespacesRequest) returns (ListNamespacesResponse) { rpc ListUsers(ListUsersRequest) returns(ListUsersResponse) {
option (google.api.http) = { option(google.api.http) = {
get: "/api/v1/namespace" get : "/api/v1/user"
}; };
} }
// --- Namespace end --- // --- User end ---
// --- PreAuthKeys start --- // --- PreAuthKeys start ---
rpc CreatePreAuthKey(CreatePreAuthKeyRequest) returns (CreatePreAuthKeyResponse) { rpc CreatePreAuthKey(CreatePreAuthKeyRequest) returns(CreatePreAuthKeyResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/preauthkey" post : "/api/v1/preauthkey"
body: "*" body : "*"
}; };
} }
rpc ExpirePreAuthKey(ExpirePreAuthKeyRequest) returns (ExpirePreAuthKeyResponse) { rpc ExpirePreAuthKey(ExpirePreAuthKeyRequest) returns(ExpirePreAuthKeyResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/preauthkey/expire" post : "/api/v1/preauthkey/expire"
body: "*" body : "*"
}; };
} }
rpc ListPreAuthKeys(ListPreAuthKeysRequest) returns (ListPreAuthKeysResponse) { rpc ListPreAuthKeys(ListPreAuthKeysRequest) returns(ListPreAuthKeysResponse) {
option (google.api.http) = { option(google.api.http) = {
get: "/api/v1/preauthkey" get : "/api/v1/preauthkey"
}; };
} }
// --- PreAuthKeys end --- // --- PreAuthKeys end ---
// --- Machine start --- // --- Machine start ---
rpc DebugCreateMachine(DebugCreateMachineRequest) returns (DebugCreateMachineResponse) { rpc DebugCreateMachine(DebugCreateMachineRequest) returns(DebugCreateMachineResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/debug/machine" post : "/api/v1/debug/machine"
body: "*" body : "*"
}; };
} }
rpc GetMachine(GetMachineRequest) returns (GetMachineResponse) { rpc GetMachine(GetMachineRequest) returns(GetMachineResponse) {
option (google.api.http) = { option(google.api.http) = {
get: "/api/v1/machine/{machine_id}" get : "/api/v1/machine/{machine_id}"
}; };
} }
rpc SetTags(SetTagsRequest) returns (SetTagsResponse) { rpc SetTags(SetTagsRequest) returns(SetTagsResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/machine/{machine_id}/tags" post : "/api/v1/machine/{machine_id}/tags"
body: "*" body : "*"
}; };
} }
rpc RegisterMachine(RegisterMachineRequest) returns (RegisterMachineResponse) { rpc RegisterMachine(RegisterMachineRequest) returns(RegisterMachineResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/machine/register" post : "/api/v1/machine/register"
}; };
} }
rpc DeleteMachine(DeleteMachineRequest) returns (DeleteMachineResponse) { rpc DeleteMachine(DeleteMachineRequest) returns(DeleteMachineResponse) {
option (google.api.http) = { option(google.api.http) = {
delete: "/api/v1/machine/{machine_id}" delete : "/api/v1/machine/{machine_id}"
}; };
} }
rpc ExpireMachine(ExpireMachineRequest) returns (ExpireMachineResponse) { rpc ExpireMachine(ExpireMachineRequest) returns(ExpireMachineResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/machine/{machine_id}/expire" post : "/api/v1/machine/{machine_id}/expire"
}; };
} }
rpc RenameMachine(RenameMachineRequest) returns (RenameMachineResponse) { rpc RenameMachine(RenameMachineRequest) returns(RenameMachineResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/machine/{machine_id}/rename/{new_name}" post : "/api/v1/machine/{machine_id}/rename/{new_name}"
}; };
} }
rpc ListMachines(ListMachinesRequest) returns (ListMachinesResponse) { rpc ListMachines(ListMachinesRequest) returns(ListMachinesResponse) {
option (google.api.http) = { option(google.api.http) = {
get: "/api/v1/machine" get : "/api/v1/machine"
}; };
} }
rpc MoveMachine(MoveMachineRequest) returns (MoveMachineResponse) { rpc MoveMachine(MoveMachineRequest) returns(MoveMachineResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/machine/{machine_id}/namespace" post : "/api/v1/machine/{machine_id}/user"
}; };
} }
// --- Machine end --- // --- Machine end ---
// --- Route start --- // --- Route start ---
rpc GetRoutes(GetRoutesRequest) returns (GetRoutesResponse) { rpc GetRoutes(GetRoutesRequest) returns(GetRoutesResponse) {
option (google.api.http) = { option(google.api.http) = {
get: "/api/v1/routes" get : "/api/v1/routes"
}; };
} }
rpc EnableRoute(EnableRouteRequest) returns (EnableRouteResponse) { rpc EnableRoute(EnableRouteRequest) returns(EnableRouteResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/routes/{route_id}/enable" post : "/api/v1/routes/{route_id}/enable"
}; };
} }
rpc DisableRoute(DisableRouteRequest) returns (DisableRouteResponse) { rpc DisableRoute(DisableRouteRequest) returns(DisableRouteResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/routes/{route_id}/disable" post : "/api/v1/routes/{route_id}/disable"
}; };
} }
rpc GetMachineRoutes(GetMachineRoutesRequest) returns(GetMachineRoutesResponse) {
rpc GetMachineRoutes(GetMachineRoutesRequest) returns (GetMachineRoutesResponse) { option(google.api.http) = {
option (google.api.http) = { get : "/api/v1/machine/{machine_id}/routes"
get: "/api/v1/machine/{machine_id}/routes"
}; };
} }
// --- Route end --- // --- Route end ---
// --- ApiKeys start --- // --- ApiKeys start ---
rpc CreateApiKey(CreateApiKeyRequest) returns (CreateApiKeyResponse) { rpc CreateApiKey(CreateApiKeyRequest) returns(CreateApiKeyResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/apikey" post : "/api/v1/apikey"
body: "*" body : "*"
}; };
} }
rpc ExpireApiKey(ExpireApiKeyRequest) returns (ExpireApiKeyResponse) { rpc ExpireApiKey(ExpireApiKeyRequest) returns(ExpireApiKeyResponse) {
option (google.api.http) = { option(google.api.http) = {
post: "/api/v1/apikey/expire" post : "/api/v1/apikey/expire"
body: "*" body : "*"
}; };
} }
rpc ListApiKeys(ListApiKeysRequest) returns (ListApiKeysResponse) { rpc ListApiKeys(ListApiKeysRequest) returns(ListApiKeysResponse) {
option (google.api.http) = { option(google.api.http) = {
get: "/api/v1/apikey" get : "/api/v1/apikey"
}; };
} }
// --- ApiKeys end --- // --- ApiKeys end ---

View File

@ -3,7 +3,7 @@ package headscale.v1;
option go_package = "github.com/juanfont/headscale/gen/go/v1"; option go_package = "github.com/juanfont/headscale/gen/go/v1";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
import "headscale/v1/namespace.proto"; import "headscale/v1/user.proto";
import "headscale/v1/preauthkey.proto"; import "headscale/v1/preauthkey.proto";
enum RegisterMethod { enum RegisterMethod {
@ -20,7 +20,7 @@ message Machine {
string disco_key = 4; string disco_key = 4;
repeated string ip_addresses = 5; repeated string ip_addresses = 5;
string name = 6; string name = 6;
Namespace namespace = 7; User user = 7;
google.protobuf.Timestamp last_seen = 8; google.protobuf.Timestamp last_seen = 8;
google.protobuf.Timestamp last_successful_update = 9; google.protobuf.Timestamp last_successful_update = 9;
@ -48,7 +48,7 @@ message Machine {
} }
message RegisterMachineRequest { message RegisterMachineRequest {
string namespace = 1; string user = 1;
string key = 2; string key = 2;
} }
@ -98,7 +98,7 @@ message RenameMachineResponse {
} }
message ListMachinesRequest { message ListMachinesRequest {
string namespace = 1; string user = 1;
} }
message ListMachinesResponse { message ListMachinesResponse {
@ -107,7 +107,7 @@ message ListMachinesResponse {
message MoveMachineRequest { message MoveMachineRequest {
uint64 machine_id = 1; uint64 machine_id = 1;
string namespace = 2; string user = 2;
} }
message MoveMachineResponse { message MoveMachineResponse {
@ -115,7 +115,7 @@ message MoveMachineResponse {
} }
message DebugCreateMachineRequest { message DebugCreateMachineRequest {
string namespace = 1; string user = 1;
string key = 2; string key = 2;
string name = 3; string name = 3;
repeated string routes = 4; repeated string routes = 4;

View File

@ -1,50 +0,0 @@
syntax = "proto3";
package headscale.v1;
option go_package = "github.com/juanfont/headscale/gen/go/v1";
import "google/protobuf/timestamp.proto";
message Namespace {
string id = 1;
string name = 2;
google.protobuf.Timestamp created_at = 3;
}
message GetNamespaceRequest {
string name = 1;
}
message GetNamespaceResponse {
Namespace namespace = 1;
}
message CreateNamespaceRequest {
string name = 1;
}
message CreateNamespaceResponse {
Namespace namespace = 1;
}
message RenameNamespaceRequest {
string old_name = 1;
string new_name = 2;
}
message RenameNamespaceResponse {
Namespace namespace = 1;
}
message DeleteNamespaceRequest {
string name = 1;
}
message DeleteNamespaceResponse {
}
message ListNamespacesRequest {
}
message ListNamespacesResponse {
repeated Namespace namespaces = 1;
}

View File

@ -5,7 +5,7 @@ option go_package = "github.com/juanfont/headscale/gen/go/v1";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
message PreAuthKey { message PreAuthKey {
string namespace = 1; string user = 1;
string id = 2; string id = 2;
string key = 3; string key = 3;
bool reusable = 4; bool reusable = 4;
@ -17,7 +17,7 @@ message PreAuthKey {
} }
message CreatePreAuthKeyRequest { message CreatePreAuthKeyRequest {
string namespace = 1; string user = 1;
bool reusable = 2; bool reusable = 2;
bool ephemeral = 3; bool ephemeral = 3;
google.protobuf.Timestamp expiration = 4; google.protobuf.Timestamp expiration = 4;
@ -29,7 +29,7 @@ message CreatePreAuthKeyResponse {
} }
message ExpirePreAuthKeyRequest { message ExpirePreAuthKeyRequest {
string namespace = 1; string user = 1;
string key = 2; string key = 2;
} }
@ -37,7 +37,7 @@ message ExpirePreAuthKeyResponse {
} }
message ListPreAuthKeysRequest { message ListPreAuthKeysRequest {
string namespace = 1; string user = 1;
} }
message ListPreAuthKeysResponse { message ListPreAuthKeysResponse {

View File

@ -0,0 +1,50 @@
syntax = "proto3";
package headscale.v1;
option go_package = "github.com/juanfont/headscale/gen/go/v1";
import "google/protobuf/timestamp.proto";
message User {
string id = 1;
string name = 2;
google.protobuf.Timestamp created_at = 3;
}
message GetUserRequest {
string name = 1;
}
message GetUserResponse {
User user = 1;
}
message CreateUserRequest {
string name = 1;
}
message CreateUserResponse {
User user = 1;
}
message RenameUserRequest {
string old_name = 1;
string new_name = 2;
}
message RenameUserResponse {
User user = 1;
}
message DeleteUserRequest {
string name = 1;
}
message DeleteUserResponse {
}
message ListUsersRequest {
}
message ListUsersResponse {
repeated User users = 1;
}