ec2

package
v0.0.0-...-900fa13 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2015 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EC2StatusPending      = "pending"
	EC2StatusRunning      = "running"
	EC2StatusShuttingdown = "shutting-down"
	EC2StatusTerminated   = "terminated"
	EC2StatusStopped      = "stopped"
)

Valid values for EC2 instance states: pending | running | shutting-down | terminated | stopping | stopped see http://goo.gl/3OrCGn

View Source
const (
	OnDemandProviderName = "ec2"
	SpotProviderName     = "ec2-spot"
	NameTimeFormat       = "20060102150405"
)
View Source
const (
	SpotStatusOpen      = "open"
	SpotStatusActive    = "active"
	SpotStatusClosed    = "closed"
	SpotStatusCancelled = "cancelled"
	SpotStatusFailed    = "failed"

	EC2ErrorSpotRequestNotFound = "InvalidSpotInstanceRequestID.NotFound"
)

Variables

View Source
var (
	// bson fields for the EC2ProviderSettings struct
	AMIKey           = bsonutil.MustHaveTag(EC2ProviderSettings{}, "AMI")
	InstanceTypeKey  = bsonutil.MustHaveTag(EC2ProviderSettings{}, "InstanceType")
	SecurityGroupKey = bsonutil.MustHaveTag(EC2ProviderSettings{}, "SecurityGroup")
	KeyNameKey       = bsonutil.MustHaveTag(EC2ProviderSettings{}, "KeyName")
	MountPointsKey   = bsonutil.MustHaveTag(EC2ProviderSettings{}, "MountPoints")
)
View Source
var (
	// bson fields for the MountPoint struct
	VirtualNameKey = bsonutil.MustHaveTag(MountPoint{}, "VirtualName")
	DeviceNameKey  = bsonutil.MustHaveTag(MountPoint{}, "DeviceName")
	SizeKey        = bsonutil.MustHaveTag(MountPoint{}, "Size")
)
View Source
var (
	// bson fields for the EC2SpotSettings struct
	BidPriceKey = bsonutil.MustHaveTag(EC2SpotSettings{}, "BidPrice")
)

Functions

This section is empty.

Types

type EC2Manager

type EC2Manager struct {
	// contains filtered or unexported fields
}

EC2Manager implements the CloudManager interface for Amazon EC2

func (*EC2Manager) CanSpawn

func (cloudManager *EC2Manager) CanSpawn() (bool, error)

func (*EC2Manager) Configure

func (cloudManager *EC2Manager) Configure(settings *evergreen.Settings) error

Configure loads necessary credentials or other settings from the global config object.

func (*EC2Manager) GetDNSName

func (cloudManager *EC2Manager) GetDNSName(host *host.Host) (string, error)

func (*EC2Manager) GetInstanceStatus

func (cloudManager *EC2Manager) GetInstanceStatus(host *host.Host) (cloud.CloudStatus, error)

func (*EC2Manager) GetSSHOptions

func (cloudManager *EC2Manager) GetSSHOptions(h *host.Host, keyPath string) ([]string, error)

func (*EC2Manager) GetSettings

func (_ *EC2Manager) GetSettings() cloud.ProviderSettings

func (*EC2Manager) IsSSHReachable

func (cloudManager *EC2Manager) IsSSHReachable(host *host.Host, keyPath string) (bool, error)

func (*EC2Manager) IsUp

func (cloudManager *EC2Manager) IsUp(host *host.Host) (bool, error)

func (*EC2Manager) OnUp

func (cloudManager *EC2Manager) OnUp(host *host.Host) error

func (*EC2Manager) SpawnInstance

func (cloudManager *EC2Manager) SpawnInstance(d *distro.Distro, owner string, userHost bool) (*host.Host, error)

func (*EC2Manager) StopInstance

func (cloudManager *EC2Manager) StopInstance(host *host.Host) error

func (*EC2Manager) TerminateInstance

func (cloudManager *EC2Manager) TerminateInstance(host *host.Host) error

func (*EC2Manager) TimeTilNextPayment

func (cloudManager *EC2Manager) TimeTilNextPayment(host *host.Host) time.Duration

determine how long until a payment is due for the host

type EC2ProviderSettings

