From c60a9e93ff7615d0fd4477de53d1aae62fddaf04 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 2 Dec 2024 15:41:01 +0000 Subject: [PATCH] Add ProvisionPluginService service This is used for implementing gRPC-based provision plugins. --- .../provision_plugin/v1alpha1/plugin.pb.go | 497 ++++++++++++++++++ .../v1alpha1/plugin_grpc.pb.go | 205 ++++++++ proto/provision_plugin/v1alpha1/plugin.proto | 42 ++ 3 files changed, 744 insertions(+) create mode 100644 gen/go/proto/provision_plugin/v1alpha1/plugin.pb.go create mode 100644 gen/go/proto/provision_plugin/v1alpha1/plugin_grpc.pb.go create mode 100644 proto/provision_plugin/v1alpha1/plugin.proto diff --git a/gen/go/proto/provision_plugin/v1alpha1/plugin.pb.go b/gen/go/proto/provision_plugin/v1alpha1/plugin.pb.go new file mode 100644 index 0000000..e88e530 --- /dev/null +++ b/gen/go/proto/provision_plugin/v1alpha1/plugin.pb.go @@ -0,0 +1,497 @@ +// Copyright 2024 Cofide Limited. +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.1 +// protoc (unknown) +// source: proto/provision_plugin/v1alpha1/plugin.proto + +package v1alpha1 + +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 ValidateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ValidateRequest) Reset() { + *x = ValidateRequest{} + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValidateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidateRequest) ProtoMessage() {} + +func (x *ValidateRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValidateRequest.ProtoReflect.Descriptor instead. +func (*ValidateRequest) Descriptor() ([]byte, []int) { + return file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescGZIP(), []int{0} +} + +type ValidateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ValidateResponse) Reset() { + *x = ValidateResponse{} + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValidateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidateResponse) ProtoMessage() {} + +func (x *ValidateResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValidateResponse.ProtoReflect.Descriptor instead. +func (*ValidateResponse) Descriptor() ([]byte, []int) { + return file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescGZIP(), []int{1} +} + +type DeployRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DataSource *uint32 `protobuf:"varint,1,opt,name=data_source,json=dataSource,proto3,oneof" json:"data_source,omitempty"` + KubeCfgFile *string `protobuf:"bytes,2,opt,name=kube_cfg_file,json=kubeCfgFile,proto3,oneof" json:"kube_cfg_file,omitempty"` +} + +func (x *DeployRequest) Reset() { + *x = DeployRequest{} + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeployRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeployRequest) ProtoMessage() {} + +func (x *DeployRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeployRequest.ProtoReflect.Descriptor instead. +func (*DeployRequest) Descriptor() ([]byte, []int) { + return file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescGZIP(), []int{2} +} + +func (x *DeployRequest) GetDataSource() uint32 { + if x != nil && x.DataSource != nil { + return *x.DataSource + } + return 0 +} + +func (x *DeployRequest) GetKubeCfgFile() string { + if x != nil && x.KubeCfgFile != nil { + return *x.KubeCfgFile + } + return "" +} + +type DeployResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status *Status `protobuf:"bytes,1,opt,name=status,proto3,oneof" json:"status,omitempty"` +} + +func (x *DeployResponse) Reset() { + *x = DeployResponse{} + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeployResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeployResponse) ProtoMessage() {} + +func (x *DeployResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeployResponse.ProtoReflect.Descriptor instead. +func (*DeployResponse) Descriptor() ([]byte, []int) { + return file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescGZIP(), []int{3} +} + +func (x *DeployResponse) GetStatus() *Status { + if x != nil { + return x.Status + } + return nil +} + +type TearDownRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DataSource *uint32 `protobuf:"varint,1,opt,name=data_source,json=dataSource,proto3,oneof" json:"data_source,omitempty"` +} + +func (x *TearDownRequest) Reset() { + *x = TearDownRequest{} + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TearDownRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TearDownRequest) ProtoMessage() {} + +func (x *TearDownRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TearDownRequest.ProtoReflect.Descriptor instead. +func (*TearDownRequest) Descriptor() ([]byte, []int) { + return file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescGZIP(), []int{4} +} + +func (x *TearDownRequest) GetDataSource() uint32 { + if x != nil && x.DataSource != nil { + return *x.DataSource + } + return 0 +} + +type TearDownResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status *Status `protobuf:"bytes,1,opt,name=status,proto3,oneof" json:"status,omitempty"` +} + +func (x *TearDownResponse) Reset() { + *x = TearDownResponse{} + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TearDownResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TearDownResponse) ProtoMessage() {} + +func (x *TearDownResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TearDownResponse.ProtoReflect.Descriptor instead. +func (*TearDownResponse) Descriptor() ([]byte, []int) { + return file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescGZIP(), []int{5} +} + +func (x *TearDownResponse) GetStatus() *Status { + if x != nil { + return x.Status + } + return nil +} + +type Status struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Stage *string `protobuf:"bytes,1,opt,name=stage,proto3,oneof" json:"stage,omitempty"` + Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"` + Done *bool `protobuf:"varint,3,opt,name=done,proto3,oneof" json:"done,omitempty"` + Error *string `protobuf:"bytes,4,opt,name=error,proto3,oneof" json:"error,omitempty"` +} + +func (x *Status) Reset() { + *x = Status{} + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Status) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status) ProtoMessage() {} + +func (x *Status) ProtoReflect() protoreflect.Message { + mi := &file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Status.ProtoReflect.Descriptor instead. +func (*Status) Descriptor() ([]byte, []int) { + return file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescGZIP(), []int{6} +} + +func (x *Status) GetStage() string { + if x != nil && x.Stage != nil { + return *x.Stage + } + return "" +} + +func (x *Status) GetMessage() string { + if x != nil && x.Message != nil { + return *x.Message + } + return "" +} + +func (x *Status) GetDone() bool { + if x != nil && x.Done != nil { + return *x.Done + } + return false +} + +func (x *Status) GetError() string { + if x != nil && x.Error != nil { + return *x.Error + } + return "" +} + +var File_proto_provision_plugin_v1alpha1_plugin_proto protoreflect.FileDescriptor + +var file_proto_provision_plugin_v1alpha1_plugin_proto_rawDesc = []byte{ + 0x0a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x22, + 0x11, 0x0a, 0x0f, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x80, 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x70, 0x6c, 0x6f, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, + 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, + 0x0a, 0x64, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x27, + 0x0a, 0x0d, 0x6b, 0x75, 0x62, 0x65, 0x5f, 0x63, 0x66, 0x67, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x43, 0x66, 0x67, + 0x46, 0x69, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x61, 0x74, 0x61, + 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x6b, 0x75, 0x62, 0x65, + 0x5f, 0x63, 0x66, 0x67, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x61, 0x0a, 0x0e, 0x44, 0x65, 0x70, + 0x6c, 0x6f, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, + 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x47, 0x0a, 0x0f, + 0x54, 0x65, 0x61, 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x24, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x63, 0x0a, 0x10, 0x54, 0x65, 0x61, 0x72, 0x44, 0x6f, 0x77, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x9f, 0x01, 0x0a, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x67, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x01, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x64, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, + 0x04, 0x64, 0x6f, 0x6e, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x67, 0x65, 0x42, 0x0a, 0x0a, + 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x64, 0x6f, + 0x6e, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x32, 0xe9, 0x02, 0x0a, + 0x16, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, 0x08, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x06, 0x44, 0x65, 0x70, 0x6c, + 0x6f, 0x79, 0x12, 0x2e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x71, 0x0a, 0x08, 0x54, 0x65, 0x61, 0x72, 0x44, 0x6f, 0x77, + 0x6e, 0x12, 0x30, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x54, 0x65, 0x61, 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x65, 0x61, 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x66, 0x69, 0x64, 0x65, 0x2f, 0x63, 0x6f, + 0x66, 0x69, 0x64, 0x65, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x67, 0x65, 0x6e, + 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescOnce sync.Once + file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescData = file_proto_provision_plugin_v1alpha1_plugin_proto_rawDesc +) + +func file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescGZIP() []byte { + file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescOnce.Do(func() { + file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescData) + }) + return file_proto_provision_plugin_v1alpha1_plugin_proto_rawDescData +} + +var file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_proto_provision_plugin_v1alpha1_plugin_proto_goTypes = []any{ + (*ValidateRequest)(nil), // 0: proto.provision_plugin.v1alpha1.ValidateRequest + (*ValidateResponse)(nil), // 1: proto.provision_plugin.v1alpha1.ValidateResponse + (*DeployRequest)(nil), // 2: proto.provision_plugin.v1alpha1.DeployRequest + (*DeployResponse)(nil), // 3: proto.provision_plugin.v1alpha1.DeployResponse + (*TearDownRequest)(nil), // 4: proto.provision_plugin.v1alpha1.TearDownRequest + (*TearDownResponse)(nil), // 5: proto.provision_plugin.v1alpha1.TearDownResponse + (*Status)(nil), // 6: proto.provision_plugin.v1alpha1.Status +} +var file_proto_provision_plugin_v1alpha1_plugin_proto_depIdxs = []int32{ + 6, // 0: proto.provision_plugin.v1alpha1.DeployResponse.status:type_name -> proto.provision_plugin.v1alpha1.Status + 6, // 1: proto.provision_plugin.v1alpha1.TearDownResponse.status:type_name -> proto.provision_plugin.v1alpha1.Status + 0, // 2: proto.provision_plugin.v1alpha1.ProvisionPluginService.Validate:input_type -> proto.provision_plugin.v1alpha1.ValidateRequest + 2, // 3: proto.provision_plugin.v1alpha1.ProvisionPluginService.Deploy:input_type -> proto.provision_plugin.v1alpha1.DeployRequest + 4, // 4: proto.provision_plugin.v1alpha1.ProvisionPluginService.TearDown:input_type -> proto.provision_plugin.v1alpha1.TearDownRequest + 1, // 5: proto.provision_plugin.v1alpha1.ProvisionPluginService.Validate:output_type -> proto.provision_plugin.v1alpha1.ValidateResponse + 3, // 6: proto.provision_plugin.v1alpha1.ProvisionPluginService.Deploy:output_type -> proto.provision_plugin.v1alpha1.DeployResponse + 5, // 7: proto.provision_plugin.v1alpha1.ProvisionPluginService.TearDown:output_type -> proto.provision_plugin.v1alpha1.TearDownResponse + 5, // [5:8] is the sub-list for method output_type + 2, // [2:5] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_proto_provision_plugin_v1alpha1_plugin_proto_init() } +func file_proto_provision_plugin_v1alpha1_plugin_proto_init() { + if File_proto_provision_plugin_v1alpha1_plugin_proto != nil { + return + } + file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[2].OneofWrappers = []any{} + file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[3].OneofWrappers = []any{} + file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[4].OneofWrappers = []any{} + file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[5].OneofWrappers = []any{} + file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes[6].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_provision_plugin_v1alpha1_plugin_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_provision_plugin_v1alpha1_plugin_proto_goTypes, + DependencyIndexes: file_proto_provision_plugin_v1alpha1_plugin_proto_depIdxs, + MessageInfos: file_proto_provision_plugin_v1alpha1_plugin_proto_msgTypes, + }.Build() + File_proto_provision_plugin_v1alpha1_plugin_proto = out.File + file_proto_provision_plugin_v1alpha1_plugin_proto_rawDesc = nil + file_proto_provision_plugin_v1alpha1_plugin_proto_goTypes = nil + file_proto_provision_plugin_v1alpha1_plugin_proto_depIdxs = nil +} diff --git a/gen/go/proto/provision_plugin/v1alpha1/plugin_grpc.pb.go b/gen/go/proto/provision_plugin/v1alpha1/plugin_grpc.pb.go new file mode 100644 index 0000000..0a7d310 --- /dev/null +++ b/gen/go/proto/provision_plugin/v1alpha1/plugin_grpc.pb.go @@ -0,0 +1,205 @@ +// Copyright 2024 Cofide Limited. +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: proto/provision_plugin/v1alpha1/plugin.proto + +package v1alpha1 + +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.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + ProvisionPluginService_Validate_FullMethodName = "/proto.provision_plugin.v1alpha1.ProvisionPluginService/Validate" + ProvisionPluginService_Deploy_FullMethodName = "/proto.provision_plugin.v1alpha1.ProvisionPluginService/Deploy" + ProvisionPluginService_TearDown_FullMethodName = "/proto.provision_plugin.v1alpha1.ProvisionPluginService/TearDown" +) + +// ProvisionPluginServiceClient is the client API for ProvisionPluginService 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 ProvisionPluginServiceClient interface { + Validate(ctx context.Context, in *ValidateRequest, opts ...grpc.CallOption) (*ValidateResponse, error) + Deploy(ctx context.Context, in *DeployRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DeployResponse], error) + TearDown(ctx context.Context, in *TearDownRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TearDownResponse], error) +} + +type provisionPluginServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewProvisionPluginServiceClient(cc grpc.ClientConnInterface) ProvisionPluginServiceClient { + return &provisionPluginServiceClient{cc} +} + +func (c *provisionPluginServiceClient) Validate(ctx context.Context, in *ValidateRequest, opts ...grpc.CallOption) (*ValidateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ValidateResponse) + err := c.cc.Invoke(ctx, ProvisionPluginService_Validate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *provisionPluginServiceClient) Deploy(ctx context.Context, in *DeployRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DeployResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ProvisionPluginService_ServiceDesc.Streams[0], ProvisionPluginService_Deploy_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[DeployRequest, DeployResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ProvisionPluginService_DeployClient = grpc.ServerStreamingClient[DeployResponse] + +func (c *provisionPluginServiceClient) TearDown(ctx context.Context, in *TearDownRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TearDownResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ProvisionPluginService_ServiceDesc.Streams[1], ProvisionPluginService_TearDown_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[TearDownRequest, TearDownResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ProvisionPluginService_TearDownClient = grpc.ServerStreamingClient[TearDownResponse] + +// ProvisionPluginServiceServer is the server API for ProvisionPluginService service. +// All implementations should embed UnimplementedProvisionPluginServiceServer +// for forward compatibility. +type ProvisionPluginServiceServer interface { + Validate(context.Context, *ValidateRequest) (*ValidateResponse, error) + Deploy(*DeployRequest, grpc.ServerStreamingServer[DeployResponse]) error + TearDown(*TearDownRequest, grpc.ServerStreamingServer[TearDownResponse]) error +} + +// UnimplementedProvisionPluginServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedProvisionPluginServiceServer struct{} + +func (UnimplementedProvisionPluginServiceServer) Validate(context.Context, *ValidateRequest) (*ValidateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Validate not implemented") +} +func (UnimplementedProvisionPluginServiceServer) Deploy(*DeployRequest, grpc.ServerStreamingServer[DeployResponse]) error { + return status.Errorf(codes.Unimplemented, "method Deploy not implemented") +} +func (UnimplementedProvisionPluginServiceServer) TearDown(*TearDownRequest, grpc.ServerStreamingServer[TearDownResponse]) error { + return status.Errorf(codes.Unimplemented, "method TearDown not implemented") +} +func (UnimplementedProvisionPluginServiceServer) testEmbeddedByValue() {} + +// UnsafeProvisionPluginServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ProvisionPluginServiceServer will +// result in compilation errors. +type UnsafeProvisionPluginServiceServer interface { + mustEmbedUnimplementedProvisionPluginServiceServer() +} + +func RegisterProvisionPluginServiceServer(s grpc.ServiceRegistrar, srv ProvisionPluginServiceServer) { + // If the following call pancis, it indicates UnimplementedProvisionPluginServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ProvisionPluginService_ServiceDesc, srv) +} + +func _ProvisionPluginService_Validate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionPluginServiceServer).Validate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ProvisionPluginService_Validate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionPluginServiceServer).Validate(ctx, req.(*ValidateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ProvisionPluginService_Deploy_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(DeployRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProvisionPluginServiceServer).Deploy(m, &grpc.GenericServerStream[DeployRequest, DeployResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ProvisionPluginService_DeployServer = grpc.ServerStreamingServer[DeployResponse] + +func _ProvisionPluginService_TearDown_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(TearDownRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProvisionPluginServiceServer).TearDown(m, &grpc.GenericServerStream[TearDownRequest, TearDownResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ProvisionPluginService_TearDownServer = grpc.ServerStreamingServer[TearDownResponse] + +// ProvisionPluginService_ServiceDesc is the grpc.ServiceDesc for ProvisionPluginService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ProvisionPluginService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "proto.provision_plugin.v1alpha1.ProvisionPluginService", + HandlerType: (*ProvisionPluginServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Validate", + Handler: _ProvisionPluginService_Validate_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Deploy", + Handler: _ProvisionPluginService_Deploy_Handler, + ServerStreams: true, + }, + { + StreamName: "TearDown", + Handler: _ProvisionPluginService_TearDown_Handler, + ServerStreams: true, + }, + }, + Metadata: "proto/provision_plugin/v1alpha1/plugin.proto", +} diff --git a/proto/provision_plugin/v1alpha1/plugin.proto b/proto/provision_plugin/v1alpha1/plugin.proto new file mode 100644 index 0000000..28f4fb1 --- /dev/null +++ b/proto/provision_plugin/v1alpha1/plugin.proto @@ -0,0 +1,42 @@ +// Copyright 2024 Cofide Limited. +// SPDX-License-Identifier: Apache-2.0 + +syntax = "proto3"; + +package proto.provision_plugin.v1alpha1; + +option go_package = "github.com/cofide/cofide-api-sdk/gen/go/proto/provision_plugin/v1alpha1"; + +service ProvisionPluginService { + rpc Validate(ValidateRequest) returns (ValidateResponse); + rpc Deploy(DeployRequest) returns (stream DeployResponse); + rpc TearDown(TearDownRequest) returns (stream TearDownResponse); +} + +message ValidateRequest {} + +message ValidateResponse {} + +message DeployRequest { + optional uint32 data_source = 1; + optional string kube_cfg_file = 2; +} + +message DeployResponse { + optional Status status = 1; +} + +message TearDownRequest { + optional uint32 data_source = 1; +} + +message TearDownResponse { + optional Status status = 1; +} + +message Status { + optional string stage = 1; + optional string message = 2; + optional bool done = 3; + optional string error = 4; +}