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:
parent
4967d87408
commit
273483a310
@ -14,121 +14,120 @@ 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"
|
||||
body: "*"
|
||||
post : "/api/v1/user"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
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}"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/user"
|
||||
get : "/api/v1/user"
|
||||
};
|
||||
}
|
||||
// --- User end ---
|
||||
|
||||
// --- PreAuthKeys start ---
|
||||
rpc CreatePreAuthKey(CreatePreAuthKeyRequest) returns (CreatePreAuthKeyResponse) {
|
||||
rpc CreatePreAuthKey(CreatePreAuthKeyRequest)
|
||||
returns (CreatePreAuthKeyResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/preauthkey"
|
||||
body: "*"
|
||||
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: "*"
|
||||
post : "/api/v1/preauthkey/expire"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ListPreAuthKeys(ListPreAuthKeysRequest) returns (ListPreAuthKeysResponse) {
|
||||
rpc ListPreAuthKeys(ListPreAuthKeysRequest)
|
||||
returns (ListPreAuthKeysResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/preauthkey"
|
||||
get : "/api/v1/preauthkey"
|
||||
};
|
||||
}
|
||||
// --- PreAuthKeys end ---
|
||||
|
||||
// --- Node start ---
|
||||
rpc DebugCreateNode(DebugCreateNodeRequest) returns (DebugCreateNodeResponse) {
|
||||
rpc DebugCreateNode(DebugCreateNodeRequest)
|
||||
returns (DebugCreateNodeResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/debug/node"
|
||||
body: "*"
|
||||
post : "/api/v1/debug/node"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetNode(GetNodeRequest) returns (GetNodeResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/node/{node_id}"
|
||||
get : "/api/v1/node/{node_id}"
|
||||
};
|
||||
}
|
||||
|
||||
rpc SetTags(SetTagsRequest) returns (SetTagsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/node/{node_id}/tags"
|
||||
body: "*"
|
||||
post : "/api/v1/node/{node_id}/tags"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc RegisterNode(RegisterNodeRequest) returns (RegisterNodeResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/node/register"
|
||||
post : "/api/v1/node/register"
|
||||
};
|
||||
}
|
||||
|
||||
rpc DeleteNode(DeleteNodeRequest) returns (DeleteNodeResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/node/{node_id}"
|
||||
delete : "/api/v1/node/{node_id}"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ExpireNode(ExpireNodeRequest) returns (ExpireNodeResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/node/{node_id}/expire"
|
||||
post : "/api/v1/node/{node_id}/expire"
|
||||
};
|
||||
}
|
||||
|
||||
rpc RenameNode(RenameNodeRequest) returns (RenameNodeResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/node/{node_id}/rename/{new_name}"
|
||||
post : "/api/v1/node/{node_id}/rename/{new_name}"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/node"
|
||||
get : "/api/v1/node"
|
||||
};
|
||||
}
|
||||
|
||||
rpc MoveNode(MoveNodeRequest) returns (MoveNodeResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/node/{node_id}/user",
|
||||
body: "*"
|
||||
post : "/api/v1/node/{node_id}/user",
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc BackfillNodeIPs(BackfillNodeIPsRequest) returns (BackfillNodeIPsResponse) {
|
||||
rpc BackfillNodeIPs(BackfillNodeIPsRequest)
|
||||
returns (BackfillNodeIPsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/node/backfillips"
|
||||
post : "/api/v1/node/backfillips"
|
||||
};
|
||||
}
|
||||
|
||||
@ -137,31 +136,31 @@ service HeadscaleService {
|
||||
// --- Route start ---
|
||||
rpc GetRoutes(GetRoutesRequest) returns (GetRoutesResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/routes"
|
||||
get : "/api/v1/routes"
|
||||
};
|
||||
}
|
||||
|
||||
rpc EnableRoute(EnableRouteRequest) returns (EnableRouteResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/routes/{route_id}/enable"
|
||||
post : "/api/v1/routes/{route_id}/enable"
|
||||
};
|
||||
}
|
||||
|
||||
rpc DisableRoute(DisableRouteRequest) returns (DisableRouteResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/routes/{route_id}/disable"
|
||||
post : "/api/v1/routes/{route_id}/disable"
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetNodeRoutes(GetNodeRoutesRequest) returns (GetNodeRoutesResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/node/{node_id}/routes"
|
||||
get : "/api/v1/node/{node_id}/routes"
|
||||
};
|
||||
}
|
||||
|
||||
rpc DeleteRoute(DeleteRouteRequest) returns (DeleteRouteResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/routes/{route_id}"
|
||||
delete : "/api/v1/routes/{route_id}"
|
||||
};
|
||||
}
|
||||
|
||||
@ -170,27 +169,27 @@ service HeadscaleService {
|
||||
// --- ApiKeys start ---
|
||||
rpc CreateApiKey(CreateApiKeyRequest) returns (CreateApiKeyResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/apikey"
|
||||
body: "*"
|
||||
post : "/api/v1/apikey"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ExpireApiKey(ExpireApiKeyRequest) returns (ExpireApiKeyResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/apikey/expire"
|
||||
body: "*"
|
||||
post : "/api/v1/apikey/expire"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ListApiKeys(ListApiKeysRequest) returns (ListApiKeysResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/apikey"
|
||||
get : "/api/v1/apikey"
|
||||
};
|
||||
}
|
||||
|
||||
rpc DeleteApiKey(DeleteApiKeyRequest) returns (DeleteApiKeyResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/apikey/{prefix}"
|
||||
delete : "/api/v1/apikey/{prefix}"
|
||||
};
|
||||
}
|
||||
// --- ApiKeys end ---
|
||||
@ -198,14 +197,14 @@ service HeadscaleService {
|
||||
// --- Policy start ---
|
||||
rpc GetPolicy(GetPolicyRequest) returns (GetPolicyResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/policy"
|
||||
get : "/api/v1/policy"
|
||||
};
|
||||
}
|
||||
|
||||
rpc SetPolicy(SetPolicyRequest) returns (SetPolicyResponse) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/policy"
|
||||
body: "*"
|
||||
put : "/api/v1/policy"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
// --- Policy end ---
|
||||
@ -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"
|
||||
// };
|
||||
|
||||
@ -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; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user