Help us shape the future of Go! Take the 2026 Go Developer Survey

aws

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 22 Imported by: 3

Documentation

Index

Constants

View Source
const (
	GlobalRegion  string = "global"
	DefaultRegion string = "us-east-1"
)

Variables

View Source
var GovCloudRegions = []string{
	"us-gov-east-1",
	"us-gov-west-1",
}

GovCloudRegions contains all of the U.S. GovCloud regions. In accounts with GovCloud enabled, these are the only available regions.

View Source
var OptInNotRequiredRegions = []string{
	"eu-north-1",
	"ap-south-1",
	"eu-west-3",
	"eu-west-2",
	"eu-west-1",
	"ap-northeast-3",
	"ap-northeast-2",
	"ap-northeast-1",
	"sa-east-1",
	"ca-central-1",
	"ap-southeast-1",
	"ap-southeast-2",
	"eu-central-1",
	"us-east-1",
	"us-east-2",
	"us-west-1",
	"us-west-2",
	"cn-north-1",
	"cn-northwest-1",
}

OptInNotRequiredRegions contains all regions that are enabled by default on new AWS accounts Beginning in Spring 2019, AWS requires new regions to be explicitly enabled See https://aws.amazon.com/blogs/security/setting-permissions-to-enable-accounts-for-upcoming-aws-regions/

Functions

func GetAllRegisteredResources added in v0.33.0

func GetAllRegisteredResources() []*resources.AwsResource

GetAllRegisteredResources - returns a list of all registered resources without initialization. This is useful for listing all resources without initializing them.

func GetAndInitRegisteredResources added in v0.33.0

func GetAndInitRegisteredResources(session aws.Config, region string) []*resources.AwsResource

GetAndInitRegisteredResources - returns a list of all registered resources with initialization.

func GetEnabledRegions added in v0.1.8

func GetEnabledRegions() ([]string, error)

GetEnabledRegions - Get all regions that are enabled (DescribeRegions excludes those not enabled by default)

func GetTargetRegions added in v0.1.11

func GetTargetRegions(enabledRegions []string, selectedRegions []string, excludedRegions []string) ([]string, error)

GetTargetRegions - Used enabled, selected and excluded regions to create a final list of valid regions

func HandleResourceTypeSelections added in v0.11.7

func HandleResourceTypeSelections(
	includeResourceTypes, excludeResourceTypes []string,
) ([]string, error)

HandleResourceTypeSelections accepts a slice of target resourceTypes and a slice of resourceTypes to exclude. It filters any excluded or invalid types from target resourceTypes then returns the filtered slice

func IsNukeable added in v0.1.9

func IsNukeable(resourceType string, resourceTypes []string) bool

IsNukeable - Checks if we should nuke a resource or not

func IsValidResourceType added in v0.1.9

func IsValidResourceType(resourceType string, allResourceTypes []string) bool

IsValidResourceType - Checks if a resourceType is valid or not

func ListResourceTypes added in v0.1.9

func ListResourceTypes() []string

ListResourceTypes - Returns list of resources which can be passed to --resource-type

func NewSession added in v0.33.0

func NewSession(region string) (aws.Config, error)

func NukeAllResources

func NukeAllResources(ctx context.Context, account *AwsAccountResources, regions []string, parallelism int, collector *reporting.Collector) error

NukeAllResources - Nukes all aws resources

Types

type AwsAccountResources

type AwsAccountResources struct {
	Resources map[string]AwsResources
}

AwsAccountResources is a struct that represents the resources found in a single AWS account

func GetAllResources

func GetAllResources(c context.Context, query *Query, configObj config.Config, collector *reporting.Collector) (*AwsAccountResources, error)

GetAllResources - Lists all aws resources

func (*AwsAccountResources) GetRegion added in v0.11.7

func (a *AwsAccountResources) GetRegion(region string) AwsResources

func (*AwsAccountResources) TotalResourceCount added in v0.22.0

func (a *AwsAccountResources) TotalResourceCount() int

