autorefresh

package
v0.0.0-...-71a3a44 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2016 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const INSTANCE_MAX_AGE = time.Minute * 120
View Source
const RETRYCOUNT = 10

Variables

View Source
var LOGLEVEL_MAPPING map[string]logrus.Level = map[string]logrus.Level{
	"panic": logrus.PanicLevel,
	"fatal": logrus.FatalLevel,
	"error": logrus.ErrorLevel,
	"warn":  logrus.WarnLevel,
	"info":  logrus.InfoLevel,
	"debug": logrus.DebugLevel,
}

Functions

func CopyMap

func CopyMap(source *map[string]string) map[string]string

func InitLogger

func InitLogger(loglevel string)

func StartEngine

func StartEngine(cs *ConfigStorage)

Types

type Account

type Account struct {
	Name            string
	AccessKeyId     string
	OwnerId         string
	SecretAccessKey string
}

func (*Account) ConnectToRegion

func (self *Account) ConnectToRegion(region string) *ec2.EC2

func (*Account) FindInstances

func (self *Account) FindInstances(config *LaunchConfig) (*[]AutoInstance, error)

func (*Account) LaunchInstance

func (self *Account) LaunchInstance(config *LaunchConfig) (*AutoInstance, error)

type AutoAmi

type AutoAmi struct {
	Id           string
	Region       string
	Architecture string
	Name         string
	State        string
	Description  string
	CreationDate string
	Tags         map[string]string
	Connection   *ec2.EC2
}

func (*AutoAmi) DeleteOldAmi

func (self *AutoAmi) DeleteOldAmi(owner string, retentionCount uint) (deletedImages []*AutoAmi)

func (*AutoAmi) IsAvailable

func (self *AutoAmi) IsAvailable() (bool, error)

func (*AutoAmi) TagImage

func (self *AutoAmi) TagImage() error

func (*AutoAmi) Update

func (self *AutoAmi) Update(image *ec2.Image)

func (*AutoAmi) WaitForAvailableState

func (self *AutoAmi) WaitForAvailableState() error

type AutoInstance

type AutoInstance struct {
	Id         string
	ImageId    string
	LaunchTime time.Time
	State      string
	Tags       map[string]string
	Region     string
	Connection *ec2.EC2
}

func (*AutoInstance) CreateAmi

func (self *AutoInstance) CreateAmi(name string) (*AutoAmi, error)

func (*AutoInstance) IsStopped

func (self *AutoInstance) IsStopped() (bool, error)

func (*AutoInstance) TagInstance

func (self *AutoInstance) TagInstance() error

func (*AutoInstance) Terminate

func (self *AutoInstance) Terminate() error

func (*AutoInstance) Update

func (self *AutoInstance) Update(instance *ec2.Instance)

func (*AutoInstance) WaitForStoppedState

func (self *AutoInstance) WaitForStoppedState() error

type AutoRefreshAmi

type AutoRefreshAmi struct {
	Account        *Account
	LaunchConfig   LaunchConfig
	RetentionCount uint
	Cron           string
	Name           string

	ConfigErrors int
	// contains filtered or unexported fields
}

func (*AutoRefreshAmi) CleanUp

func (self *AutoRefreshAmi) CleanUp()

func (*AutoRefreshAmi) Copy

func (self *AutoRefreshAmi) Copy() AutoRefreshAmi

func (*AutoRefreshAmi) Refresh

func (self *AutoRefreshAmi) Refresh()

func (*AutoRefreshAmi) Validate

func (self *AutoRefreshAmi) Validate() error

type ByTimeReverse

type ByTimeReverse []*ec2.Image

func (ByTimeReverse) Len

func (a ByTimeReverse) Len() int

func (ByTimeReverse) Less

func (a ByTimeReverse) Less(i, j int) bool

func (ByTimeReverse) Swap

func (a ByTimeReverse) Swap(i, j int)

type ConfigStorage

type ConfigStorage struct {
	GoWait       sync.WaitGroup
	ConfigErrors int
	// contains filtered or unexported fields
}

func (*ConfigStorage) ProcessDirectory

func (self *ConfigStorage) ProcessDirectory(path string) error

type EbsVolume

type EbsVolume struct {
	DeviceName          string
	DeleteOnTermination bool
	VolumeSize          int64
	VolumeType          string
}

func (*EbsVolume) Copy

func (self *EbsVolume) Copy() EbsVolume

type LaunchConfig

type LaunchConfig struct {
	UserData     string
	Source       Source
	InstanceType string
	Tags         map[string]string
	Ebs          []EbsVolume
}

func (*LaunchConfig) Copy

func (self *LaunchConfig) Copy() LaunchConfig

type Project

type Project struct {
	Name           string
	InstanceType   string
	Cron           string
	RetentionCount uint
	SourceFilter   Source
	UserData       string
	Account        string
	EbsVolumes     []EbsVolume
	Tags           map[string]string
}

type Source

type Source struct {
	AmiId        string
	Architecture string
	Name         string
	OS           string
	Region       string
	Type         string
	Version      string
}

func (*Source) Copy

func (self *Source) Copy() Source

type UserData

type UserData struct {
	Name string
	Bash string
}

Jump to

Keyboard shortcuts

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