utils

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwsConfigFromCredentials

func AwsConfigFromCredentials(accessKeyId string, secretAccessKey string, sessionToken string) aws.Config

func CoalesceErr

func CoalesceErr(args ...error) error

func DownloadAllObjects added in v2.9.0

func DownloadAllObjects(client *s3.Client, bucketName string) error

func FileExists

func FileExists(path string) bool

func GetCurrentAccountId

func GetCurrentAccountId(cfg aws.Config) (string, error)

func IndexOf added in v2.7.0

func IndexOf[T comparable](slice []T, searchValue T) int

IndexOf returns the index of a given value in a slice, or -1 if not found

func IsErrorDueToEBSEncryptionByDefault

func IsErrorDueToEBSEncryptionByDefault(err error) bool

func ListAllObjectVersions added in v2.9.0

func ListAllObjectVersions(s3Client *s3.Client, bucketName string) ([]s3types.ObjectIdentifier, error)

func MD5HashBase64 added in v2.9.0

func MD5HashBase64(text string) string

func Min

func Min(a int, b int) int

The Min function returns the smallest of two integers Note: math.Min only works for float64

func RandomHexString

func RandomHexString(length int) string

func RandomString

func RandomString(length int) string

func Remove added in v2.7.0

func Remove(slice []string, index int) []string

Remove removes an element from a slice at a given index

func UploadFile added in v2.9.0

func UploadFile(s3Client *s3.Client, bucketName string, filename string, contents io.Reader) error

func WaitForAndAssumeAWSRole added in v2.5.6

func WaitForAndAssumeAWSRole(awsConnection *aws.Config, roleArn string) error

WaitForAndAssumeAWSRole waits for an AWS role to be assumable (due to eventual consistency) then sets a credentials provider that can be used to assume the role.

func WaitForInstanceToRegisterInSSM added in v2.14.0

func WaitForInstanceToRegisterInSSM(ssmClient *ssm.Client, instanceId string) error

utility function for a single instance

func WaitForInstancesToRegisterInSSM added in v2.14.0

func WaitForInstancesToRegisterInSSM(ssmClient *ssm.Client, instanceIds []string) error

WaitForInstancesToRegisterInSSM waits for a set of instances to be registered in SSM may be slow (60+ seconds)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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