-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6d1391
commit be4d707
Showing
8 changed files
with
361 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
244 changes: 191 additions & 53 deletions
244
proto/gen/go/dream11/od/environment/v1/environment.pb.go
Large diffs are not rendered by default.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
proto/gen/go/dream11/od/environment/v1/environment_grpc.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.