This repository has been archived by the owner on Feb 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cedric Kienzler
committed
Mar 9, 2021
1 parent
c6c11da
commit 16c1b94
Showing
4 changed files
with
54 additions
and
3 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
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 cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// getCmd represents the get command | ||
var deleteCmd = &cobra.Command{ | ||
Use: "delete", | ||
Aliases: []string{"del"}, | ||
Short: "Get lets you fetch a list or a specific named object.", | ||
} | ||
|
||
func init() { | ||
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,34 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cedi/kkpctl/pkg/client" | ||
"github.com/pkg/errors" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// delProjectsCmd represents the projects command | ||
var delProjectsCmd = &cobra.Command{ | ||
Use: "project [projectid]", | ||
Short: "Delete a project.", | ||
Args: cobra.ExactArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
kkp, err := client.NewClient(baseURL, apiToken) | ||
if err != nil { | ||
return errors.New("Could not initialize Kubermatic API client") | ||
} | ||
|
||
err = kkp.DeleteProject(args[0]) | ||
if err != nil { | ||
return errors.Wrap(err, "Error fetching project") | ||
} | ||
|
||
fmt.Printf("Successfully deleted Project %s", args[0]) | ||
return nil | ||
}, | ||
} | ||
|
||
func init() { | ||
deleteCmd.AddCommand(delProjectsCmd) | ||
} |
File renamed without changes.