cmd

package
v0.0.0-...-d0e585f Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ScannerParallelQueries = 16

Variables

View Source
var (
	ReasonSkip            = *color.New(color.FgYellow)
	ReasonError           = *color.New(color.FgRed)
	ReasonRemoveTriggered = *color.New(color.FgGreen)
	ReasonWaitPending     = *color.New(color.FgBlue)
	ReasonSuccess         = *color.New(color.FgGreen)
)
View Source
var (
	ColorProject            = *color.New(color.Bold)
	ColorResourceType       = *color.New()
	ColorResourceID         = *color.New(color.Bold)
	ColorResourceProperties = *color.New(color.Italic)
)
View Source
var (
	BuildVersion     = "unknown"
	BuildDate        = "unknown"
	BuildHash        = "unknown"
	BuildEnvironment = "unknown"
)

Functions

func IsTrue

func IsTrue(s string) bool

func Log

func Log(project *gcputil.Project, resourceType string, r resources.Resource, c color.Color, msg string)

func NewResourceTypesCommand

func NewResourceTypesCommand() *cobra.Command

func NewRootCommand

func NewRootCommand() *cobra.Command

func NewVersionCommand

func NewVersionCommand() *cobra.Command

func Prompt

func Prompt(expect string) error

func ResolveResourceTypes

func ResolveResourceTypes(
	base types.Collection, mapping map[string]string,
	include, exclude, cloudControl []types.Collection) types.Collection

func Scan

func Scan(project *gcputil.Project, resourceTypes []string) <-chan *Item

func Sorted

func Sorted(m map[string]string) string

Sorted Format the resource properties in sorted order ready for printing. This ensures that multiple runs of gcp-nuke produce stable output so that they can be compared with each other.

Types

type Item

type Item struct {
	Resource resources.Resource

	State  ItemState
	Reason string

	Project *gcputil.Project
	Type    string
}

An Item describes an actual GCP resource entity with the current state and some metadata.

func (*Item) Equals

func (i *Item) Equals(o resources.Resource) bool

func (*Item) GetProperty

func (i *Item) GetProperty(key string) (string, error)

func (*Item) List

func (i *Item) List() ([]resources.Resource, error)

List gets all resource items of the same resource type like the Item.

func (*Item) Print

func (i *Item) Print()

type ItemState

type ItemState int
const (
	ItemStateNew ItemState = iota
	ItemStatePending
	ItemStateWaiting
	ItemStateFailed
	ItemStateFiltered
	ItemStateFinished
)

States of Items based on the latest request to GCP.

type Nuke

type Nuke struct {
	Parameters NukeParameters
	Creds      *gcputil.Credentials
	Project    *gcputil.Project
	Config     *config.Nuke

	ResourceTypes types.Collection
	// contains filtered or unexported fields
}

func NewNuke

func NewNuke(params NukeParameters, creds *gcputil.Credentials) *Nuke

func (*Nuke) Filter

func (n *Nuke) Filter(item *Item) error

func (*Nuke) HandleQueue

func (n *Nuke) HandleQueue()

func (*Nuke) HandleRemove

func (n *Nuke) HandleRemove(item *Item)

func (*Nuke) HandleWait

func (n *Nuke) HandleWait(item *Item, cache map[string]map[string][]resources.Resource)

func (*Nuke) Run

func (n *Nuke) Run() error

func (*Nuke) Scan

func (n *Nuke) Scan() error

type NukeParameters

type NukeParameters struct {
	ConfigPath string

	Targets  []string
	Excludes []string

	NoDryRun   bool
	Force      bool
	ForceSleep int
	Quiet      bool

	MaxWaitRetries int
}

func (*NukeParameters) Validate

func (p *NukeParameters) Validate() error

type Queue

type Queue []*Item

func (Queue) Count

func (q Queue) Count(states ...ItemState) int

func (Queue) CountTotal

func (q Queue) CountTotal() int

Jump to

Keyboard shortcuts

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