type EC2ProviderSettings struct {
	AMI           string       `mapstructure:"ami" json:"ami,omitempty" bson:"ami,omitempty"`
	InstanceType  string       `mapstructure:"instance_type" json:"instance_type,omitempty" bson:"instance_type,omitempty"`
	SecurityGroup string       `mapstructure:"security_group" json:"security_group,omitempty" bson:"security_group,omitempty"`
	KeyName       string       `mapstructure:"key_name" json:"key_name,omitempty" bson:"key_name,omitempty"`
	MountPoints   []MountPoint `mapstructure:"mount_points" json:"mount_points,omitempty" bson:"mount_points,omitempty"`
}

func (*EC2ProviderSettings) Validate

func (self *EC2ProviderSettings) Validate() error

type EC2SpotManager

type EC2SpotManager struct {
	// contains filtered or unexported fields
}

EC2SpotManager implements the CloudManager interface for Amazon EC2 Spot

func (*EC2SpotManager) CanSpawn

func (cloudManager *EC2SpotManager) CanSpawn() (bool, error)

func (*EC2SpotManager) Configure

func (cloudManager *EC2SpotManager) Configure(settings *evergreen.Settings) error

Configure loads necessary credentials or other settings from the global config object.

func (*EC2SpotManager) GetDNSName

func (cloudManager *EC2SpotManager) GetDNSName(host *host.Host) (string, error)

func (*EC2SpotManager) GetInstanceStatus

func (cloudManager *EC2SpotManager) GetInstanceStatus(host *host.Host) (cloud.CloudStatus, error)

GetInstanceStatus returns an mci-universal status code for the status of an ec2 spot-instance host. For unfulfilled spot requests, the behavior is as follows: Spot request open or active, but unfulfilled -> StatusPending Spot request closed or cancelled -> StatusTerminated Spot request failed due to bidding/capacity -> StatusFailed

For a *fulfilled* spot request (the spot request has an instance ID) the status returned will be the status of the instance that fulfilled it, matching the behavior used in cloud/providers/ec2/ec2.go

func (*EC2SpotManager) GetSSHOptions

func (cloudManager *EC2SpotManager) GetSSHOptions(h *host.Host, keyPath string) ([]string, error)

func (*EC2SpotManager) GetSettings

func (_ *EC2SpotManager) GetSettings() cloud.ProviderSettings

func (*EC2SpotManager) IsSSHReachable

func (cloudManager *EC2SpotManager) IsSSHReachable(host *host.Host, keyPath string) (bool, error)

func (*EC2SpotManager) IsUp

func (cloudManager *EC2SpotManager) IsUp(host *host.Host) (bool, error)

func (*EC2SpotManager) OnUp

func (cloudManager *EC2SpotManager) OnUp(host *host.Host) error

func (*EC2SpotManager) SpawnInstance

func (cloudManager *EC2SpotManager) SpawnInstance(d *distro.Distro, owner string, userHost bool) (*host.Host, error)

func (*EC2SpotManager) TerminateInstance

func (cloudManager *EC2SpotManager) TerminateInstance(host *host.Host) error

func (*EC2SpotManager) TimeTilNextPayment

func (cloudManager *EC2SpotManager) TimeTilNextPayment(host *host.Host) time.Duration

determine how long until a payment is due for the host

type EC2SpotSettings

type EC2SpotSettings struct {
	AMI           string       `mapstructure:"ami" json:"ami,omitempty" bson:"ami,omitempty"`
	InstanceType  string       `mapstructure:"instance_type" json:"instance_type,omitempty" bson:"instance_type,omitempty"`
	SecurityGroup string       `mapstructure:"security_group" json:"security_group,omitempty" bson:"security_group,omitempty"`
	KeyName       string       `mapstructure:"key_name" json:"key_name,omitempty" bson:"key_name,omitempty"`
	MountPoints   []MountPoint `mapstructure:"mount_points" json:"mount_points,omitempty" bson:"mount_points,omitempty"`
	BidPrice      float64      `mapstructure:"bid_price" json:"bid_price,omitempty" bson:"bid_price,omitempty"`
}

func (*EC2SpotSettings) Validate

func (self *EC2SpotSettings) Validate() error

type MountPoint

type MountPoint struct {
	VirtualName string `mapstructure:"virtual_name" json:"virtual_name,omitempty" bson:"virtual_name,omitempty"`
	DeviceName  string `mapstructure:"device_name" json:"device_name,omitempty" bson:"device_name,omitempty"`
	Size        int    `mapstructure:"size" json:"size,omitempty" bson:"size,omitempty"`
}

Jump to

Keyboard shortcuts

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