cmd

package
v1.4.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

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)
)
View Source
var (
	BuildVersion     = "unknown"
	BuildDate        = "unknown"
	BuildHash        = "unknown"
	BuildEnvironment = "unknown"
)

Functions

func Log

func Log(region Region, resourceType string, r resources.Resource, c color.Color, msg string)

func NewResourceTypesCommand added in v1.4.0

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 added in v1.4.0

func ResolveResourceTypes(base types.Collection, include, exclude []types.Collection) types.Collection

func Scan

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

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) List added in v1.4.0

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     *NukeConfig

	ResourceTypes types.Collection

	ForceSleep time.Duration
	// contains filtered or unexported fields
}

func NewNuke

func NewNuke(params NukeParameters, account awsutil.Account) *Nuke

func (*Nuke) Filter

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

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][]resources.Resource)

func (*Nuke) Run

func (n *Nuke) Run() error

func (*Nuke) Scan

func (n *Nuke) Scan() error

type NukeConfig

type NukeConfig struct {
	AccountBlacklist []string                     `yaml:"account-blacklist"`
	Regions          []string                     `yaml:"regions"`
	Accounts         map[string]NukeConfigAccount `yaml:"accounts"`
	ResourceTypes    ResourceConfig               `yaml:"resource-types"`
}

func LoadConfig

func LoadConfig(path string) (*NukeConfig, error)

func (*NukeConfig) HasBlacklist

func (c *NukeConfig) HasBlacklist() bool

func (*NukeConfig) InBlacklist

func (c *NukeConfig) InBlacklist(searchID string) bool

func (*NukeConfig) ValidateAccount added in v1.4.0

func (c *NukeConfig) ValidateAccount(accountID string, aliases []string) error

type NukeConfigAccount

type NukeConfigAccount struct {
	Filters       map[string][]string `yaml:"filters"`
	ResourceTypes ResourceConfig      `yaml:"resource-types"`
}

type NukeParameters

type NukeParameters struct {
	ConfigPath string

	Targets  []string
	Excludes []string

	NoDryRun bool
	Force    bool
}

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 added in v1.4.0

type Region struct {
	Name    string
	Session *session.Session
}

type ResourceConfig added in v1.4.0

type ResourceConfig struct {
	Targets  types.Collection `yaml:"targets"`
	Excludes types.Collection `yaml:"excludes"`
}

Jump to

Keyboard shortcuts

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