TotalResourceCount returns the number of resources found, that are eligible for nuking, across all AWS regions targeted In other words, if you have 3 nukeable resources in us-east-1 and 4 nukeable resources in ap-southeast-1, this function would return 7

type AwsResources

type AwsResources struct {
	Resources []*resources.AwsResource
}

AwsResources is a struct to hold multiple instances of AwsResource.

func (*AwsResources) CountOfResourceType added in v0.34.0

func (arr *AwsResources) CountOfResourceType(resourceType string) int

CountOfResourceType is a convenience method that returns the number of the supplied resource type found in the AwsResources

func (*AwsResources) IdentifiersForResourceType added in v0.34.0

func (arr *AwsResources) IdentifiersForResourceType(resourceType string) []string

IdentifiersForResourceType is a convenience method that returns the list of resource identifiers for a given resource type, if available

func (*AwsResources) MapResourceTypeToIdentifiers added in v0.34.0

func (arr *AwsResources) MapResourceTypeToIdentifiers() map[string][]string

MapResourceTypeToIdentifiers converts a slice of Resources to a map of resource types to their found identifiers For example: ["ec2"] = ["i-0b22a22eec53b9321", "i-0e22a22yec53b9456"]

func (*AwsResources) ResourceTypePresent added in v0.34.0

func (arr *AwsResources) ResourceTypePresent(resourceType string) bool

ResourceTypePresent is a convenience method that returns true, if the given resource is found in the AwsResources, or false if it is not

type CouldNotDetermineEnabledRegionsError added in v0.11.7

type CouldNotDetermineEnabledRegionsError struct {
	Underlying error
}

func (CouldNotDetermineEnabledRegionsError) Error added in v0.11.7

type CouldNotSelectRegionError added in v0.11.7

type CouldNotSelectRegionError struct {
	Underlying error
}

func (CouldNotSelectRegionError) Error added in v0.11.7

func (err CouldNotSelectRegionError) Error() string

type InvalidResourceTypesSuppliedError added in v0.11.7

type InvalidResourceTypesSuppliedError struct {
	InvalidTypes []string
}

func (InvalidResourceTypesSuppliedError) Error added in v0.11.7

type InvalidTimeStringPassedError added in v0.11.7

type InvalidTimeStringPassedError struct {
	Entry      string
	Underlying error
}

func (InvalidTimeStringPassedError) Error added in v0.11.7

type Query added in v0.11.7

type Query struct {
	Regions              []string
	ExcludeRegions       []string
	ResourceTypes        []string
	ExcludeResourceTypes []string
	ExcludeAfter         *time.Time
	IncludeAfter         *time.Time
	ListUnaliasedKMSKeys bool
	Timeout              *time.Duration
	ExcludeFirstSeen     bool
	DefaultOnly          bool
	IncludeTags          map[string]config.Expression
	Parallelism          int
}

Query is a struct that represents the desired parameters for scanning resources within a given account

func (*Query) Validate added in v0.11.7

func (q *Query) Validate() error

Validate ensures the configured values for a Query are valid, returning an error if there are any invalid params, or nil if the Query is valid

type QueryCreationError added in v0.11.7

type QueryCreationError struct {
	Underlying error
}

func (QueryCreationError) Error added in v0.11.7

func (err QueryCreationError) Error() string

type ResourceInspectionError added in v0.11.7

type ResourceInspectionError struct {
	Underlying error
}

func (ResourceInspectionError) Error added in v0.11.7

func (err ResourceInspectionError) Error() string

type ResourceTypeAndExcludeFlagsBothPassedError added in v0.11.7

type ResourceTypeAndExcludeFlagsBothPassedError struct{}

func (ResourceTypeAndExcludeFlagsBothPassedError) Error added in v0.11.7

Directories

Path Synopsis
Package resources provides AWS resource implementations for cloud-nuke.
Package resources provides AWS resource implementations for cloud-nuke.

Jump to

Keyboard shortcuts

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