purge

package
v0.1.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "purge",
	Short: "Purge the PowerVS resources",
	Long: `Purge the PowerVS resources

# Set the API key or feed the --api-key commandline argument
export IBMCLOUD_API_KEY=<IBM_CLOUD_API_KEY>

Examples:
  # Delete all the virtual machines which are created before 4hrs
  pvsadm purge vms --workspace-name upstream-core --before 4h

  # Delete all the virtual machines created since 24hrs
  pvsadm purge vms --workspace-name upstream-core --since 24h

  # Delete all the volumes which aren't assigned to any virtual machines
  pvsadm purge volumes --workspace-name upstream-core

  # Delete all the networks and ignore if any errors during the delete operation
  pvsadm purge networks --workspace-name upstream-core --ignore-errors

  # Delete all the networks along with the instances and their assigned ports
  pvsadm purge networks --workspace-name upstream-core --instances true --ports true

  # Delete all the images without asking any confirmation
  pvsadm purge images --workspace-name upstream-core --no-prompt

  # Delete all the images with debugging logs for IBM cloud APIs
  pvsadm purge images --workspace-name upstream-core --debug

  # Delete all the virtual machines starts with k8s-cluster-
  pvsadm purge vms --workspace-name upstream-core --regexp "^k8s-cluster-.*"

  # List the purgeable candidate virtual machines and exit without deleting
  pvsadm purge vms --workspace-name upstream-core --dry-run

  # Delete all the ssh keys which are created before 12hrs
  pvsadm purge keys --workspace-name upstream-core --before 12h --regexp "^rdr-.*"

  # Delete all the ssh keys starts with rdr-
  pvsadm purge keys --workspace-name upstream-core --regexp "^rdr-.*"
`,
	GroupID: "resource",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {

		root := cmd
		for ; root.HasParent(); root = root.Parent() {
		}
		if err := root.PersistentPreRunE(cmd, args); err != nil {
			return err
		}

		if pkg.Options.Since != 0 && pkg.Options.Before != 0 {
			return fmt.Errorf("--since and --before options can not be set at a time")
		}
		return utils.EnsureWorkspaceIDorNameIsSet(pkg.Options.WorkspaceID, pkg.Options.WorkspaceName)
	},
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL