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..90496a23 --- /dev/null +++ b/cmd/delete/environment.go @@ -0,0 +1,63 @@ +package delete + +import ( + "encoding/json" + "fmt" + + "github.com/dream11/odin/internal/service" + "github.com/dream11/odin/pkg/constant" + 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() + response, err := environmentClient.DeleteEnvironment(&ctx, &environment.DeleteEnvironmentRequest{ + EnvName: name, + }) + + if err != nil { + log.Fatal("Failed to delete environment ", err) + } + + outputFormat, err := cmd.Flags().GetString("output") + if err != nil { + log.Fatal(err) + } + writeOutput(response, outputFormat) +} + +func writeOutput(response *environment.DeleteEnvironmentResponse, format string) { + + switch format { + case constant.TEXT: + fmt.Print(response.Message) + case constant.JSON: + output, _ := json.Marshal(response) + fmt.Print(string(output)) + default: + log.Fatal("Unknown output format: ", format) + } +} diff --git a/cmd/list/environment.go b/cmd/list/environment.go index a4f8a6be..2ae02453 100644 --- a/cmd/list/environment.go +++ b/cmd/list/environment.go @@ -3,10 +3,10 @@ package list import ( "encoding/json" "fmt" - "github.com/dream11/odin/pkg/constant" "strconv" "github.com/dream11/odin/internal/service" + "github.com/dream11/odin/pkg/constant" "github.com/dream11/odin/pkg/table" environment "github.com/dream11/odin/proto/gen/go/dream11/od/environment/v1" log "github.com/sirupsen/logrus" @@ -100,4 +100,3 @@ func writeAsJSON(response *environment.ListEnvironmentResponse) { output, _ := json.MarshalIndent(environments, "", " ") fmt.Print(string(output)) } - diff --git a/internal/service/environment.go b/internal/service/environment.go index 143797b9..20cce979 100644 --- a/internal/service/environment.go +++ b/internal/service/environment.go @@ -23,3 +23,20 @@ func (e *Environment) ListEnvironments(ctx *context.Context, request *environmen return response, nil } + +// DeleteEnvironment : Delete environment +func (e *Environment) DeleteEnvironment(ctx *context.Context, request *environment.DeleteEnvironmentRequest) (*environment.DeleteEnvironmentResponse, error) { + conn, requestCtx, err := grpcClient(ctx) + if err != nil { + return nil, err + } + + client := environment.NewEnvironmentServiceClient(conn) + response, err := client.DeleteEnvironment(*requestCtx, request) + + if err != nil { + return nil, err + } + + return response, nil +} diff --git a/proto/dream11/od/environment/v1/environment.proto b/proto/dream11/od/environment/v1/environment.proto index 519b2061..cfe1e15f 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 (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 2a9db7e0..cafde84d 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{ @@ -487,46 +581,61 @@ var file_dream11_od_environment_v1_environment_proto_rawDesc = []byte{ 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x22, 0x35, 0x0a, 0x19, 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, 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, 0x65, 0x61, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 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, 0xa4, 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, 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, 0x6f, 0x64, + 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, 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, + 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, 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, + 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, 0x80, 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, 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 +650,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 +660,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 +792,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 +823,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 05ef2e0c..9ca8a876 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) (*DeleteEnvironmentResponse, error) } type environmentServiceClient struct { @@ -102,6 +104,15 @@ func (x *environmentServiceCreateEnvironmentClient) Recv() (*CreateEnvironmentRe return m, nil } +func (c *environmentServiceClient) DeleteEnvironment(ctx context.Context, in *DeleteEnvironmentRequest, opts ...grpc.CallOption) (*DeleteEnvironmentResponse, error) { + out := new(DeleteEnvironmentResponse) + err := c.cc.Invoke(ctx, EnvironmentService_DeleteEnvironment_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // EnvironmentServiceServer is the server API for EnvironmentService service. // All implementations must embed UnimplementedEnvironmentServiceServer // for forward compatibility @@ -110,6 +121,7 @@ type EnvironmentServiceServer interface { DescribeEnvironment(context.Context, *DescribeEnvironmentRequest) (*DescribeEnvironmentResponse, error) UpdateEnvironment(context.Context, *UpdateEnvironmentRequest) (*UpdateEnvironmentResponse, error) CreateEnvironment(*CreateEnvironmentRequest, EnvironmentService_CreateEnvironmentServer) error + DeleteEnvironment(context.Context, *DeleteEnvironmentRequest) (*DeleteEnvironmentResponse, error) mustEmbedUnimplementedEnvironmentServiceServer() } @@ -129,6 +141,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(context.Context, *DeleteEnvironmentRequest) (*DeleteEnvironmentResponse, error) { + return nil, 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 +232,24 @@ func (x *environmentServiceCreateEnvironmentServer) Send(m *CreateEnvironmentRes return x.ServerStream.SendMsg(m) } +func _EnvironmentService_DeleteEnvironment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteEnvironmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EnvironmentServiceServer).DeleteEnvironment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: EnvironmentService_DeleteEnvironment_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EnvironmentServiceServer).DeleteEnvironment(ctx, req.(*DeleteEnvironmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + // 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) @@ -236,6 +269,10 @@ var EnvironmentService_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdateEnvironment", Handler: _EnvironmentService_UpdateEnvironment_Handler, }, + { + MethodName: "DeleteEnvironment", + Handler: _EnvironmentService_DeleteEnvironment_Handler, + }, }, Streams: []grpc.StreamDesc{ {