From 56a13f96fe186974c9a4b960561cc79fc8270dc1 Mon Sep 17 00:00:00 2001 From: boppanasusanth Date: Wed, 8 Nov 2023 14:07:02 +0530 Subject: [PATCH] onboard delete env command --- cmd/delete/delete.go | 16 ++ cmd/delete/environment.go | 40 +++ internal/service/environment.go | 40 ++- main.go | 1 + pkg/util/util.go | 1 + .../od/environment/v1/environment.proto | 9 + .../od/environment/v1/environment.pb.go | 244 ++++++++++++++---- .../od/environment/v1/environment_grpc.pb.go | 64 +++++ 8 files changed, 360 insertions(+), 55 deletions(-) create mode 100644 cmd/delete/delete.go create mode 100644 cmd/delete/environment.go diff --git a/cmd/delete/delete.go b/cmd/delete/delete.go new file mode 100644 index 00000000..99ba2826 --- /dev/null +++ b/cmd/delete/delete.go @@ -0,0 +1,16 @@ +package delete + +import ( + "github.com/dream11/odin/cmd" + "github.com/spf13/cobra" +) + +var deleteCmd = &cobra.Command{ + Use: "delete", + Short: "Delete resources", + Long: `Delete resources`, +} + +func init() { + cmd.RootCmd.AddCommand(deleteCmd) +} diff --git a/cmd/delete/environment.go b/cmd/delete/environment.go new file mode 100644 index 00000000..cda2f3cc --- /dev/null +++ b/cmd/delete/environment.go @@ -0,0 +1,40 @@ +package delete + +import ( + "github.com/dream11/odin/internal/service" + environment "github.com/dream11/odin/proto/gen/go/dream11/od/environment/v1" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +var name string + +var environmentClient = service.Environment{} + +var environmentCmd = &cobra.Command{ + Use: "environment", + Short: "Delete environment", + Long: `Delete environment`, + Args: func(cmd *cobra.Command, args []string) error { + return cobra.NoArgs(cmd, args) + }, + Run: func(cmd *cobra.Command, args []string) { + execute(cmd) + }, +} + +func init() { + environmentCmd.Flags().StringVar(&name, "name", "", "name of the env") + deleteCmd.AddCommand(environmentCmd) +} + +func execute(cmd *cobra.Command) { + ctx := cmd.Context() + err := environmentClient.DeleteEnvironment(&ctx, &environment.DeleteEnvironmentRequest{ + EnvName: name, + }) + + if err != nil { + log.Fatal("Failed to delete environment ", err) + } +} diff --git a/internal/service/environment.go b/internal/service/environment.go index f06e56f7..4df0a93b 100644 --- a/internal/service/environment.go +++ b/internal/service/environment.go @@ -8,7 +8,6 @@ import ( "github.com/briandowns/spinner" "github.com/dream11/odin/pkg/constant" environment "github.com/dream11/odin/proto/gen/go/dream11/od/environment/v1" - log "github.com/sirupsen/logrus" ) @@ -54,7 +53,44 @@ func (e *Environment) CreateEnvironment(ctx *context.Context, request *environme if err == context.Canceled || err == io.EOF { break } - log.Error(err.Error()) + return err + } + if response != nil { + message = response.Message + spinner.Prefix = fmt.Sprintf(" %s ", response.Message) + spinner.Start() + } + } + log.Info(message) + return err +} + +// DeleteEnvironment : Delete environment +func (e *Environment) DeleteEnvironment(ctx *context.Context, request *environment.DeleteEnvironmentRequest) error { + conn, requestCtx, err := grpcClient(ctx) + if err != nil { + return err + } + + client := environment.NewEnvironmentServiceClient(conn) + stream, err := client.DeleteEnvironment(*requestCtx, request) + + if err != nil { + return err + } + + log.Info("Deleting environment...") + spinner := spinner.New(spinner.CharSets[constant.SpinnerType], constant.SpinnerDelay) + spinner.Color(constant.SpinnerColor, constant.SpinnerStyle) + + var message string + for { + response, err := stream.Recv() + spinner.Stop() + if err != nil { + if err == context.Canceled || err == io.EOF { + break + } return err } if response != nil { diff --git a/main.go b/main.go index b34c78c4..16f4d9c7 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "github.com/dream11/odin/cmd" _ "github.com/dream11/odin/cmd/configure" _ "github.com/dream11/odin/cmd/create" + _ "github.com/dream11/odin/cmd/delete" _ "github.com/dream11/odin/cmd/list" _ "github.com/dream11/odin/internal/ui" ) diff --git a/pkg/util/util.go b/pkg/util/util.go index 09d0fc72..f0403590 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -2,6 +2,7 @@ package util import "strings" +// SplitProviderAccount: splits string into list of cloud provider accounts func SplitProviderAccount(providerAccounts string) []string { if providerAccounts == "" { return nil diff --git a/proto/dream11/od/environment/v1/environment.proto b/proto/dream11/od/environment/v1/environment.proto index 02e53061..5cf54acb 100644 --- a/proto/dream11/od/environment/v1/environment.proto +++ b/proto/dream11/od/environment/v1/environment.proto @@ -11,6 +11,7 @@ service EnvironmentService { rpc DescribeEnvironment(DescribeEnvironmentRequest) returns (DescribeEnvironmentResponse) {} rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (UpdateEnvironmentResponse) {} rpc CreateEnvironment(CreateEnvironmentRequest) returns (stream CreateEnvironmentResponse) {} + rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (stream DeleteEnvironmentResponse) {} } message ListEnvironmentRequest { @@ -46,3 +47,11 @@ message CreateEnvironmentRequest { message CreateEnvironmentResponse { string message = 1; } + +message DeleteEnvironmentRequest { + string env_name = 1; +} + +message DeleteEnvironmentResponse { + string message = 1; +} diff --git a/proto/gen/go/dream11/od/environment/v1/environment.pb.go b/proto/gen/go/dream11/od/environment/v1/environment.pb.go index f64752ab..65c14923 100644 --- a/proto/gen/go/dream11/od/environment/v1/environment.pb.go +++ b/proto/gen/go/dream11/od/environment/v1/environment.pb.go @@ -421,6 +421,100 @@ func (x *CreateEnvironmentResponse) GetMessage() string { return "" } +type DeleteEnvironmentRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EnvName string `protobuf:"bytes,1,opt,name=env_name,json=envName,proto3" json:"env_name,omitempty"` +} + +func (x *DeleteEnvironmentRequest) Reset() { + *x = DeleteEnvironmentRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_dream11_od_environment_v1_environment_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteEnvironmentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteEnvironmentRequest) ProtoMessage() {} + +func (x *DeleteEnvironmentRequest) ProtoReflect() protoreflect.Message { + mi := &file_dream11_od_environment_v1_environment_proto_msgTypes[8] + 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 DeleteEnvironmentRequest.ProtoReflect.Descriptor instead. +func (*DeleteEnvironmentRequest) Descriptor() ([]byte, []int) { + return file_dream11_od_environment_v1_environment_proto_rawDescGZIP(), []int{8} +} + +func (x *DeleteEnvironmentRequest) GetEnvName() string { + if x != nil { + return x.EnvName + } + return "" +} + +type DeleteEnvironmentResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *DeleteEnvironmentResponse) Reset() { + *x = DeleteEnvironmentResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_dream11_od_environment_v1_environment_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteEnvironmentResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteEnvironmentResponse) ProtoMessage() {} + +func (x *DeleteEnvironmentResponse) ProtoReflect() protoreflect.Message { + mi := &file_dream11_od_environment_v1_environment_proto_msgTypes[9] + 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 DeleteEnvironmentResponse.ProtoReflect.Descriptor instead. +func (*DeleteEnvironmentResponse) Descriptor() ([]byte, []int) { + return file_dream11_od_environment_v1_environment_proto_rawDescGZIP(), []int{9} +} + +func (x *DeleteEnvironmentResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + var File_dream11_od_environment_v1_environment_proto protoreflect.FileDescriptor var file_dream11_od_environment_v1_environment_proto_rawDesc = []byte{ @@ -488,45 +582,61 @@ var file_dream11_od_environment_v1_environment_proto_rawDesc = []byte{ 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x32, 0xa1, 0x04, 0x0a, 0x12, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x45, - 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x31, 0x2e, 0x64, 0x72, 0x65, - 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, - 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, - 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, - 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, - 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, - 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x86, 0x01, 0x0a, 0x13, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, - 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x35, 0x2e, 0x64, 0x72, + 0x22, 0x35, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, + 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, + 0x65, 0x6e, 0x76, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x65, 0x6e, 0x76, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x35, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0xa6, + 0x05, 0x0a, 0x12, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76, + 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x31, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, + 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, - 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, - 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, - 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, - 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x80, 0x01, 0x0a, - 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x33, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, - 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, + 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76, 0x69, + 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x86, 0x01, 0x0a, 0x13, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x6e, + 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x35, 0x2e, 0x64, 0x72, 0x65, 0x61, + 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, + 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x6e, + 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x36, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, + 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x80, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, - 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, - 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, - 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x82, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, - 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x33, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, + 0x12, 0x33, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, + 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, - 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x64, 0x72, 0x65, - 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, - 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, - 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x30, 0x01, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2f, 0x6f, 0x64, 0x69, 0x6e, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x64, 0x72, 0x65, - 0x61, 0x6d, 0x31, 0x31, 0x2f, 0x6f, 0x64, 0x2f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, - 0x65, 0x6e, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x82, 0x01, + 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x33, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, + 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, + 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, + 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x30, 0x01, 0x12, 0x82, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, + 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x33, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, + 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, + 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, + 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x65, 0x6e, 0x76, 0x69, 0x72, + 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2f, 0x6f, 0x64, + 0x69, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, + 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2f, 0x6f, 0x64, 0x2f, 0x65, 0x6e, 0x76, 0x69, 0x72, + 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -541,7 +651,7 @@ func file_dream11_od_environment_v1_environment_proto_rawDescGZIP() []byte { return file_dream11_od_environment_v1_environment_proto_rawDescData } -var file_dream11_od_environment_v1_environment_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_dream11_od_environment_v1_environment_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_dream11_od_environment_v1_environment_proto_goTypes = []interface{}{ (*ListEnvironmentRequest)(nil), // 0: dream11.od.environment.v1.ListEnvironmentRequest (*ListEnvironmentResponse)(nil), // 1: dream11.od.environment.v1.ListEnvironmentResponse @@ -551,27 +661,31 @@ var file_dream11_od_environment_v1_environment_proto_goTypes = []interface{}{ (*UpdateEnvironmentResponse)(nil), // 5: dream11.od.environment.v1.UpdateEnvironmentResponse (*CreateEnvironmentRequest)(nil), // 6: dream11.od.environment.v1.CreateEnvironmentRequest (*CreateEnvironmentResponse)(nil), // 7: dream11.od.environment.v1.CreateEnvironmentResponse - nil, // 8: dream11.od.environment.v1.ListEnvironmentRequest.ParamsEntry - nil, // 9: dream11.od.environment.v1.DescribeEnvironmentRequest.ParamsEntry - (*v1.Environment)(nil), // 10: dream11.od.dto.v1.Environment - (*structpb.Struct)(nil), // 11: google.protobuf.Struct + (*DeleteEnvironmentRequest)(nil), // 8: dream11.od.environment.v1.DeleteEnvironmentRequest + (*DeleteEnvironmentResponse)(nil), // 9: dream11.od.environment.v1.DeleteEnvironmentResponse + nil, // 10: dream11.od.environment.v1.ListEnvironmentRequest.ParamsEntry + nil, // 11: dream11.od.environment.v1.DescribeEnvironmentRequest.ParamsEntry + (*v1.Environment)(nil), // 12: dream11.od.dto.v1.Environment + (*structpb.Struct)(nil), // 13: google.protobuf.Struct } var file_dream11_od_environment_v1_environment_proto_depIdxs = []int32{ - 8, // 0: dream11.od.environment.v1.ListEnvironmentRequest.params:type_name -> dream11.od.environment.v1.ListEnvironmentRequest.ParamsEntry - 10, // 1: dream11.od.environment.v1.ListEnvironmentResponse.environments:type_name -> dream11.od.dto.v1.Environment - 9, // 2: dream11.od.environment.v1.DescribeEnvironmentRequest.params:type_name -> dream11.od.environment.v1.DescribeEnvironmentRequest.ParamsEntry - 10, // 3: dream11.od.environment.v1.DescribeEnvironmentResponse.environment:type_name -> dream11.od.dto.v1.Environment - 11, // 4: dream11.od.environment.v1.UpdateEnvironmentRequest.data:type_name -> google.protobuf.Struct + 10, // 0: dream11.od.environment.v1.ListEnvironmentRequest.params:type_name -> dream11.od.environment.v1.ListEnvironmentRequest.ParamsEntry + 12, // 1: dream11.od.environment.v1.ListEnvironmentResponse.environments:type_name -> dream11.od.dto.v1.Environment + 11, // 2: dream11.od.environment.v1.DescribeEnvironmentRequest.params:type_name -> dream11.od.environment.v1.DescribeEnvironmentRequest.ParamsEntry + 12, // 3: dream11.od.environment.v1.DescribeEnvironmentResponse.environment:type_name -> dream11.od.dto.v1.Environment + 13, // 4: dream11.od.environment.v1.UpdateEnvironmentRequest.data:type_name -> google.protobuf.Struct 0, // 5: dream11.od.environment.v1.EnvironmentService.ListEnvironment:input_type -> dream11.od.environment.v1.ListEnvironmentRequest 2, // 6: dream11.od.environment.v1.EnvironmentService.DescribeEnvironment:input_type -> dream11.od.environment.v1.DescribeEnvironmentRequest 4, // 7: dream11.od.environment.v1.EnvironmentService.UpdateEnvironment:input_type -> dream11.od.environment.v1.UpdateEnvironmentRequest 6, // 8: dream11.od.environment.v1.EnvironmentService.CreateEnvironment:input_type -> dream11.od.environment.v1.CreateEnvironmentRequest - 1, // 9: dream11.od.environment.v1.EnvironmentService.ListEnvironment:output_type -> dream11.od.environment.v1.ListEnvironmentResponse - 3, // 10: dream11.od.environment.v1.EnvironmentService.DescribeEnvironment:output_type -> dream11.od.environment.v1.DescribeEnvironmentResponse - 5, // 11: dream11.od.environment.v1.EnvironmentService.UpdateEnvironment:output_type -> dream11.od.environment.v1.UpdateEnvironmentResponse - 7, // 12: dream11.od.environment.v1.EnvironmentService.CreateEnvironment:output_type -> dream11.od.environment.v1.CreateEnvironmentResponse - 9, // [9:13] is the sub-list for method output_type - 5, // [5:9] is the sub-list for method input_type + 8, // 9: dream11.od.environment.v1.EnvironmentService.DeleteEnvironment:input_type -> dream11.od.environment.v1.DeleteEnvironmentRequest + 1, // 10: dream11.od.environment.v1.EnvironmentService.ListEnvironment:output_type -> dream11.od.environment.v1.ListEnvironmentResponse + 3, // 11: dream11.od.environment.v1.EnvironmentService.DescribeEnvironment:output_type -> dream11.od.environment.v1.DescribeEnvironmentResponse + 5, // 12: dream11.od.environment.v1.EnvironmentService.UpdateEnvironment:output_type -> dream11.od.environment.v1.UpdateEnvironmentResponse + 7, // 13: dream11.od.environment.v1.EnvironmentService.CreateEnvironment:output_type -> dream11.od.environment.v1.CreateEnvironmentResponse + 9, // 14: dream11.od.environment.v1.EnvironmentService.DeleteEnvironment:output_type -> dream11.od.environment.v1.DeleteEnvironmentResponse + 10, // [10:15] is the sub-list for method output_type + 5, // [5:10] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name 5, // [5:5] is the sub-list for extension extendee 0, // [0:5] is the sub-list for field type_name @@ -679,6 +793,30 @@ func file_dream11_od_environment_v1_environment_proto_init() { return nil } } + file_dream11_od_environment_v1_environment_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteEnvironmentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dream11_od_environment_v1_environment_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteEnvironmentResponse); 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{ @@ -686,7 +824,7 @@ func file_dream11_od_environment_v1_environment_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_dream11_od_environment_v1_environment_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/gen/go/dream11/od/environment/v1/environment_grpc.pb.go b/proto/gen/go/dream11/od/environment/v1/environment_grpc.pb.go index 251edd82..3cb1bb06 100644 --- a/proto/gen/go/dream11/od/environment/v1/environment_grpc.pb.go +++ b/proto/gen/go/dream11/od/environment/v1/environment_grpc.pb.go @@ -23,6 +23,7 @@ const ( EnvironmentService_DescribeEnvironment_FullMethodName = "/dream11.od.environment.v1.EnvironmentService/DescribeEnvironment" EnvironmentService_UpdateEnvironment_FullMethodName = "/dream11.od.environment.v1.EnvironmentService/UpdateEnvironment" EnvironmentService_CreateEnvironment_FullMethodName = "/dream11.od.environment.v1.EnvironmentService/CreateEnvironment" + EnvironmentService_DeleteEnvironment_FullMethodName = "/dream11.od.environment.v1.EnvironmentService/DeleteEnvironment" ) // EnvironmentServiceClient is the client API for EnvironmentService service. @@ -33,6 +34,7 @@ type EnvironmentServiceClient interface { DescribeEnvironment(ctx context.Context, in *DescribeEnvironmentRequest, opts ...grpc.CallOption) (*DescribeEnvironmentResponse, error) UpdateEnvironment(ctx context.Context, in *UpdateEnvironmentRequest, opts ...grpc.CallOption) (*UpdateEnvironmentResponse, error) CreateEnvironment(ctx context.Context, in *CreateEnvironmentRequest, opts ...grpc.CallOption) (EnvironmentService_CreateEnvironmentClient, error) + DeleteEnvironment(ctx context.Context, in *DeleteEnvironmentRequest, opts ...grpc.CallOption) (EnvironmentService_DeleteEnvironmentClient, error) } type environmentServiceClient struct { @@ -102,6 +104,38 @@ func (x *environmentServiceCreateEnvironmentClient) Recv() (*CreateEnvironmentRe return m, nil } +func (c *environmentServiceClient) DeleteEnvironment(ctx context.Context, in *DeleteEnvironmentRequest, opts ...grpc.CallOption) (EnvironmentService_DeleteEnvironmentClient, error) { + stream, err := c.cc.NewStream(ctx, &EnvironmentService_ServiceDesc.Streams[1], EnvironmentService_DeleteEnvironment_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &environmentServiceDeleteEnvironmentClient{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 +} + +type EnvironmentService_DeleteEnvironmentClient interface { + Recv() (*DeleteEnvironmentResponse, error) + grpc.ClientStream +} + +type environmentServiceDeleteEnvironmentClient struct { + grpc.ClientStream +} + +func (x *environmentServiceDeleteEnvironmentClient) Recv() (*DeleteEnvironmentResponse, error) { + m := new(DeleteEnvironmentResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // EnvironmentServiceServer is the server API for EnvironmentService service. // All implementations must embed UnimplementedEnvironmentServiceServer // for forward compatibility @@ -110,6 +144,7 @@ type EnvironmentServiceServer interface { DescribeEnvironment(context.Context, *DescribeEnvironmentRequest) (*DescribeEnvironmentResponse, error) UpdateEnvironment(context.Context, *UpdateEnvironmentRequest) (*UpdateEnvironmentResponse, error) CreateEnvironment(*CreateEnvironmentRequest, EnvironmentService_CreateEnvironmentServer) error + DeleteEnvironment(*DeleteEnvironmentRequest, EnvironmentService_DeleteEnvironmentServer) error mustEmbedUnimplementedEnvironmentServiceServer() } @@ -129,6 +164,9 @@ func (UnimplementedEnvironmentServiceServer) UpdateEnvironment(context.Context, func (UnimplementedEnvironmentServiceServer) CreateEnvironment(*CreateEnvironmentRequest, EnvironmentService_CreateEnvironmentServer) error { return status.Errorf(codes.Unimplemented, "method CreateEnvironment not implemented") } +func (UnimplementedEnvironmentServiceServer) DeleteEnvironment(*DeleteEnvironmentRequest, EnvironmentService_DeleteEnvironmentServer) error { + return status.Errorf(codes.Unimplemented, "method DeleteEnvironment not implemented") +} func (UnimplementedEnvironmentServiceServer) mustEmbedUnimplementedEnvironmentServiceServer() {} // UnsafeEnvironmentServiceServer may be embedded to opt out of forward compatibility for this service. @@ -217,6 +255,27 @@ func (x *environmentServiceCreateEnvironmentServer) Send(m *CreateEnvironmentRes return x.ServerStream.SendMsg(m) } +func _EnvironmentService_DeleteEnvironment_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(DeleteEnvironmentRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(EnvironmentServiceServer).DeleteEnvironment(m, &environmentServiceDeleteEnvironmentServer{stream}) +} + +type EnvironmentService_DeleteEnvironmentServer interface { + Send(*DeleteEnvironmentResponse) error + grpc.ServerStream +} + +type environmentServiceDeleteEnvironmentServer struct { + grpc.ServerStream +} + +func (x *environmentServiceDeleteEnvironmentServer) Send(m *DeleteEnvironmentResponse) error { + return x.ServerStream.SendMsg(m) +} + // EnvironmentService_ServiceDesc is the grpc.ServiceDesc for EnvironmentService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -243,6 +302,11 @@ var EnvironmentService_ServiceDesc = grpc.ServiceDesc{ Handler: _EnvironmentService_CreateEnvironment_Handler, ServerStreams: true, }, + { + StreamName: "DeleteEnvironment", + Handler: _EnvironmentService_DeleteEnvironment_Handler, + ServerStreams: true, + }, }, Metadata: "dream11/od/environment/v1/environment.proto", }