-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from iawia002/cancel-submit
Add unpush subcommand to undo the submission
- Loading branch information
Showing
4 changed files
with
75 additions
and
1 deletion.
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
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,38 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/kubesphere/ksbuilder/pkg/cloud" | ||
) | ||
|
||
type unpushOptions struct{} | ||
|
||
func unpushCmd() *cobra.Command { | ||
o := unpushOptions{} | ||
|
||
return &cobra.Command{ | ||
Use: "unpush", | ||
Short: "Unpush a snapshot of an extension", | ||
Args: cobra.ExactArgs(1), | ||
RunE: o.unpush, | ||
} | ||
} | ||
|
||
func (o *unpushOptions) unpush(_ *cobra.Command, args []string) error { | ||
snapshot := args[0] | ||
fmt.Printf("unpush snapshot %s\n", snapshot) | ||
|
||
client, err := cloud.NewClient() | ||
if err != nil { | ||
return fmt.Errorf("login failed: %v", err) | ||
} | ||
|
||
if err = client.CancelSubmitExtension(snapshot); err != nil { | ||
return err | ||
} | ||
fmt.Printf("Snapshot %s has been unsubmitted and reverted to draft state\n", snapshot) | ||
return nil | ||
} |
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