util

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const AWsUnauthorizedError string = "UnauthorizedOperation"
View Source
const (
	AccountIdKey = "accountId"
)
View Source
const AwsDryRunSuccess string = "Request would have succeeded, but DryRun flag is set."
View Source
const (
	// FirstSeenTagKey A tag used to set custom AWS Tags to resources that do not support `created at` timestamp> - EIP & ECS Clusters.
	// This is used in relation to the `--older-than <duration>` filtering that `cloud-nuke` allows.
	// Due to its destructive nature, `cloud-nuke` has been configured not to delete AWS resources without known creation time,
	// and instead tag them with the `firstSeenTagKey`.
	// The next time `cloud-nuke aws --older-than <duration>` is run, it will use the tag to determine if the AWS resource should be deleted or not.
	FirstSeenTagKey = "cloud-nuke-first-seen"
)

Variables

View Source
var ErrContextExecutionTimeout = errors.New("error:EXECUTION_TIMEOUT")
View Source
var ErrDifferentOwner = errors.New("error:DIFFERENT_OWNER")
View Source
var ErrInSufficientPermission = errors.New("error:INSUFFICIENT_PERMISSION")
View Source
var ErrInterfaceIDNotFound = errors.New("error:InterfaceIdNotFound")

Functions

func ConvertAutoScalingTagsToMap added in v0.33.0

func ConvertAutoScalingTagsToMap(tags []*autoscaling.TagDescription) map[string]string

func ConvertEC2TagsToMap added in v0.33.0

func ConvertEC2TagsToMap(tags []*ec2.Tag) map[string]string

func ConvertIAMTagsToMap added in v0.33.0

func ConvertIAMTagsToMap(tags []*iam.Tag) map[string]string

func ConvertRDSTagsToMap added in v0.33.0

func ConvertRDSTagsToMap(tags []*rds.Tag) map[string]string

func ConvertS3TagsToMap added in v0.33.0

func ConvertS3TagsToMap(tags []*s3.Tag) map[string]string

func ConvertStringPtrTagsToMap added in v0.33.0

func ConvertStringPtrTagsToMap(tags map[string]*string) map[string]string

func Difference added in v0.33.0

func Difference(a, b []*string) []*string

Difference returns the elements in `a` that aren't in `b`.

func FormatTimestamp added in v0.33.0

func FormatTimestamp(timestamp time.Time) string

func GetCurrentAccountId added in v0.13.0

func GetCurrentAccountId(session *session.Session) (string, error)

func GetEC2ResourceNameTagValue added in v0.34.0

func GetEC2ResourceNameTagValue(tags []*ec2.Tag) *string

func IsFirstSeenTag added in v0.33.0

func IsFirstSeenTag(key *string) bool

func ParseTimestamp added in v0.33.0

func ParseTimestamp(timestamp *string) (*time.Time, error)

func RemoveNewlines added in v0.34.0

func RemoveNewlines(s string) string

RemoveNewlines will delete all the newlines in a given string, which is useful for making error messages "sit" more nicely within their specified table cells in the terminal

func Split added in v0.33.0

func Split(identifiers []string, limit int) [][]string

func TransformAWSError added in v0.34.0

func TransformAWSError(err error) error

TransformAWSError this function is used to handle AWS errors and mapping them to a custom error message This could be part of a larger error-handling strategy that interacts with AWS services, providing a more human-readable error message for certain conditions ref : https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html

func Truncate added in v0.34.0

func Truncate(s string, maxLen int) string

Truncate accepts a string and a max length. If the max length is less than the string's current length, then only the first maxLen characters of the string are returned

func UniqueID

func UniqueID() string

Returns a unique (ish) id we can attach to resources and tfstate files so they don't conflict with each other Uses base 62 to generate a 6 character string that's unlikely to collide with the handful of tests we run in parallel. Based on code here: http://stackoverflow.com/a/9543797/483528

Types

type ResourceExecutionTimeout added in v0.35.0

type ResourceExecutionTimeout struct {
	Timeout time.Duration
}

func (ResourceExecutionTimeout) Error added in v0.35.0

func (err ResourceExecutionTimeout) Error() string

Jump to

Keyboard shortcuts

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