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 "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,38 +12,38 @@ import "headscale/v1/apikey.proto";
// import "headscale/v1/device.proto";
service HeadscaleService {
// --- Namespace start ---
rpc GetNamespace(GetNamespaceRequest) returns (GetNamespaceResponse) {
// --- User start ---
rpc GetUser(GetUserRequest) returns(GetUserResponse) {
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) = {
post: "/api/v1/namespace"
post : "/api/v1/user"
body : "*"
};
}
rpc RenameNamespace(RenameNamespaceRequest) returns (RenameNamespaceResponse) {
rpc RenameUser(RenameUserRequest) returns(RenameUserResponse) {
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) = {
delete: "/api/v1/namespace/{name}"
delete : "/api/v1/user/{name}"
};
}
rpc ListNamespaces(ListNamespacesRequest) returns (ListNamespacesResponse) {
rpc ListUsers(ListUsersRequest) returns(ListUsersResponse) {
option(google.api.http) = {
get: "/api/v1/namespace"
get : "/api/v1/user"
};
}
// --- Namespace end ---
// --- User end ---
// --- PreAuthKeys start ---
rpc CreatePreAuthKey(CreatePreAuthKeyRequest) returns(CreatePreAuthKeyResponse) {
@ -120,7 +120,7 @@ service HeadscaleService {
rpc MoveMachine(MoveMachineRequest) returns(MoveMachineResponse) {
option(google.api.http) = {
post: "/api/v1/machine/{machine_id}/namespace"
post : "/api/v1/machine/{machine_id}/user"
};
}
// --- Machine end ---
@ -144,7 +144,6 @@ service HeadscaleService {
};
}
rpc GetMachineRoutes(GetMachineRoutesRequest) returns(GetMachineRoutesResponse) {
option(google.api.http) = {
get : "/api/v1/machine/{machine_id}/routes"

View File

@ -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;

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";
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 {

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;
}