1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-11-10 01:20:58 +01:00

update user api to use IDs over names

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2024-12-05 09:51:08 +01:00
parent 4967d87408
commit 273483a310
No known key found for this signature in database
2 changed files with 210 additions and 225 deletions

View File

@ -14,12 +14,6 @@ import "headscale/v1/policy.proto";
service HeadscaleService {
// --- User start ---
rpc GetUser(GetUserRequest) returns (GetUserResponse) {
option (google.api.http) = {
get: "/api/v1/user/{name}"
};
}
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) {
option (google.api.http) = {
post : "/api/v1/user"
@ -29,13 +23,13 @@ service HeadscaleService {
rpc RenameUser(RenameUserRequest) returns (RenameUserResponse) {
option (google.api.http) = {
post: "/api/v1/user/{old_name}/rename/{new_name}"
post : "/api/v1/user/{old_id}/rename/{new_name}"
};
}
rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse) {
option (google.api.http) = {
delete: "/api/v1/user/{name}"
delete : "/api/v1/user/{id}"
};
}
@ -47,21 +41,24 @@ service HeadscaleService {
// --- User end ---
// --- PreAuthKeys start ---
rpc CreatePreAuthKey(CreatePreAuthKeyRequest) returns (CreatePreAuthKeyResponse) {
rpc CreatePreAuthKey(CreatePreAuthKeyRequest)
returns (CreatePreAuthKeyResponse) {
option (google.api.http) = {
post : "/api/v1/preauthkey"
body : "*"
};
}
rpc ExpirePreAuthKey(ExpirePreAuthKeyRequest) returns (ExpirePreAuthKeyResponse) {
rpc ExpirePreAuthKey(ExpirePreAuthKeyRequest)
returns (ExpirePreAuthKeyResponse) {
option (google.api.http) = {
post : "/api/v1/preauthkey/expire"
body : "*"
};
}
rpc ListPreAuthKeys(ListPreAuthKeysRequest) returns (ListPreAuthKeysResponse) {
rpc ListPreAuthKeys(ListPreAuthKeysRequest)
returns (ListPreAuthKeysResponse) {
option (google.api.http) = {
get : "/api/v1/preauthkey"
};
@ -69,7 +66,8 @@ service HeadscaleService {
// --- PreAuthKeys end ---
// --- Node start ---
rpc DebugCreateNode(DebugCreateNodeRequest) returns (DebugCreateNodeResponse) {
rpc DebugCreateNode(DebugCreateNodeRequest)
returns (DebugCreateNodeResponse) {
option (google.api.http) = {
post : "/api/v1/debug/node"
body : "*"
@ -126,7 +124,8 @@ service HeadscaleService {
};
}
rpc BackfillNodeIPs(BackfillNodeIPsRequest) returns (BackfillNodeIPsResponse) {
rpc BackfillNodeIPs(BackfillNodeIPsRequest)
returns (BackfillNodeIPsResponse) {
option (google.api.http) = {
post : "/api/v1/node/backfillips"
};
@ -223,13 +222,15 @@ service HeadscaleService {
// };
// }
// rpc GetDeviceRoutes(GetDeviceRoutesRequest) returns(GetDeviceRoutesResponse) {
// rpc GetDeviceRoutes(GetDeviceRoutesRequest)
// returns(GetDeviceRoutesResponse) {
// option(google.api.http) = {
// get : "/api/v1/device/{id}/routes"
// };
// }
// rpc EnableDeviceRoutes(EnableDeviceRoutesRequest) returns(EnableDeviceRoutesResponse) {
// rpc EnableDeviceRoutes(EnableDeviceRoutesRequest)
// returns(EnableDeviceRoutesResponse) {
// option(google.api.http) = {
// post : "/api/v1/device/{id}/routes"
// };

View File

@ -5,7 +5,7 @@ option go_package = "github.com/juanfont/headscale/gen/go/v1";
import "google/protobuf/timestamp.proto";
message User {
string id = 1;
uint64 id = 1;
string name = 2;
google.protobuf.Timestamp created_at = 3;
string display_name = 4;
@ -15,41 +15,25 @@ message User {
string profile_pic_url = 8;
}
message GetUserRequest {
string name = 1;
}
message CreateUserRequest { string name = 1; }
message GetUserResponse {
User user = 1;
}
message CreateUserRequest {
string name = 1;
}
message CreateUserResponse {
User user = 1;
}
message CreateUserResponse { User user = 1; }
message RenameUserRequest {
string old_name = 1;
uint64 old_id = 1;
string new_name = 2;
}
message RenameUserResponse {
User user = 1;
}
message RenameUserResponse { User user = 1; }
message DeleteUserRequest {
string name = 1;
}
message DeleteUserRequest { uint64 id = 1; }
message DeleteUserResponse {
}
message DeleteUserResponse {}
message ListUsersRequest {
uint64 id = 1;
string name = 2;
string email = 3;
}
message ListUsersResponse {
repeated User users = 1;
}
message ListUsersResponse { repeated User users = 1; }