diff --git a/main.go b/main.go new file mode 100644 index 0000000..0cc0de8 --- /dev/null +++ b/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "github.com/sdslabs/pinger/pkg/protobuf/pb" + "google.golang.org/grpc" + "net" +) + +type server struct { + pb.AlterServicesServer +} + +func main() { + lis, err := net.Listen("tcp", ":5000") + if err != nil { + panic(err); + } + + grpcServer := grpc.NewServer() + pb.RegisterAlterServicesServer(grpcServer, &server{}) + if err := grpcServer.Serve(lis); err != nil { + panic(err) + } + grpcServer.Serve(lis) +} diff --git a/pkg/components/central/central.go b/pkg/components/central/central.go index 38c4c4c..c48d87d 100644 --- a/pkg/components/central/central.go +++ b/pkg/components/central/central.go @@ -6,9 +6,9 @@ import ( "fmt" "time" - "google.golang.org/grpc" - "github.com/go-redis/redis/v8" + "github.com/sdslabs/pinger/pkg/protobuf/pb" + "google.golang.org/grpc" "github.com/sdslabs/pinger/pkg/config" "github.com/sdslabs/pinger/pkg/config/configfile" @@ -17,6 +17,10 @@ import ( agentProto "github.com/sdslabs/pinger/pkg/components/agent/proto" ) +type server struct { + pb.AlterServicesServer +} + func Run(ctx *appcontext.Context) error { fmt.Println("Central server is running!") // run GRPC server and expose API for managing checks @@ -233,3 +237,45 @@ func getAgentWithLowestLoad(ctx *appcontext.Context) (string, error) { return res[0], nil } + +func (s *server) CreateCheckService(ctx context.Context, req *pb.CreateCheckRequest) (*pb.Response, error) { + if req.Check != "" { + return &pb.Response{Response: "gRPC Code 0 : OK "}, nil + } + return nil, errors.New("Fuckoff") +} + +func (s *server) DeleteCheckService(ctx context.Context, req *pb.DeleteCheckRequest) (*pb.Response, error) { + if req.UserId != "" { + return &pb.Response{Response: "gRPC Code 0 : OK "}, nil + } + return nil, errors.New("Fuckoff") +} + +func (s *server) UpdateCheckService(ctx context.Context, req *pb.UpdateCheckRequest) (*pb.Response, error) { + if req.UserId != "" { + return &pb.Response{Response: "gRPC Code 0 : OK "}, nil + } + return nil, errors.New("Fuckoff") +} + +func (s *server) CreatePageService(ctx context.Context, req *pb.CreatePageRequest) (*pb.Response, error) { + if req.NewPageString != "" { + return &pb.Response{Response: "gRPC Code 0 : OK "}, nil + } + return nil, errors.New("Fuckoff") +} + +func (s *server) DeletePageService(ctx context.Context, req *pb.DeletePageRequest) (*pb.Response, error) { + if req.PageId != "" { + return &pb.Response{Response: "gRPC Code 0 : OK "}, nil + } + return nil, errors.New("Fuckoff") +} + +func (s *server) UpdatePageService(ctx context.Context, req *pb.UpdatePageRequest) (*pb.Response, error) { + if req.PageId != "" { + return &pb.Response{Response: "gRPC Code 0 : OK "}, nil + } + return nil, errors.New("Fuckoff") +} diff --git a/pkg/protobuf/alter.proto b/pkg/protobuf/alter.proto new file mode 100644 index 0000000..f93e89f --- /dev/null +++ b/pkg/protobuf/alter.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +package alter; + +option go_package = "/pb"; + +message CreateCheckRequest { + string Check = 1; + string PageId = 2; +} + +message DeleteCheckRequest { + string UserId = 1; + string CheckId = 2; + string Role = 3; +} + +message UpdateCheckRequest { + string CheckId = 1; + string UpdateCheckString = 2; + string UserId = 3; + string Role = 4; +} + +message CreatePageRequest { string NewPageString = 1; } + +message DeletePageRequest { string PageId = 1; } + +message UpdatePageRequest { string PageId = 1; } + +message Response { string Response = 1; } + +service AlterServices { + rpc CreateCheckService(CreateCheckRequest) returns (Response) {} + rpc DeleteCheckService(DeleteCheckRequest) returns (Response) {} + rpc UpdateCheckService(UpdateCheckRequest) returns (Response) {} + rpc CreatePageService(CreatePageRequest) returns (Response) {} + rpc DeletePageService(DeletePageRequest) returns (Response) {} + rpc UpdatePageService(UpdatePageRequest) returns (Response) {} +} diff --git a/pkg/protobuf/pb/checks.pb.go b/pkg/protobuf/pb/checks.pb.go new file mode 100644 index 0000000..c249d7b --- /dev/null +++ b/pkg/protobuf/pb/checks.pb.go @@ -0,0 +1,615 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v4.23.4 +// source: checks.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CreateCheckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Check string `protobuf:"bytes,1,opt,name=Check,proto3" json:"Check,omitempty"` + PageId string `protobuf:"bytes,2,opt,name=PageId,proto3" json:"PageId,omitempty"` +} + +func (x *CreateCheckRequest) Reset() { + *x = CreateCheckRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_checks_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateCheckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateCheckRequest) ProtoMessage() {} + +func (x *CreateCheckRequest) ProtoReflect() protoreflect.Message { + mi := &file_checks_proto_msgTypes[0] + 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 CreateCheckRequest.ProtoReflect.Descriptor instead. +func (*CreateCheckRequest) Descriptor() ([]byte, []int) { + return file_checks_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateCheckRequest) GetCheck() string { + if x != nil { + return x.Check + } + return "" +} + +func (x *CreateCheckRequest) GetPageId() string { + if x != nil { + return x.PageId + } + return "" +} + +type DeleteCheckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId,omitempty"` + CheckId string `protobuf:"bytes,2,opt,name=CheckId,proto3" json:"CheckId,omitempty"` + Role string `protobuf:"bytes,3,opt,name=Role,proto3" json:"Role,omitempty"` +} + +func (x *DeleteCheckRequest) Reset() { + *x = DeleteCheckRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_checks_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteCheckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteCheckRequest) ProtoMessage() {} + +func (x *DeleteCheckRequest) ProtoReflect() protoreflect.Message { + mi := &file_checks_proto_msgTypes[1] + 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 DeleteCheckRequest.ProtoReflect.Descriptor instead. +func (*DeleteCheckRequest) Descriptor() ([]byte, []int) { + return file_checks_proto_rawDescGZIP(), []int{1} +} + +func (x *DeleteCheckRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *DeleteCheckRequest) GetCheckId() string { + if x != nil { + return x.CheckId + } + return "" +} + +func (x *DeleteCheckRequest) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +type UpdateCheckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CheckId string `protobuf:"bytes,1,opt,name=CheckId,proto3" json:"CheckId,omitempty"` + UpdateCheckString string `protobuf:"bytes,2,opt,name=UpdateCheckString,proto3" json:"UpdateCheckString,omitempty"` + UserId string `protobuf:"bytes,3,opt,name=UserId,proto3" json:"UserId,omitempty"` + Role string `protobuf:"bytes,4,opt,name=Role,proto3" json:"Role,omitempty"` +} + +func (x *UpdateCheckRequest) Reset() { + *x = UpdateCheckRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_checks_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateCheckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateCheckRequest) ProtoMessage() {} + +func (x *UpdateCheckRequest) ProtoReflect() protoreflect.Message { + mi := &file_checks_proto_msgTypes[2] + 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 UpdateCheckRequest.ProtoReflect.Descriptor instead. +func (*UpdateCheckRequest) Descriptor() ([]byte, []int) { + return file_checks_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateCheckRequest) GetCheckId() string { + if x != nil { + return x.CheckId + } + return "" +} + +func (x *UpdateCheckRequest) GetUpdateCheckString() string { + if x != nil { + return x.UpdateCheckString + } + return "" +} + +func (x *UpdateCheckRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateCheckRequest) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +type CreatePageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NewPageString string `protobuf:"bytes,1,opt,name=NewPageString,proto3" json:"NewPageString,omitempty"` +} + +func (x *CreatePageRequest) Reset() { + *x = CreatePageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_checks_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreatePageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePageRequest) ProtoMessage() {} + +func (x *CreatePageRequest) ProtoReflect() protoreflect.Message { + mi := &file_checks_proto_msgTypes[3] + 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 CreatePageRequest.ProtoReflect.Descriptor instead. +func (*CreatePageRequest) Descriptor() ([]byte, []int) { + return file_checks_proto_rawDescGZIP(), []int{3} +} + +func (x *CreatePageRequest) GetNewPageString() string { + if x != nil { + return x.NewPageString + } + return "" +} + +type DeletePageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageId string `protobuf:"bytes,1,opt,name=PageId,proto3" json:"PageId,omitempty"` +} + +func (x *DeletePageRequest) Reset() { + *x = DeletePageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_checks_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePageRequest) ProtoMessage() {} + +func (x *DeletePageRequest) ProtoReflect() protoreflect.Message { + mi := &file_checks_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 DeletePageRequest.ProtoReflect.Descriptor instead. +func (*DeletePageRequest) Descriptor() ([]byte, []int) { + return file_checks_proto_rawDescGZIP(), []int{4} +} + +func (x *DeletePageRequest) GetPageId() string { + if x != nil { + return x.PageId + } + return "" +} + +type UpdatePageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageId string `protobuf:"bytes,1,opt,name=PageId,proto3" json:"PageId,omitempty"` +} + +func (x *UpdatePageRequest) Reset() { + *x = UpdatePageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_checks_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePageRequest) ProtoMessage() {} + +func (x *UpdatePageRequest) ProtoReflect() protoreflect.Message { + mi := &file_checks_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 UpdatePageRequest.ProtoReflect.Descriptor instead. +func (*UpdatePageRequest) Descriptor() ([]byte, []int) { + return file_checks_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdatePageRequest) GetPageId() string { + if x != nil { + return x.PageId + } + return "" +} + +type Response struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Response string `protobuf:"bytes,1,opt,name=Response,proto3" json:"Response,omitempty"` +} + +func (x *Response) Reset() { + *x = Response{} + if protoimpl.UnsafeEnabled { + mi := &file_checks_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Response) ProtoMessage() {} + +func (x *Response) ProtoReflect() protoreflect.Message { + mi := &file_checks_proto_msgTypes[6] + 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 Response.ProtoReflect.Descriptor instead. +func (*Response) Descriptor() ([]byte, []int) { + return file_checks_proto_rawDescGZIP(), []int{6} +} + +func (x *Response) GetResponse() string { + if x != nil { + return x.Response + } + return "" +} + +var File_checks_proto protoreflect.FileDescriptor + +var file_checks_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, + 0x61, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x42, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x22, 0x5a, 0x0a, 0x12, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, + 0x22, 0x39, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x4e, 0x65, 0x77, 0x50, 0x61, 0x67, 0x65, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x4e, 0x65, + 0x77, 0x50, 0x61, 0x67, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x2b, 0x0a, 0x11, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x22, 0x2b, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, + 0x06, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x50, + 0x61, 0x67, 0x65, 0x49, 0x64, 0x22, 0x26, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa1, 0x03, + 0x0a, 0x0d, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, + 0x42, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x19, 0x2e, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0f, 0x2e, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x19, 0x2e, 0x61, 0x6c, 0x74, 0x65, + 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x19, 0x2e, + 0x61, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x61, 0x6c, 0x74, 0x65, 0x72, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x11, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x18, 0x2e, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x61, 0x6c, 0x74, + 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, + 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x18, 0x2e, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x61, + 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x40, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, + 0x2e, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x42, 0x05, 0x5a, 0x03, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_checks_proto_rawDescOnce sync.Once + file_checks_proto_rawDescData = file_checks_proto_rawDesc +) + +func file_checks_proto_rawDescGZIP() []byte { + file_checks_proto_rawDescOnce.Do(func() { + file_checks_proto_rawDescData = protoimpl.X.CompressGZIP(file_checks_proto_rawDescData) + }) + return file_checks_proto_rawDescData +} + +var file_checks_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_checks_proto_goTypes = []interface{}{ + (*CreateCheckRequest)(nil), // 0: alter.CreateCheckRequest + (*DeleteCheckRequest)(nil), // 1: alter.DeleteCheckRequest + (*UpdateCheckRequest)(nil), // 2: alter.UpdateCheckRequest + (*CreatePageRequest)(nil), // 3: alter.CreatePageRequest + (*DeletePageRequest)(nil), // 4: alter.DeletePageRequest + (*UpdatePageRequest)(nil), // 5: alter.UpdatePageRequest + (*Response)(nil), // 6: alter.Response +} +var file_checks_proto_depIdxs = []int32{ + 0, // 0: alter.AlterServices.CreateCheckService:input_type -> alter.CreateCheckRequest + 1, // 1: alter.AlterServices.DeleteCheckService:input_type -> alter.DeleteCheckRequest + 2, // 2: alter.AlterServices.UpdateCheckService:input_type -> alter.UpdateCheckRequest + 3, // 3: alter.AlterServices.CreatePageService:input_type -> alter.CreatePageRequest + 4, // 4: alter.AlterServices.DeletePageService:input_type -> alter.DeletePageRequest + 5, // 5: alter.AlterServices.UpdatePageService:input_type -> alter.UpdatePageRequest + 6, // 6: alter.AlterServices.CreateCheckService:output_type -> alter.Response + 6, // 7: alter.AlterServices.DeleteCheckService:output_type -> alter.Response + 6, // 8: alter.AlterServices.UpdateCheckService:output_type -> alter.Response + 6, // 9: alter.AlterServices.CreatePageService:output_type -> alter.Response + 6, // 10: alter.AlterServices.DeletePageService:output_type -> alter.Response + 6, // 11: alter.AlterServices.UpdatePageService:output_type -> alter.Response + 6, // [6:12] is the sub-list for method output_type + 0, // [0:6] 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 +} + +func init() { file_checks_proto_init() } +func file_checks_proto_init() { + if File_checks_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_checks_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateCheckRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_checks_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteCheckRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_checks_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateCheckRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_checks_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_checks_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_checks_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_checks_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Response); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_checks_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_checks_proto_goTypes, + DependencyIndexes: file_checks_proto_depIdxs, + MessageInfos: file_checks_proto_msgTypes, + }.Build() + File_checks_proto = out.File + file_checks_proto_rawDesc = nil + file_checks_proto_goTypes = nil + file_checks_proto_depIdxs = nil +} diff --git a/pkg/protobuf/pb/checks_grpc.pb.go b/pkg/protobuf/pb/checks_grpc.pb.go new file mode 100644 index 0000000..c5b0fb1 --- /dev/null +++ b/pkg/protobuf/pb/checks_grpc.pb.go @@ -0,0 +1,285 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.23.4 +// source: checks.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// AlterServicesClient is the client API for AlterServices service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AlterServicesClient interface { + CreateCheckService(ctx context.Context, in *CreateCheckRequest, opts ...grpc.CallOption) (*Response, error) + DeleteCheckService(ctx context.Context, in *DeleteCheckRequest, opts ...grpc.CallOption) (*Response, error) + UpdateCheckService(ctx context.Context, in *UpdateCheckRequest, opts ...grpc.CallOption) (*Response, error) + CreatePageService(ctx context.Context, in *CreatePageRequest, opts ...grpc.CallOption) (*Response, error) + DeletePageService(ctx context.Context, in *DeletePageRequest, opts ...grpc.CallOption) (*Response, error) + UpdatePageService(ctx context.Context, in *UpdatePageRequest, opts ...grpc.CallOption) (*Response, error) +} + +type alterServicesClient struct { + cc grpc.ClientConnInterface +} + +func NewAlterServicesClient(cc grpc.ClientConnInterface) AlterServicesClient { + return &alterServicesClient{cc} +} + +func (c *alterServicesClient) CreateCheckService(ctx context.Context, in *CreateCheckRequest, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/alter.AlterServices/CreateCheckService", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *alterServicesClient) DeleteCheckService(ctx context.Context, in *DeleteCheckRequest, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/alter.AlterServices/DeleteCheckService", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *alterServicesClient) UpdateCheckService(ctx context.Context, in *UpdateCheckRequest, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/alter.AlterServices/UpdateCheckService", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *alterServicesClient) CreatePageService(ctx context.Context, in *CreatePageRequest, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/alter.AlterServices/CreatePageService", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *alterServicesClient) DeletePageService(ctx context.Context, in *DeletePageRequest, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/alter.AlterServices/DeletePageService", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *alterServicesClient) UpdatePageService(ctx context.Context, in *UpdatePageRequest, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/alter.AlterServices/UpdatePageService", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AlterServicesServer is the server API for AlterServices service. +// All implementations must embed UnimplementedAlterServicesServer +// for forward compatibility +type AlterServicesServer interface { + CreateCheckService(context.Context, *CreateCheckRequest) (*Response, error) + DeleteCheckService(context.Context, *DeleteCheckRequest) (*Response, error) + UpdateCheckService(context.Context, *UpdateCheckRequest) (*Response, error) + CreatePageService(context.Context, *CreatePageRequest) (*Response, error) + DeletePageService(context.Context, *DeletePageRequest) (*Response, error) + UpdatePageService(context.Context, *UpdatePageRequest) (*Response, error) + mustEmbedUnimplementedAlterServicesServer() +} + +// UnimplementedAlterServicesServer must be embedded to have forward compatible implementations. +type UnimplementedAlterServicesServer struct { +} + +func (UnimplementedAlterServicesServer) CreateCheckService(context.Context, *CreateCheckRequest) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateCheckService not implemented") +} +func (UnimplementedAlterServicesServer) DeleteCheckService(context.Context, *DeleteCheckRequest) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteCheckService not implemented") +} +func (UnimplementedAlterServicesServer) UpdateCheckService(context.Context, *UpdateCheckRequest) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCheckService not implemented") +} +func (UnimplementedAlterServicesServer) CreatePageService(context.Context, *CreatePageRequest) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreatePageService not implemented") +} +func (UnimplementedAlterServicesServer) DeletePageService(context.Context, *DeletePageRequest) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePageService not implemented") +} +func (UnimplementedAlterServicesServer) UpdatePageService(context.Context, *UpdatePageRequest) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatePageService not implemented") +} +func (UnimplementedAlterServicesServer) mustEmbedUnimplementedAlterServicesServer() {} + +// UnsafeAlterServicesServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AlterServicesServer will +// result in compilation errors. +type UnsafeAlterServicesServer interface { + mustEmbedUnimplementedAlterServicesServer() +} + +func RegisterAlterServicesServer(s grpc.ServiceRegistrar, srv AlterServicesServer) { + s.RegisterService(&AlterServices_ServiceDesc, srv) +} + +func _AlterServices_CreateCheckService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AlterServicesServer).CreateCheckService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/alter.AlterServices/CreateCheckService", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AlterServicesServer).CreateCheckService(ctx, req.(*CreateCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AlterServices_DeleteCheckService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AlterServicesServer).DeleteCheckService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/alter.AlterServices/DeleteCheckService", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AlterServicesServer).DeleteCheckService(ctx, req.(*DeleteCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AlterServices_UpdateCheckService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AlterServicesServer).UpdateCheckService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/alter.AlterServices/UpdateCheckService", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AlterServicesServer).UpdateCheckService(ctx, req.(*UpdateCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AlterServices_CreatePageService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AlterServicesServer).CreatePageService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/alter.AlterServices/CreatePageService", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AlterServicesServer).CreatePageService(ctx, req.(*CreatePageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AlterServices_DeletePageService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AlterServicesServer).DeletePageService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/alter.AlterServices/DeletePageService", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AlterServicesServer).DeletePageService(ctx, req.(*DeletePageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AlterServices_UpdatePageService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdatePageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AlterServicesServer).UpdatePageService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/alter.AlterServices/UpdatePageService", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AlterServicesServer).UpdatePageService(ctx, req.(*UpdatePageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AlterServices_ServiceDesc is the grpc.ServiceDesc for AlterServices service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AlterServices_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "alter.AlterServices", + HandlerType: (*AlterServicesServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateCheckService", + Handler: _AlterServices_CreateCheckService_Handler, + }, + { + MethodName: "DeleteCheckService", + Handler: _AlterServices_DeleteCheckService_Handler, + }, + { + MethodName: "UpdateCheckService", + Handler: _AlterServices_UpdateCheckService_Handler, + }, + { + MethodName: "CreatePageService", + Handler: _AlterServices_CreatePageService_Handler, + }, + { + MethodName: "DeletePageService", + Handler: _AlterServices_DeletePageService_Handler, + }, + { + MethodName: "UpdatePageService", + Handler: _AlterServices_UpdatePageService_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "checks.proto", +}