utils

package
v0.0.0-...-4748bbb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFile

func DownloadFile(filepath string, url string) error

DownloadFile downloads the file at the given URL to the local filepath.

func ExitErrorHandler

func ExitErrorHandler(err error)

ExitErrorHandler exits the program with a non-zero exit status if err != nil

func GetInstanceName

func GetInstanceName(i *ec2.Instance) string

GetInstanceName returns the name for an ec2.Instance. If there is no associated name tag, it returns an empty string.

func GetTagValue

func GetTagValue(tags []*ec2.Tag, key string) string

GetTagValue iterates over the tags and returns the value of the given tag if it exists, otherwise ""

func IsSubnetEmpty

func IsSubnetEmpty(subnet *ec2.Subnet) bool

IsSubnetEmpty returns true/false depending on if the subnet is empty. This is tailored to Amazon's implementation where they reserve 5 IP addresses per subnet. So, we will consider the subnet empty if its available IP Addresses is equal to the subnet size minus 5

func RemoveARN

func RemoveARN(s *string) string

func StringSliceContains

func StringSliceContains(slice []string, s string) bool

StringSliceContains returns true if the slice contains the string, otherwise false

func SubnetSize

func SubnetSize(cidr string) (int, error)

SubnetSize calculates the number of addresses in a given CIDR

Types

This section is empty.

Jump to

Keyboard shortcuts

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