drivers

package
v0.4.0-rc2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ErrExitCode255 = "255"
)

Variables

View Source
var ErrHostIsNotRunning = errors.New("host is not running")

Functions

func GetCreateFlags

func GetCreateFlags() []cli.Flag

GetCreateFlags runs GetCreateFlags for all of the drivers and returns their return values indexed by the driver name

func GetCreateFlagsForDriver added in v0.3.0

func GetCreateFlagsForDriver(name string) ([]cli.Flag, error)

func GetDriverNames

func GetDriverNames() []string

GetDriverNames returns a slice of all registered driver names

func GetSSHClientFromDriver added in v0.3.0

func GetSSHClientFromDriver(d Driver) (ssh.Client, error)

func MachineInState added in v0.2.0

func MachineInState(d Driver, desiredState state.State) func() bool

func Register

func Register(name string, registeredDriver *RegisteredDriver) error

Register a driver

func RunSSHCommandFromDriver added in v0.3.0

func RunSSHCommandFromDriver(d Driver, command string) (string, error)

func WaitForSSH added in v0.3.0

func WaitForSSH(d Driver) error

Types

type BaseDriver added in v0.3.1

type BaseDriver struct {
	IPAddress      string
	SSHUser        string
	SSHPort        int
	MachineName    string
	CaCertPath     string
	PrivateKeyPath string
	SwarmMaster    bool
	SwarmHost      string
	SwarmDiscovery string
	// contains filtered or unexported fields
}

BaseDriver - Embed this struct into drivers to provide the common set of fields and functions.

func NewBaseDriver added in v0.3.1

func NewBaseDriver(machineName string, storePath string, caCert string, privateKey string) *BaseDriver

NewBaseDriver - Get an instance of a BaseDriver

func (*BaseDriver) AuthorizePort added in v0.3.1

func (d *BaseDriver) AuthorizePort(ports []*Port) error

AuthorizePort -

func (*BaseDriver) DeauthorizePort added in v0.3.1

func (d *BaseDriver) DeauthorizePort(ports []*Port) error

DeauthorizePort -

func (*BaseDriver) DriverName added in v0.3.1

func (d *BaseDriver) DriverName() string

DriverName - This must be implemented in every driver

func (*BaseDriver) GetMachineName added in v0.3.1

func (d *BaseDriver) GetMachineName() string

GetMachineName -

func (*BaseDriver) GetSSHKeyPath added in v0.3.1

func (d *BaseDriver) GetSSHKeyPath() string

GetSSHKeyPath -

func (*BaseDriver) GetSSHPort added in v0.3.1

func (d *BaseDriver) GetSSHPort() (int, error)

GetSSHPort -

func (*BaseDriver) GetSSHUsername added in v0.3.1

func (d *BaseDriver) GetSSHUsername() string

GetSSHUsername -

func (*BaseDriver) ResolveStorePath added in v0.3.1

func (d *BaseDriver) ResolveStorePath(path string) string

ResolveStorePath -

type ByFlagName

type ByFlagName []cli.Flag

func (ByFlagName) Len

func (flags ByFlagName) Len() int

func (ByFlagName) Less

func (flags ByFlagName) Less(i, j int) bool

func (ByFlagName) Swap

func (flags ByFlagName) Swap(i, j int)

type Driver

type Driver interface {
	// AuthorizePort authorizes a port for machine access
	AuthorizePort(ports []*Port) error

	// Create a host using the driver's config
	Create() error

	// DeauthorizePort removes a port for machine access
	DeauthorizePort(ports []*Port) error

	// DriverName returns the name of the driver as it is registered
	DriverName() string

	// GetIP returns an IP or hostname that this host is available at
	// e.g. 1.2.3.4 or docker-host-d60b70a14d3a.cloudapp.net
	GetIP() (string, error)

	// GetMachineName returns the name of the machine
	GetMachineName() string

	// GetSSHHostname returns hostname for use with ssh
	GetSSHHostname() (string, error)

	// GetSSHKeyPath returns key path for use with ssh
	GetSSHKeyPath() string

	// GetSSHPort returns port for use with ssh
	GetSSHPort() (int, error)

	// GetSSHUsername returns username for use with ssh
	GetSSHUsername() string

	// GetURL returns a Docker compatible host URL for connecting to this host
	// e.g. tcp://1.2.3.4:2376
	GetURL() (string, error)

	// GetState returns the state that the host is in (running, stopped, etc)
	GetState() (state.State, error)

	// Kill stops a host forcefully
	Kill() error

	// PreCreateCheck allows for pre-create operations to make sure a driver is ready for creation
	PreCreateCheck() error

	// Remove a host
	Remove() error

	// Restart a host. This may just call Stop(); Start() if the provider does not
	// have any special restart behaviour.
	Restart() error

	// SetConfigFromFlags configures the driver with the object that was returned
	// by RegisterCreateFlags
	SetConfigFromFlags(flags DriverOptions) error

	// Start a host
	Start() error

	// Stop a host gracefully
	Stop() error
}

Driver defines how a host is created and controlled. Different types of driver represent different ways hosts can be created (e.g. different hypervisors, different cloud providers)

func NewDriver

func NewDriver(name string, machineName string, storePath string, caCert string, privateKey string) (Driver, error)

NewDriver creates a new driver of type "name"

type DriverOptions

type DriverOptions interface {
	String(key string) string
	StringSlice(key string) []string
	Int(key string) int
	Bool(key string) bool
}

type Port added in v0.2.0

type Port struct {
	Protocol string
	Port     int
}

type RegisteredDriver

type RegisteredDriver struct {
	New            func(machineName string, storePath string, caCert string, privateKey string) (Driver, error)
	GetCreateFlags func() []cli.Flag
}

RegisteredDriver is used to register a driver with the Register function. It has two attributes:

  • New: a function that returns a new driver given a path to store host configuration in
  • RegisterCreateFlags: a function that takes the FlagSet for "docker hosts create" and returns an object to pass to SetConfigFromFlags

Directories

Path Synopsis
amz
this is empty to allow builds on non-windows platforms
this is empty to allow builds on non-windows platforms
Package vmwarefusion is empty to allow builds on non-darwin platforms
Package vmwarefusion is empty to allow builds on non-darwin platforms

Jump to

Keyboard shortcuts

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