cloud

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: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Catch-all for unrecognized status codes
	StatusUnknown = CloudStatus(iota)

	//StatusPending indicates that it is not yet clear if the instance
	//has been successfullly started or not (e.g., pending spot request)
	StatusPending

	//StatusInitializing means the instance request has been successfully
	//fulfilled, but it's not yet done booting up
	StatusInitializing

	//StatusFailed indicates that an attempt to start the instance has failed;
	//Could be due to billing, lack of capacity, etc.
	StatusFailed

	//StatusRunning means the machine is done booting, and active
	StatusRunning

	StatusStopped
	StatusTerminated
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudHost

type CloudHost struct {
	Host     *host.Host
	KeyPath  string
	CloudMgr CloudManager
}

CloudHost is a provider-agnostic host object that delegates methods like status checks, ssh options, DNS name checks, termination, etc. to the underlying provider's implementation.

func (*CloudHost) GetDNSName

func (cloudHost *CloudHost) GetDNSName() (string, error)

func (*CloudHost) GetInstanceStatus

func (cloudHost *CloudHost) GetInstanceStatus() (CloudStatus, error)

func (*CloudHost) GetSSHOptions

func (cloudHost *CloudHost) GetSSHOptions() ([]string, error)

func (*CloudHost) IsSSHReachable

func (cloudHost *CloudHost) IsSSHReachable() (bool, error)

func (*CloudHost) IsUp

func (cloudHost *CloudHost) IsUp() (bool, error)

func (*CloudHost) TerminateInstance

func (cloudHost *CloudHost) TerminateInstance() error

type CloudManager

type CloudManager interface {
	// Returns a pointer to the manager's configuration settings struct
	GetSettings() ProviderSettings

	//Load credentials or other settings from the config file
	Configure(*evergreen.Settings) error

	// SpawnInstance attempts to create a new host by requesting one from the
	// provider's API.
	SpawnInstance(*distro.Distro, string, bool) (*host.Host, error)

	// CanSpawn indicates if this provider is capable of creating new instances
	// with SpawnInstance(). If this provider doesn't support spawning new
	// hosts, this will return false (and calls to SpawnInstance will
	// return errors)
	CanSpawn() (bool, error)

	// get the status of an instance
	GetInstanceStatus(*host.Host) (CloudStatus, error)

	// TerminateInstances destroys the host in the underlying provider
	TerminateInstance(*host.Host) error

	//IsUp returns true if the underlying provider has not destroyed the
	//host (in other words, if the host "should" be reachable. This does not
	//necessarily mean that the host actually *is* reachable via SSH
	IsUp(*host.Host) (bool, error)

	//Called by the hostinit process when the host is actually up. Used
	//to set additional provider-specific metadata
	OnUp(*host.Host) error

	//IsSSHReachable returns true if the host can successfully
	//accept and run an ssh command.
	IsSSHReachable(host *host.Host, keyPath string) (bool, error)

	// GetDNSName returns the DNS name of a host.
	GetDNSName(*host.Host) (string, error)

	// GetSSHOptions generates the command line args to be passed to ssh to
	// allow connection to the machine
	GetSSHOptions(host *host.Host, keyName string) ([]string, error)

	// TimeTilNextPayment returns how long there is until the next payment
	// is due for a particular host
	TimeTilNextPayment(host *host.Host) time.Duration
}

CloudManager is an interface which handles creating new hosts or modifying them via some third-party API.

type CloudStatus

type CloudStatus int

func (CloudStatus) String

func (stat CloudStatus) String() string

type ProviderSettings

type ProviderSettings interface {
	Validate() error
}

ProviderSettings exposes provider-specific configuration settings for a CloudManager.

Directories

Path Synopsis
ec2

Jump to

Keyboard shortcuts

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