nuke

package
v3.31.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Account registry.Scope = "account"

Account is the resource scope that all resources in AWS Nuke are registered against.

Variables

View Source
var MutateOpts = func(opts interface{}, resourceType string) interface{} {
	o := opts.(*ListerOpts)

	session, err := o.Region.Session(resourceType)
	if err != nil {
		panic(err)
	}

	o.Session = session

	if o.Logger != nil {
		o.Logger = o.Logger.WithField("resource", resourceType)
	} else {
		o.Logger = logrus.WithField("resource", resourceType)
	}

	return o
}

MutateOpts is a function that will be called for each resource type to mutate the options for the scanner based on whatever criteria you want. However, in this case for the aws-nuke tool, it's mutating the opts to create the proper session for the proper region for the resourceType. For example IAM only happens in the global region, not us-east-2.

Functions

This section is empty.

Types

type ListerOpts

type ListerOpts struct {
	Region    *Region
	Session   *session.Session
	AccountID *string
	Logger    *logrus.Entry
}

ListerOpts are the options for the Lister functions of each individual resource. It is passed in as an interface{} so that each implementing tool can define their own options for the lister. Each resource then asserts the type on the interface{} to get the options it needs.

type Prompt

type Prompt struct {
	Parameters *libnuke.Parameters
	Account    *awsutil.Account
}

Prompt struct provides a way to provide a custom prompt to the libnuke library this allows custom data to be available to the Prompt func when it's executed by the libnuke library

func (*Prompt) Prompt

func (p *Prompt) Prompt() error

Prompt is the actual function called by the libnuke process during it's run

type Region

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

Region is an AWS Region with an attached SessionFactory

func NewRegion

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

NewRegion creates a new Region and returns it.

func (*Region) Session

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

Session returns a session for a given resource type for the region it's associated to.

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