diff --git a/proto/headscale/v1/headscale.proto b/proto/headscale/v1/headscale.proto index 4464cf2f..747c76dc 100644 --- a/proto/headscale/v1/headscale.proto +++ b/proto/headscale/v1/headscale.proto @@ -4,7 +4,7 @@ option go_package = "github.com/juanfont/headscale/gen/go/v1"; import "google/api/annotations.proto"; -import "headscale/v1/namespace.proto"; +import "headscale/v1/user.proto"; import "headscale/v1/preauthkey.proto"; import "headscale/v1/machine.proto"; import "headscale/v1/routes.proto"; @@ -12,165 +12,164 @@ import "headscale/v1/apikey.proto"; // import "headscale/v1/device.proto"; service HeadscaleService { - // --- Namespace start --- - rpc GetNamespace(GetNamespaceRequest) returns (GetNamespaceResponse) { - option (google.api.http) = { - get: "/api/v1/namespace/{name}" + // --- User start --- + rpc GetUser(GetUserRequest) returns(GetUserResponse) { + option(google.api.http) = { + get : "/api/v1/user/{name}" }; } - rpc CreateNamespace(CreateNamespaceRequest) returns (CreateNamespaceResponse) { - option (google.api.http) = { - post: "/api/v1/namespace" - body: "*" + rpc CreateUser(CreateUserRequest) returns(CreateUserResponse) { + option(google.api.http) = { + post : "/api/v1/user" + body : "*" }; } - rpc RenameNamespace(RenameNamespaceRequest) returns (RenameNamespaceResponse) { - option (google.api.http) = { - post: "/api/v1/namespace/{old_name}/rename/{new_name}" + rpc RenameUser(RenameUserRequest) returns(RenameUserResponse) { + option(google.api.http) = { + post : "/api/v1/user/{old_name}/rename/{new_name}" }; } - rpc DeleteNamespace(DeleteNamespaceRequest) returns (DeleteNamespaceResponse) { - option (google.api.http) = { - delete: "/api/v1/namespace/{name}" + rpc DeleteUser(DeleteUserRequest) returns(DeleteUserResponse) { + option(google.api.http) = { + delete : "/api/v1/user/{name}" }; } - rpc ListNamespaces(ListNamespacesRequest) returns (ListNamespacesResponse) { - option (google.api.http) = { - get: "/api/v1/namespace" + rpc ListUsers(ListUsersRequest) returns(ListUsersResponse) { + option(google.api.http) = { + get : "/api/v1/user" }; } - // --- Namespace end --- + // --- User end --- // --- PreAuthKeys start --- - rpc CreatePreAuthKey(CreatePreAuthKeyRequest) returns (CreatePreAuthKeyResponse) { - option (google.api.http) = { - post: "/api/v1/preauthkey" - body: "*" + 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 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" + 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 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 GetMachine(GetMachineRequest) returns(GetMachineResponse) { + option(google.api.http) = { + get : "/api/v1/machine/{machine_id}" }; } - rpc SetTags(SetTagsRequest) returns (SetTagsResponse) { - option (google.api.http) = { - post: "/api/v1/machine/{machine_id}/tags" - body: "*" + rpc SetTags(SetTagsRequest) returns(SetTagsResponse) { + option(google.api.http) = { + post : "/api/v1/machine/{machine_id}/tags" + body : "*" }; } - rpc RegisterMachine(RegisterMachineRequest) returns (RegisterMachineResponse) { - option (google.api.http) = { - post: "/api/v1/machine/register" + 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 DeleteMachine(DeleteMachineRequest) returns(DeleteMachineResponse) { + option(google.api.http) = { + delete : "/api/v1/machine/{machine_id}" }; } - rpc ExpireMachine(ExpireMachineRequest) returns (ExpireMachineResponse) { - option (google.api.http) = { - post: "/api/v1/machine/{machine_id}/expire" + rpc ExpireMachine(ExpireMachineRequest) returns(ExpireMachineResponse) { + option(google.api.http) = { + post : "/api/v1/machine/{machine_id}/expire" }; } - rpc RenameMachine(RenameMachineRequest) returns (RenameMachineResponse) { - option (google.api.http) = { - post: "/api/v1/machine/{machine_id}/rename/{new_name}" + rpc RenameMachine(RenameMachineRequest) returns(RenameMachineResponse) { + option(google.api.http) = { + post : "/api/v1/machine/{machine_id}/rename/{new_name}" }; } - rpc ListMachines(ListMachinesRequest) returns (ListMachinesResponse) { - option (google.api.http) = { - get: "/api/v1/machine" + rpc ListMachines(ListMachinesRequest) returns(ListMachinesResponse) { + option(google.api.http) = { + get : "/api/v1/machine" }; } - rpc MoveMachine(MoveMachineRequest) returns (MoveMachineResponse) { - option (google.api.http) = { - post: "/api/v1/machine/{machine_id}/namespace" + rpc MoveMachine(MoveMachineRequest) returns(MoveMachineResponse) { + option(google.api.http) = { + post : "/api/v1/machine/{machine_id}/user" }; } // --- Machine end --- // --- Route start --- - rpc GetRoutes(GetRoutesRequest) returns (GetRoutesResponse) { - option (google.api.http) = { - get: "/api/v1/routes" + rpc GetRoutes(GetRoutesRequest) returns(GetRoutesResponse) { + option(google.api.http) = { + get : "/api/v1/routes" }; } - rpc EnableRoute(EnableRouteRequest) returns (EnableRouteResponse) { - option (google.api.http) = { - post: "/api/v1/routes/{route_id}/enable" + 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" + rpc DisableRoute(DisableRouteRequest) returns(DisableRouteResponse) { + option(google.api.http) = { + post : "/api/v1/routes/{route_id}/disable" }; } - - rpc GetMachineRoutes(GetMachineRoutesRequest) returns (GetMachineRoutesResponse) { - option (google.api.http) = { - get: "/api/v1/machine/{machine_id}/routes" + rpc GetMachineRoutes(GetMachineRoutesRequest) returns(GetMachineRoutesResponse) { + option(google.api.http) = { + get : "/api/v1/machine/{machine_id}/routes" }; } // --- Route end --- // --- ApiKeys start --- - rpc CreateApiKey(CreateApiKeyRequest) returns (CreateApiKeyResponse) { - option (google.api.http) = { - post: "/api/v1/apikey" - body: "*" + 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 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" + rpc ListApiKeys(ListApiKeysRequest) returns(ListApiKeysResponse) { + option(google.api.http) = { + get : "/api/v1/apikey" }; } // --- ApiKeys end --- diff --git a/proto/headscale/v1/machine.proto b/proto/headscale/v1/machine.proto index 45778482..e3e6e530 100644 --- a/proto/headscale/v1/machine.proto +++ b/proto/headscale/v1/machine.proto @@ -3,7 +3,7 @@ package headscale.v1; option go_package = "github.com/juanfont/headscale/gen/go/v1"; import "google/protobuf/timestamp.proto"; -import "headscale/v1/namespace.proto"; +import "headscale/v1/user.proto"; import "headscale/v1/preauthkey.proto"; enum RegisterMethod { @@ -20,7 +20,7 @@ message Machine { string disco_key = 4; repeated string ip_addresses = 5; string name = 6; - Namespace namespace = 7; + User user = 7; google.protobuf.Timestamp last_seen = 8; google.protobuf.Timestamp last_successful_update = 9; @@ -48,7 +48,7 @@ message Machine { } message RegisterMachineRequest { - string namespace = 1; + string user = 1; string key = 2; } @@ -98,7 +98,7 @@ message RenameMachineResponse { } message ListMachinesRequest { - string namespace = 1; + string user = 1; } message ListMachinesResponse { @@ -107,7 +107,7 @@ message ListMachinesResponse { message MoveMachineRequest { uint64 machine_id = 1; - string namespace = 2; + string user = 2; } message MoveMachineResponse { @@ -115,7 +115,7 @@ message MoveMachineResponse { } message DebugCreateMachineRequest { - string namespace = 1; + string user = 1; string key = 2; string name = 3; repeated string routes = 4; diff --git a/proto/headscale/v1/namespace.proto b/proto/headscale/v1/namespace.proto deleted file mode 100644 index 997b74c3..00000000 --- a/proto/headscale/v1/namespace.proto +++ /dev/null @@ -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; -} diff --git a/proto/headscale/v1/preauthkey.proto b/proto/headscale/v1/preauthkey.proto index decd2a36..7d0de294 100644 --- a/proto/headscale/v1/preauthkey.proto +++ b/proto/headscale/v1/preauthkey.proto @@ -5,7 +5,7 @@ option go_package = "github.com/juanfont/headscale/gen/go/v1"; import "google/protobuf/timestamp.proto"; message PreAuthKey { - string namespace = 1; + string user = 1; string id = 2; string key = 3; bool reusable = 4; @@ -17,7 +17,7 @@ message PreAuthKey { } message CreatePreAuthKeyRequest { - string namespace = 1; + string user = 1; bool reusable = 2; bool ephemeral = 3; google.protobuf.Timestamp expiration = 4; @@ -29,7 +29,7 @@ message CreatePreAuthKeyResponse { } message ExpirePreAuthKeyRequest { - string namespace = 1; + string user = 1; string key = 2; } @@ -37,7 +37,7 @@ message ExpirePreAuthKeyResponse { } message ListPreAuthKeysRequest { - string namespace = 1; + string user = 1; } message ListPreAuthKeysResponse { diff --git a/proto/headscale/v1/user.proto b/proto/headscale/v1/user.proto new file mode 100644 index 00000000..4bc3c886 --- /dev/null +++ b/proto/headscale/v1/user.proto @@ -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; +}