config

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Config is the underlying libnuke configuration.
	*config.Config `yaml:",inline"`

	// BypassAliasCheckAccounts is a list of account IDs that will be allowed to bypass the alias check.
	// This is useful for accounts that don't have an alias for a number of reasons, it must be used with a cli
	// flag --no-alias-check to be effective.
	BypassAliasCheckAccounts []string `yaml:"bypass-alias-check-accounts"`

	// FeatureFlags is a collection of feature flags that can be used to enable or disable certain behaviors on
	// resources. This is left over from the AWS Nuke tool and is deprecated. It was left to make the transition to the
	// library and ekristen/aws-nuke@v3 easier for existing users.
	// Deprecated: Use Settings instead. Will be removed in 4.x
	FeatureFlags *FeatureFlags `yaml:"feature-flags"`

	// CustomEndpoints is a collection of custom endpoints that can be used to override the default AWS endpoints.
	CustomEndpoints CustomEndpoints `yaml:"endpoints"`
}

Config is an extended configuration implementation that adds some additional features on top of the libnuke config.

func New

func New(opts config.Options) (*Config, error)

New creates a new extended configuration from a file. This is necessary because we are extended the default libnuke configuration to contain additional attributes that are specific to the AWS Nuke tool.

func (*Config) InBypassAliasCheckAccounts

func (c *Config) InBypassAliasCheckAccounts(accountID string) bool

InBypassAliasCheckAccounts returns true if the specified account ID is in the bypass alias check accounts list.

func (*Config) Load

func (c *Config) Load(path string) error

Load loads a configuration from a file and parses it into a Config struct.

func (*Config) ResolveDeprecatedFeatureFlags

func (c *Config) ResolveDeprecatedFeatureFlags()

ResolveDeprecatedFeatureFlags resolves any deprecated feature flags in the configuration. This converts the legacy feature flags into the new settings format. The feature flags will be deprecated with version 4.x. This was left in place to make the transition to the libnuke library and ekristen/aws-nuke@v3 easier for existing users.

func (*Config) ValidateAccount

func (c *Config) ValidateAccount(accountID string, aliases []string, skipAliasChecks bool) error

ValidateAccount validates the account ID and aliases for the specified account. This will return an error if the account ID is invalid, the account ID is blocklisted, the account doesn't have an alias, the account alias contains the substring 'prod', or the account ID isn't listed in the config.

type CustomEndpoints

type CustomEndpoints []*CustomRegion

CustomEndpoints is a collection of custom region endpoints that can be used to override the default AWS regions

func (CustomEndpoints) GetRegion

func (endpoints CustomEndpoints) GetRegion(region string) *CustomRegion

GetRegion returns the custom region or nil when no such custom endpoints are defined for this region

func (CustomEndpoints) GetURL

func (endpoints CustomEndpoints) GetURL(region, serviceType string) string

GetURL returns the custom region or nil when no such custom endpoints are defined for this region

type CustomRegion

type CustomRegion struct {
	Region                string         `yaml:"region"`
	Services              CustomServices `yaml:"services"`
	TLSInsecureSkipVerify bool           `yaml:"tls_insecure_skip_verify"`
}

CustomRegion is a custom region endpoint that can be used to override the default AWS regions

type CustomService

type CustomService struct {
	Service               string `yaml:"service"`
	URL                   string `yaml:"url"`
	TLSInsecureSkipVerify bool   `yaml:"tls_insecure_skip_verify"`
}

CustomService is a custom service endpoint that can be used to override the default AWS endpoints.

type CustomServices

type CustomServices []*CustomService

CustomServices is a collection of custom service endpoints that can be used to override the default AWS endpoints.

func (CustomServices) GetService

func (services CustomServices) GetService(serviceType string) *CustomService

GetService returns the custom region or nil when no such custom endpoints are defined for this region

type DisableDeletionProtection

type DisableDeletionProtection struct {
	RDSInstance         bool `yaml:"RDSInstance"`
	EC2Instance         bool `yaml:"EC2Instance"`
	CloudformationStack bool `yaml:"CloudformationStack"`
	ELBv2               bool `yaml:"ELBv2"`
	QLDBLedger          bool `yaml:"QLDBLedger"`
}

DisableDeletionProtection is a collection of feature flags that can be used to disable deletion protection for certain resource types. This is left over from the AWS Nuke tool and is deprecated. It was left to make transition to the library and ekristen/aws-nuke@v3 easier for existing users. Deprecated: Use Settings instead. Will be removed in 4.x

type FeatureFlags

type FeatureFlags struct {
	DisableDeletionProtection        DisableDeletionProtection `yaml:"disable-deletion-protection"`
	DisableEC2InstanceStopProtection bool                      `yaml:"disable-ec2-instance-stop-protection"`
	ForceDeleteLightsailAddOns       bool                      `yaml:"force-delete-lightsail-addons"`
}

FeatureFlags is a collection of feature flags that can be used to enable or disable certain features of the nuke This is left over from the AWS Nuke tool and is deprecated. It was left to make the transition to the library and ekristen/aws-nuke@v3 easier for existing users. Deprecated: Use Settings instead. Will be removed in 4.x

Jump to

Keyboard shortcuts

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