Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "networks", Short: "Purge the powervs networks", Long: `Purge the powervs networks! pvsadm purge --help for information `, RunE: func(cmd *cobra.Command, args []string) error { opt := pkg.Options c, err := client.NewClientWithEnv(opt.APIKey, opt.Environment, opt.Debug) if err != nil { return err } pvmclient, err := client.NewPVMClientWithEnv(c, opt.InstanceID, opt.InstanceName, pkg.Options.Environment) if err != nil { return err } klog.Infof("Purging the networks for the instance: %v", pvmclient.InstanceID) networks, err := pvmclient.NetworkClient.GetAllPurgeable(opt.Before, opt.Since, opt.Expr) if err != nil { return fmt.Errorf("failed to get the list of networks: %v", err) } table := utils.NewTable() table.Render(networks, []string{"href"}) if !opt.DryRun && len(networks) != 0 { if opt.NoPrompt || utils.AskYesOrNo(deletePromptMessage) { for _, network := range networks { klog.Infof("Deleting the %s, and ID: %s", *network.Name, *network.NetworkID) err = pvmclient.NetworkClient.Delete(*network.NetworkID) if err != nil { if opt.IgnoreErrors { klog.Infof("error occurred while deleting the network: %v", err) } else { return err } } audit.Log("networks", "delete", pvmclient.InstanceName+":"+*network.Name) } } } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.