feat: implements apis for managing headscale policy (#1792)
This commit is contained in:
parent
00ff288f0c
commit
58bd38a609
39 changed files with 1875 additions and 567 deletions
|
@ -9,6 +9,7 @@ import "headscale/v1/preauthkey.proto";
|
|||
import "headscale/v1/node.proto";
|
||||
import "headscale/v1/routes.proto";
|
||||
import "headscale/v1/apikey.proto";
|
||||
import "headscale/v1/policy.proto";
|
||||
// import "headscale/v1/device.proto";
|
||||
|
||||
service HeadscaleService {
|
||||
|
@ -193,6 +194,22 @@ service HeadscaleService {
|
|||
}
|
||||
// --- ApiKeys end ---
|
||||
|
||||
// --- Policy start ---
|
||||
rpc GetPolicy(GetPolicyRequest) returns (GetPolicyResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/policy"
|
||||
};
|
||||
}
|
||||
|
||||
rpc SetPolicy(SetPolicyRequest) returns (SetPolicyResponse) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/policy"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// --- Policy end ---
|
||||
|
||||
|
||||
// Implement Tailscale API
|
||||
// rpc GetDevice(GetDeviceRequest) returns(GetDeviceResponse) {
|
||||
// option(google.api.http) = {
|
||||
|
|
21
proto/headscale/v1/policy.proto
Normal file
21
proto/headscale/v1/policy.proto
Normal file
|
@ -0,0 +1,21 @@
|
|||
syntax = "proto3";
|
||||
package headscale.v1;
|
||||
option go_package = "github.com/juanfont/headscale/gen/go/v1";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
message SetPolicyRequest {
|
||||
string policy = 1;
|
||||
}
|
||||
|
||||
message SetPolicyResponse {
|
||||
string policy = 1;
|
||||
google.protobuf.Timestamp updated_at = 2;
|
||||
}
|
||||
|
||||
message GetPolicyRequest {}
|
||||
|
||||
message GetPolicyResponse {
|
||||
string policy = 1;
|
||||
google.protobuf.Timestamp updated_at = 2;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue