From 58e1f38231db37d206a5f3eac3fa0c0a513ddd51 Mon Sep 17 00:00:00 2001 From: Johan Siebens Date: Tue, 14 Jun 2022 14:41:09 +0200 Subject: [PATCH] fix: type safe acl policy in api --- internal/cmd/acl.go | 37 +-- internal/service/acl.go | 12 +- pkg/gen/ionscale/v1/acl.pb.go | 263 +++++++++++++++--- pkg/gen/ionscale/v1/ionscale.pb.go | 40 +-- .../v1/ionscalev1connect/ionscale.connect.go | 44 +-- proto/ionscale/v1/acl.proto | 19 +- 6 files changed, 297 insertions(+), 118 deletions(-) diff --git a/internal/cmd/acl.go b/internal/cmd/acl.go index 0401690..f389bee 100644 --- a/internal/cmd/acl.go +++ b/internal/cmd/acl.go @@ -5,16 +5,14 @@ import ( "encoding/json" "fmt" "github.com/bufbuild/connect-go" - "github.com/jsiebens/ionscale/internal/domain" api "github.com/jsiebens/ionscale/pkg/gen/ionscale/v1" "github.com/muesli/coral" - "gopkg.in/yaml.v2" "io/ioutil" ) func getACLConfigCommand() *coral.Command { command := &coral.Command{ - Use: "get-acl", + Use: "get-acl-policy", Short: "Get the ACL policy", SilenceUsage: true, } @@ -46,29 +44,12 @@ func getACLConfigCommand() *coral.Command { return err } - var p domain.ACLPolicy - - if err := json.Unmarshal(resp.Msg.Value, &p); err != nil { + marshal, err := json.MarshalIndent(resp.Msg.Policy, "", " ") + if err != nil { return err } - if asJson { - marshal, err := json.MarshalIndent(&p, "", " ") - if err != nil { - return err - } - - fmt.Println() - fmt.Println(string(marshal)) - } else { - marshal, err := yaml.Marshal(&p) - if err != nil { - return err - } - - fmt.Println() - fmt.Println(string(marshal)) - } + fmt.Println(string(marshal)) return nil } @@ -78,7 +59,7 @@ func getACLConfigCommand() *coral.Command { func setACLConfigCommand() *coral.Command { command := &coral.Command{ - Use: "set-acl", + Use: "set-acl-policy", Short: "Set ACL policy", SilenceUsage: true, } @@ -100,6 +81,11 @@ func setACLConfigCommand() *coral.Command { return err } + var policy = &api.ACLPolicy{} + if err := json.Unmarshal(rawJson, policy); err != nil { + return err + } + client, err := target.createGRPCClient() if err != nil { return err @@ -110,12 +96,11 @@ func setACLConfigCommand() *coral.Command { return err } - _, err = client.SetACLPolicy(context.Background(), connect.NewRequest(&api.SetACLPolicyRequest{TailnetId: tailnet.Id, Value: rawJson})) + _, err = client.SetACLPolicy(context.Background(), connect.NewRequest(&api.SetACLPolicyRequest{TailnetId: tailnet.Id, Policy: policy})) if err != nil { return err } - fmt.Println() fmt.Println("ACL policy updated successfully") return nil diff --git a/internal/service/acl.go b/internal/service/acl.go index 690c539..883a69a 100644 --- a/internal/service/acl.go +++ b/internal/service/acl.go @@ -2,11 +2,11 @@ package service import ( "context" - "encoding/json" "errors" "fmt" "github.com/bufbuild/connect-go" "github.com/jsiebens/ionscale/internal/domain" + "github.com/jsiebens/ionscale/internal/mapping" api "github.com/jsiebens/ionscale/pkg/gen/ionscale/v1" ) @@ -24,14 +24,12 @@ func (s *Service) GetACLPolicy(ctx context.Context, req *connect.Request[api.Get return nil, connect.NewError(connect.CodeNotFound, fmt.Errorf("tailnet does not exist")) } - policy := tailnet.ACLPolicy - - marshal, err := json.Marshal(policy) - if err != nil { + var policy api.ACLPolicy + if err := mapping.CopyViaJson(&tailnet.ACLPolicy, &policy); err != nil { return nil, err } - return connect.NewResponse(&api.GetACLPolicyResponse{Value: marshal}), nil + return connect.NewResponse(&api.GetACLPolicyResponse{Policy: &policy}), nil } func (s *Service) SetACLPolicy(ctx context.Context, req *connect.Request[api.SetACLPolicyRequest]) (*connect.Response[api.SetACLPolicyResponse], error) { @@ -49,7 +47,7 @@ func (s *Service) SetACLPolicy(ctx context.Context, req *connect.Request[api.Set } var policy domain.ACLPolicy - if err := json.Unmarshal(req.Msg.Value, &policy); err != nil { + if err := mapping.CopyViaJson(req.Msg.Policy, &policy); err != nil { return nil, err } diff --git a/pkg/gen/ionscale/v1/acl.pb.go b/pkg/gen/ionscale/v1/acl.pb.go index 04d01ba..560c9ac 100644 --- a/pkg/gen/ionscale/v1/acl.pb.go +++ b/pkg/gen/ionscale/v1/acl.pb.go @@ -9,8 +9,7 @@ package ionscalev1 import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/known/durationpb" - _ "google.golang.org/protobuf/types/known/timestamppb" + structpb "google.golang.org/protobuf/types/known/structpb" reflect "reflect" sync "sync" ) @@ -74,7 +73,7 @@ type GetACLPolicyResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Policy *ACLPolicy `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"` } func (x *GetACLPolicyResponse) Reset() { @@ -109,9 +108,9 @@ func (*GetACLPolicyResponse) Descriptor() ([]byte, []int) { return file_ionscale_v1_acl_proto_rawDescGZIP(), []int{1} } -func (x *GetACLPolicyResponse) GetValue() []byte { +func (x *GetACLPolicyResponse) GetPolicy() *ACLPolicy { if x != nil { - return x.Value + return x.Policy } return nil } @@ -121,8 +120,8 @@ type SetACLPolicyRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TailnetId uint64 `protobuf:"varint,1,opt,name=tailnet_id,json=tailnetId,proto3" json:"tailnet_id,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + TailnetId uint64 `protobuf:"varint,1,opt,name=tailnet_id,json=tailnetId,proto3" json:"tailnet_id,omitempty"` + Policy *ACLPolicy `protobuf:"bytes,2,opt,name=policy,proto3" json:"policy,omitempty"` } func (x *SetACLPolicyRequest) Reset() { @@ -164,9 +163,9 @@ func (x *SetACLPolicyRequest) GetTailnetId() uint64 { return 0 } -func (x *SetACLPolicyRequest) GetValue() []byte { +func (x *SetACLPolicyRequest) GetPolicy() *ACLPolicy { if x != nil { - return x.Value + return x.Policy } return nil } @@ -209,34 +208,185 @@ func (*SetACLPolicyResponse) Descriptor() ([]byte, []int) { return file_ionscale_v1_acl_proto_rawDescGZIP(), []int{3} } +type ACLPolicy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hosts map[string]string `protobuf:"bytes,1,rep,name=hosts,proto3" json:"hosts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Groups map[string]*structpb.ListValue `protobuf:"bytes,2,rep,name=groups,proto3" json:"groups,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Acls []*ACL `protobuf:"bytes,3,rep,name=acls,proto3" json:"acls,omitempty"` +} + +func (x *ACLPolicy) Reset() { + *x = ACLPolicy{} + if protoimpl.UnsafeEnabled { + mi := &file_ionscale_v1_acl_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ACLPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ACLPolicy) ProtoMessage() {} + +func (x *ACLPolicy) ProtoReflect() protoreflect.Message { + mi := &file_ionscale_v1_acl_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ACLPolicy.ProtoReflect.Descriptor instead. +func (*ACLPolicy) Descriptor() ([]byte, []int) { + return file_ionscale_v1_acl_proto_rawDescGZIP(), []int{4} +} + +func (x *ACLPolicy) GetHosts() map[string]string { + if x != nil { + return x.Hosts + } + return nil +} + +func (x *ACLPolicy) GetGroups() map[string]*structpb.ListValue { + if x != nil { + return x.Groups + } + return nil +} + +func (x *ACLPolicy) GetAcls() []*ACL { + if x != nil { + return x.Acls + } + return nil +} + +type ACL struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Action string `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"` + Src []string `protobuf:"bytes,2,rep,name=src,proto3" json:"src,omitempty"` + Dst []string `protobuf:"bytes,3,rep,name=dst,proto3" json:"dst,omitempty"` +} + +func (x *ACL) Reset() { + *x = ACL{} + if protoimpl.UnsafeEnabled { + mi := &file_ionscale_v1_acl_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ACL) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ACL) ProtoMessage() {} + +func (x *ACL) ProtoReflect() protoreflect.Message { + mi := &file_ionscale_v1_acl_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ACL.ProtoReflect.Descriptor instead. +func (*ACL) Descriptor() ([]byte, []int) { + return file_ionscale_v1_acl_proto_rawDescGZIP(), []int{5} +} + +func (x *ACL) GetAction() string { + if x != nil { + return x.Action + } + return "" +} + +func (x *ACL) GetSrc() []string { + if x != nil { + return x.Src + } + return nil +} + +func (x *ACL) GetDst() []string { + if x != nil { + return x.Dst + } + return nil +} + var File_ionscale_v1_acl_proto protoreflect.FileDescriptor var file_ionscale_v1_acl_proto_rawDesc = []byte{ 0x0a, 0x15, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, - 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, - 0x76, 0x31, 0x2f, 0x72, 0x65, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x13, - 0x47, 0x65, 0x74, 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x69, 0x6c, 0x6e, 0x65, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x61, 0x69, 0x6c, 0x6e, 0x65, 0x74, - 0x49, 0x64, 0x22, 0x2c, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x4a, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x69, 0x6c, 0x6e, - 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x61, 0x69, - 0x6c, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x16, 0x0a, 0x14, - 0x53, 0x65, 0x74, 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x6a, 0x73, 0x69, 0x65, 0x62, 0x65, 0x6e, 0x73, 0x2f, 0x69, 0x6f, 0x6e, 0x73, - 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x69, 0x6f, 0x6e, - 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, - 0x65, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x15, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, + 0x72, 0x65, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x13, 0x47, 0x65, 0x74, + 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x69, 0x6c, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x61, 0x69, 0x6c, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, + 0x46, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, + 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x64, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x41, 0x43, + 0x4c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x74, 0x61, 0x69, 0x6c, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x09, 0x74, 0x61, 0x69, 0x6c, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x2e, 0x0a, + 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x43, 0x4c, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x16, 0x0a, + 0x14, 0x53, 0x65, 0x74, 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xb7, 0x02, 0x0a, 0x09, 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x12, 0x37, 0x0a, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x41, 0x43, 0x4c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x06, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x69, + 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x43, 0x4c, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x24, 0x0a, 0x04, 0x61, 0x63, 0x6c, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x43, 0x4c, 0x52, 0x04, 0x61, 0x63, 0x6c, 0x73, 0x1a, 0x38, + 0x0a, 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x55, 0x0a, 0x0b, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x41, 0x0a, 0x03, 0x41, 0x43, 0x4c, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, + 0x0a, 0x03, 0x73, 0x72, 0x63, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x73, 0x72, 0x63, + 0x12, 0x10, 0x0a, 0x03, 0x64, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x64, + 0x73, 0x74, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6a, 0x73, 0x69, 0x65, 0x62, 0x65, 0x6e, 0x73, 0x2f, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, + 0x6c, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x69, 0x6f, 0x6e, 0x73, 0x63, + 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x76, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -251,19 +401,30 @@ func file_ionscale_v1_acl_proto_rawDescGZIP() []byte { return file_ionscale_v1_acl_proto_rawDescData } -var file_ionscale_v1_acl_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ionscale_v1_acl_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_ionscale_v1_acl_proto_goTypes = []interface{}{ (*GetACLPolicyRequest)(nil), // 0: ionscale.v1.GetACLPolicyRequest (*GetACLPolicyResponse)(nil), // 1: ionscale.v1.GetACLPolicyResponse (*SetACLPolicyRequest)(nil), // 2: ionscale.v1.SetACLPolicyRequest (*SetACLPolicyResponse)(nil), // 3: ionscale.v1.SetACLPolicyResponse + (*ACLPolicy)(nil), // 4: ionscale.v1.ACLPolicy + (*ACL)(nil), // 5: ionscale.v1.ACL + nil, // 6: ionscale.v1.ACLPolicy.HostsEntry + nil, // 7: ionscale.v1.ACLPolicy.GroupsEntry + (*structpb.ListValue)(nil), // 8: google.protobuf.ListValue } var file_ionscale_v1_acl_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 4, // 0: ionscale.v1.GetACLPolicyResponse.policy:type_name -> ionscale.v1.ACLPolicy + 4, // 1: ionscale.v1.SetACLPolicyRequest.policy:type_name -> ionscale.v1.ACLPolicy + 6, // 2: ionscale.v1.ACLPolicy.hosts:type_name -> ionscale.v1.ACLPolicy.HostsEntry + 7, // 3: ionscale.v1.ACLPolicy.groups:type_name -> ionscale.v1.ACLPolicy.GroupsEntry + 5, // 4: ionscale.v1.ACLPolicy.acls:type_name -> ionscale.v1.ACL + 8, // 5: ionscale.v1.ACLPolicy.GroupsEntry.value:type_name -> google.protobuf.ListValue + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_ionscale_v1_acl_proto_init() } @@ -321,6 +482,30 @@ func file_ionscale_v1_acl_proto_init() { return nil } } + file_ionscale_v1_acl_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ACLPolicy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ionscale_v1_acl_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ACL); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -328,7 +513,7 @@ func file_ionscale_v1_acl_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_ionscale_v1_acl_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/gen/ionscale/v1/ionscale.pb.go b/pkg/gen/ionscale/v1/ionscale.pb.go index e8dc90d..6f889c1 100644 --- a/pkg/gen/ionscale/v1/ionscale.pb.go +++ b/pkg/gen/ionscale/v1/ionscale.pb.go @@ -170,18 +170,18 @@ var file_ionscale_v1_ionscale_proto_rawDesc = []byte{ 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x6a, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4b, - 0x65, 0x79, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x27, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, - 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, - 0x65, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x28, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x70, - 0x69, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, - 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x21, - 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x22, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, + 0x00, 0x12, 0x58, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, + 0x6e, 0x65, 0x12, 0x21, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6a, 0x0a, 0x13, 0x53, + 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x70, 0x69, + 0x72, 0x79, 0x12, 0x27, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4b, 0x65, 0x79, 0x45, 0x78, + 0x70, 0x69, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x69, 0x6f, + 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, + 0x68, 0x69, 0x6e, 0x65, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x24, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, @@ -225,8 +225,8 @@ var file_ionscale_v1_ionscale_proto_goTypes = []interface{}{ (*ListAuthKeysRequest)(nil), // 19: ionscale.v1.ListAuthKeysRequest (*ListMachinesRequest)(nil), // 20: ionscale.v1.ListMachinesRequest (*ExpireMachineRequest)(nil), // 21: ionscale.v1.ExpireMachineRequest - (*SetMachineKeyExpiryRequest)(nil), // 22: ionscale.v1.SetMachineKeyExpiryRequest - (*DeleteMachineRequest)(nil), // 23: ionscale.v1.DeleteMachineRequest + (*DeleteMachineRequest)(nil), // 22: ionscale.v1.DeleteMachineRequest + (*SetMachineKeyExpiryRequest)(nil), // 23: ionscale.v1.SetMachineKeyExpiryRequest (*GetMachineRoutesRequest)(nil), // 24: ionscale.v1.GetMachineRoutesRequest (*SetMachineRoutesRequest)(nil), // 25: ionscale.v1.SetMachineRoutesRequest (*GetVersionResponse)(nil), // 26: ionscale.v1.GetVersionResponse @@ -251,8 +251,8 @@ var file_ionscale_v1_ionscale_proto_goTypes = []interface{}{ (*ListAuthKeysResponse)(nil), // 45: ionscale.v1.ListAuthKeysResponse (*ListMachinesResponse)(nil), // 46: ionscale.v1.ListMachinesResponse (*ExpireMachineResponse)(nil), // 47: ionscale.v1.ExpireMachineResponse - (*SetMachineKeyExpiryResponse)(nil), // 48: ionscale.v1.SetMachineKeyExpiryResponse - (*DeleteMachineResponse)(nil), // 49: ionscale.v1.DeleteMachineResponse + (*DeleteMachineResponse)(nil), // 48: ionscale.v1.DeleteMachineResponse + (*SetMachineKeyExpiryResponse)(nil), // 49: ionscale.v1.SetMachineKeyExpiryResponse (*GetMachineRoutesResponse)(nil), // 50: ionscale.v1.GetMachineRoutesResponse } var file_ionscale_v1_ionscale_proto_depIdxs = []int32{ @@ -278,8 +278,8 @@ var file_ionscale_v1_ionscale_proto_depIdxs = []int32{ 19, // 19: ionscale.v1.IonscaleService.ListAuthKeys:input_type -> ionscale.v1.ListAuthKeysRequest 20, // 20: ionscale.v1.IonscaleService.ListMachines:input_type -> ionscale.v1.ListMachinesRequest 21, // 21: ionscale.v1.IonscaleService.ExpireMachine:input_type -> ionscale.v1.ExpireMachineRequest - 22, // 22: ionscale.v1.IonscaleService.SetMachineKeyExpiry:input_type -> ionscale.v1.SetMachineKeyExpiryRequest - 23, // 23: ionscale.v1.IonscaleService.DeleteMachine:input_type -> ionscale.v1.DeleteMachineRequest + 22, // 22: ionscale.v1.IonscaleService.DeleteMachine:input_type -> ionscale.v1.DeleteMachineRequest + 23, // 23: ionscale.v1.IonscaleService.SetMachineKeyExpiry:input_type -> ionscale.v1.SetMachineKeyExpiryRequest 24, // 24: ionscale.v1.IonscaleService.GetMachineRoutes:input_type -> ionscale.v1.GetMachineRoutesRequest 25, // 25: ionscale.v1.IonscaleService.SetMachineRoutes:input_type -> ionscale.v1.SetMachineRoutesRequest 26, // 26: ionscale.v1.IonscaleService.GetVersion:output_type -> ionscale.v1.GetVersionResponse @@ -304,8 +304,8 @@ var file_ionscale_v1_ionscale_proto_depIdxs = []int32{ 45, // 45: ionscale.v1.IonscaleService.ListAuthKeys:output_type -> ionscale.v1.ListAuthKeysResponse 46, // 46: ionscale.v1.IonscaleService.ListMachines:output_type -> ionscale.v1.ListMachinesResponse 47, // 47: ionscale.v1.IonscaleService.ExpireMachine:output_type -> ionscale.v1.ExpireMachineResponse - 48, // 48: ionscale.v1.IonscaleService.SetMachineKeyExpiry:output_type -> ionscale.v1.SetMachineKeyExpiryResponse - 49, // 49: ionscale.v1.IonscaleService.DeleteMachine:output_type -> ionscale.v1.DeleteMachineResponse + 48, // 48: ionscale.v1.IonscaleService.DeleteMachine:output_type -> ionscale.v1.DeleteMachineResponse + 49, // 49: ionscale.v1.IonscaleService.SetMachineKeyExpiry:output_type -> ionscale.v1.SetMachineKeyExpiryResponse 50, // 50: ionscale.v1.IonscaleService.GetMachineRoutes:output_type -> ionscale.v1.GetMachineRoutesResponse 50, // 51: ionscale.v1.IonscaleService.SetMachineRoutes:output_type -> ionscale.v1.GetMachineRoutesResponse 26, // [26:52] is the sub-list for method output_type diff --git a/pkg/gen/ionscale/v1/ionscalev1connect/ionscale.connect.go b/pkg/gen/ionscale/v1/ionscalev1connect/ionscale.connect.go index c687702..1eb4ab9 100644 --- a/pkg/gen/ionscale/v1/ionscalev1connect/ionscale.connect.go +++ b/pkg/gen/ionscale/v1/ionscalev1connect/ionscale.connect.go @@ -49,8 +49,8 @@ type IonscaleServiceClient interface { ListAuthKeys(context.Context, *connect_go.Request[v1.ListAuthKeysRequest]) (*connect_go.Response[v1.ListAuthKeysResponse], error) ListMachines(context.Context, *connect_go.Request[v1.ListMachinesRequest]) (*connect_go.Response[v1.ListMachinesResponse], error) ExpireMachine(context.Context, *connect_go.Request[v1.ExpireMachineRequest]) (*connect_go.Response[v1.ExpireMachineResponse], error) - SetMachineKeyExpiry(context.Context, *connect_go.Request[v1.SetMachineKeyExpiryRequest]) (*connect_go.Response[v1.SetMachineKeyExpiryResponse], error) DeleteMachine(context.Context, *connect_go.Request[v1.DeleteMachineRequest]) (*connect_go.Response[v1.DeleteMachineResponse], error) + SetMachineKeyExpiry(context.Context, *connect_go.Request[v1.SetMachineKeyExpiryRequest]) (*connect_go.Response[v1.SetMachineKeyExpiryResponse], error) GetMachineRoutes(context.Context, *connect_go.Request[v1.GetMachineRoutesRequest]) (*connect_go.Response[v1.GetMachineRoutesResponse], error) SetMachineRoutes(context.Context, *connect_go.Request[v1.SetMachineRoutesRequest]) (*connect_go.Response[v1.GetMachineRoutesResponse], error) } @@ -175,16 +175,16 @@ func NewIonscaleServiceClient(httpClient connect_go.HTTPClient, baseURL string, baseURL+"/ionscale.v1.IonscaleService/ExpireMachine", opts..., ), - setMachineKeyExpiry: connect_go.NewClient[v1.SetMachineKeyExpiryRequest, v1.SetMachineKeyExpiryResponse]( - httpClient, - baseURL+"/ionscale.v1.IonscaleService/SetMachineKeyExpiry", - opts..., - ), deleteMachine: connect_go.NewClient[v1.DeleteMachineRequest, v1.DeleteMachineResponse]( httpClient, baseURL+"/ionscale.v1.IonscaleService/DeleteMachine", opts..., ), + setMachineKeyExpiry: connect_go.NewClient[v1.SetMachineKeyExpiryRequest, v1.SetMachineKeyExpiryResponse]( + httpClient, + baseURL+"/ionscale.v1.IonscaleService/SetMachineKeyExpiry", + opts..., + ), getMachineRoutes: connect_go.NewClient[v1.GetMachineRoutesRequest, v1.GetMachineRoutesResponse]( httpClient, baseURL+"/ionscale.v1.IonscaleService/GetMachineRoutes", @@ -222,8 +222,8 @@ type ionscaleServiceClient struct { listAuthKeys *connect_go.Client[v1.ListAuthKeysRequest, v1.ListAuthKeysResponse] listMachines *connect_go.Client[v1.ListMachinesRequest, v1.ListMachinesResponse] expireMachine *connect_go.Client[v1.ExpireMachineRequest, v1.ExpireMachineResponse] - setMachineKeyExpiry *connect_go.Client[v1.SetMachineKeyExpiryRequest, v1.SetMachineKeyExpiryResponse] deleteMachine *connect_go.Client[v1.DeleteMachineRequest, v1.DeleteMachineResponse] + setMachineKeyExpiry *connect_go.Client[v1.SetMachineKeyExpiryRequest, v1.SetMachineKeyExpiryResponse] getMachineRoutes *connect_go.Client[v1.GetMachineRoutesRequest, v1.GetMachineRoutesResponse] setMachineRoutes *connect_go.Client[v1.SetMachineRoutesRequest, v1.GetMachineRoutesResponse] } @@ -338,16 +338,16 @@ func (c *ionscaleServiceClient) ExpireMachine(ctx context.Context, req *connect_ return c.expireMachine.CallUnary(ctx, req) } -// SetMachineKeyExpiry calls ionscale.v1.IonscaleService.SetMachineKeyExpiry. -func (c *ionscaleServiceClient) SetMachineKeyExpiry(ctx context.Context, req *connect_go.Request[v1.SetMachineKeyExpiryRequest]) (*connect_go.Response[v1.SetMachineKeyExpiryResponse], error) { - return c.setMachineKeyExpiry.CallUnary(ctx, req) -} - // DeleteMachine calls ionscale.v1.IonscaleService.DeleteMachine. func (c *ionscaleServiceClient) DeleteMachine(ctx context.Context, req *connect_go.Request[v1.DeleteMachineRequest]) (*connect_go.Response[v1.DeleteMachineResponse], error) { return c.deleteMachine.CallUnary(ctx, req) } +// SetMachineKeyExpiry calls ionscale.v1.IonscaleService.SetMachineKeyExpiry. +func (c *ionscaleServiceClient) SetMachineKeyExpiry(ctx context.Context, req *connect_go.Request[v1.SetMachineKeyExpiryRequest]) (*connect_go.Response[v1.SetMachineKeyExpiryResponse], error) { + return c.setMachineKeyExpiry.CallUnary(ctx, req) +} + // GetMachineRoutes calls ionscale.v1.IonscaleService.GetMachineRoutes. func (c *ionscaleServiceClient) GetMachineRoutes(ctx context.Context, req *connect_go.Request[v1.GetMachineRoutesRequest]) (*connect_go.Response[v1.GetMachineRoutesResponse], error) { return c.getMachineRoutes.CallUnary(ctx, req) @@ -382,8 +382,8 @@ type IonscaleServiceHandler interface { ListAuthKeys(context.Context, *connect_go.Request[v1.ListAuthKeysRequest]) (*connect_go.Response[v1.ListAuthKeysResponse], error) ListMachines(context.Context, *connect_go.Request[v1.ListMachinesRequest]) (*connect_go.Response[v1.ListMachinesResponse], error) ExpireMachine(context.Context, *connect_go.Request[v1.ExpireMachineRequest]) (*connect_go.Response[v1.ExpireMachineResponse], error) - SetMachineKeyExpiry(context.Context, *connect_go.Request[v1.SetMachineKeyExpiryRequest]) (*connect_go.Response[v1.SetMachineKeyExpiryResponse], error) DeleteMachine(context.Context, *connect_go.Request[v1.DeleteMachineRequest]) (*connect_go.Response[v1.DeleteMachineResponse], error) + SetMachineKeyExpiry(context.Context, *connect_go.Request[v1.SetMachineKeyExpiryRequest]) (*connect_go.Response[v1.SetMachineKeyExpiryResponse], error) GetMachineRoutes(context.Context, *connect_go.Request[v1.GetMachineRoutesRequest]) (*connect_go.Response[v1.GetMachineRoutesResponse], error) SetMachineRoutes(context.Context, *connect_go.Request[v1.SetMachineRoutesRequest]) (*connect_go.Response[v1.GetMachineRoutesResponse], error) } @@ -505,16 +505,16 @@ func NewIonscaleServiceHandler(svc IonscaleServiceHandler, opts ...connect_go.Ha svc.ExpireMachine, opts..., )) - mux.Handle("/ionscale.v1.IonscaleService/SetMachineKeyExpiry", connect_go.NewUnaryHandler( - "/ionscale.v1.IonscaleService/SetMachineKeyExpiry", - svc.SetMachineKeyExpiry, - opts..., - )) mux.Handle("/ionscale.v1.IonscaleService/DeleteMachine", connect_go.NewUnaryHandler( "/ionscale.v1.IonscaleService/DeleteMachine", svc.DeleteMachine, opts..., )) + mux.Handle("/ionscale.v1.IonscaleService/SetMachineKeyExpiry", connect_go.NewUnaryHandler( + "/ionscale.v1.IonscaleService/SetMachineKeyExpiry", + svc.SetMachineKeyExpiry, + opts..., + )) mux.Handle("/ionscale.v1.IonscaleService/GetMachineRoutes", connect_go.NewUnaryHandler( "/ionscale.v1.IonscaleService/GetMachineRoutes", svc.GetMachineRoutes, @@ -619,14 +619,14 @@ func (UnimplementedIonscaleServiceHandler) ExpireMachine(context.Context, *conne return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("ionscale.v1.IonscaleService.ExpireMachine is not implemented")) } -func (UnimplementedIonscaleServiceHandler) SetMachineKeyExpiry(context.Context, *connect_go.Request[v1.SetMachineKeyExpiryRequest]) (*connect_go.Response[v1.SetMachineKeyExpiryResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("ionscale.v1.IonscaleService.SetMachineKeyExpiry is not implemented")) -} - func (UnimplementedIonscaleServiceHandler) DeleteMachine(context.Context, *connect_go.Request[v1.DeleteMachineRequest]) (*connect_go.Response[v1.DeleteMachineResponse], error) { return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("ionscale.v1.IonscaleService.DeleteMachine is not implemented")) } +func (UnimplementedIonscaleServiceHandler) SetMachineKeyExpiry(context.Context, *connect_go.Request[v1.SetMachineKeyExpiryRequest]) (*connect_go.Response[v1.SetMachineKeyExpiryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("ionscale.v1.IonscaleService.SetMachineKeyExpiry is not implemented")) +} + func (UnimplementedIonscaleServiceHandler) GetMachineRoutes(context.Context, *connect_go.Request[v1.GetMachineRoutesRequest]) (*connect_go.Response[v1.GetMachineRoutesResponse], error) { return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("ionscale.v1.IonscaleService.GetMachineRoutes is not implemented")) } diff --git a/proto/ionscale/v1/acl.proto b/proto/ionscale/v1/acl.proto index ff1b5ee..27ac5f9 100644 --- a/proto/ionscale/v1/acl.proto +++ b/proto/ionscale/v1/acl.proto @@ -3,8 +3,7 @@ syntax = "proto3"; package ionscale.v1; option go_package = "github.com/jsiebens/ionscale/pkg/gen/ionscale/v1;ionscalev1"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/duration.proto"; +import "google/protobuf/struct.proto"; import "ionscale/v1/ref.proto"; @@ -13,13 +12,25 @@ message GetACLPolicyRequest { } message GetACLPolicyResponse { - bytes value = 1; + ACLPolicy policy = 1; } message SetACLPolicyRequest { uint64 tailnet_id = 1; - bytes value = 2; + ACLPolicy policy = 2; } message SetACLPolicyResponse { +} + +message ACLPolicy { + map hosts = 1; + map groups = 2; + repeated ACL acls = 3; +} + +message ACL { + string action = 1; + repeated string src = 2; + repeated string dst = 3; } \ No newline at end of file