cmd

package
v2.15.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MIT Imports: 20 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 (
	ColorRegion             = *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(region *Region, 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, include, exclude []types.Collection) types.Collection

func Scan

func Scan(region *Region, resourceTypes []string) <-chan *Item

func Sorted

func Sorted(m map[string]string) string

Format the resource properties in sorted order ready for printing. This ensures that multiple runs of aws-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

	Region *Region
	Type   string
}

An Item describes an actual AWS 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 AWS.

type Nuke

type Nuke struct {
	Parameters NukeParameters
	Account    awsutil.Account
	Config     *config.Nuke

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

func NewNuke

func NewNuke(params NukeParameters, account awsutil.Account) *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

type Region

type Region struct {
	Name            string
	NewSession      SessionFactory
	ResTypeResolver ResourceTypeResolver
	// contains filtered or unexported fields
}

func NewRegion

func NewRegion(name string, typeResolver ResourceTypeResolver, sessionFactory SessionFactory) *Region

func (*Region) Session

func (region *Region) Session(resourceType string) (*session.Session, error)

type ResourceTypeResolver

type ResourceTypeResolver func(regionName, resourceType string) string

ResourceTypeResolver returns the service type from the resourceType

type SessionFactory

type SessionFactory func(regionName, svcType string) (*session.Session, error)

SessionFactory support for custom endpoints

Jump to

Keyboard shortcuts

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