awslib

package
v0.0.0-...-a8e4d9d Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoInstancesGive = errors.New("no instances given")
)

Functions

func CreateTag

func CreateTag(instanceId, tagKey, tagValue string) error

add a tag to the given instance

func DetachInstance

func DetachInstance(asName, instanceId string) error

func FilterInstancesByTag

func FilterInstancesByTag(asInstances []*autoscaling.Instance, tag string) ([]*ec2.Instance, error)

given a []autoscaling.Instance and a tag-key, filter instances that have the given tag-key and return a []ec2.Instance or an error

func GetTags

func GetTags(instanceId string) ([]*ec2.TagDescription, error)

func PutMetricData

func PutMetricData(metricName string, value float64) error

func RemoveTag

func RemoveTag(instanceId, tagKey string) error

remove a tag from the given instance

func ScaleAS

func ScaleAS(name string, desired int) error

func TerminateInstance

func TerminateInstance(instanceId string) error

Terminate the given instance

Types

type ASMeta

type ASMeta struct {
	MinSize, MaxSize int                     // stored as "MinSize" and "MaxSize" of the AS
	MinFree, MaxFree int                     // stored as tags "min-free" and "max-free"
	Instances        []*autoscaling.Instance // list of *all* instances
	Healthy          []*autoscaling.Instance // list of instances that are InService and Healthy
}

Instead of maintaing these values as constants, we use the AS itself to store them.

This prevents a situation in where the environments (i.e. dev and alpha) don't agree on the constant values and their watchdogs induce flapping on the shared AS.

func GetASMeta

func GetASMeta(name string) (*ASMeta, error)

Jump to

Keyboard shortcuts

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