Documentation
¶
Index ¶
- Constants
- Variables
- func EngineInstallURLFlagSet(flags DriverOptions) bool
- func EngineInstallURLSet(url string) bool
- func MachineInState(d Driver, desiredState state.State) func() bool
- func MustBeRunning(d Driver) error
- type BaseDriver
- func (d *BaseDriver) DriverName() string
- func (d *BaseDriver) GetIP() (string, error)
- func (d *BaseDriver) GetMachineName() string
- func (d *BaseDriver) GetSSHKeyPath() string
- func (d *BaseDriver) GetSSHPort() (int, error)
- func (d *BaseDriver) GetSSHUsername() string
- func (d *BaseDriver) PreCreateCheck() error
- func (d *BaseDriver) ResolveStorePath(file string) string
- func (d *BaseDriver) SetSwarmConfigFromFlags(flags DriverOptions)
- type Driver
- type DriverOptions
Constants ¶
const ( DefaultSSHUser = "root" DefaultSSHPort = 22 DefaultEngineInstallURL = "https://get.docker.com" )
Variables ¶
var ErrHostIsNotRunning = errors.New("Host is not running")
Functions ¶
func EngineInstallURLFlagSet ¶
func EngineInstallURLFlagSet(flags DriverOptions) bool
func EngineInstallURLSet ¶
func MustBeRunning ¶
MustBeRunning will return an error if the machine is not in a running state.
Types ¶
type BaseDriver ¶
type BaseDriver struct {
IPAddress string
MachineName string
SSHUser string
SSHPort int
SSHKeyPath string
StorePath string
SwarmMaster bool
SwarmHost string
SwarmDiscovery string
}
BaseDriver - Embed this struct into drivers to provide the common set of fields and functions.
func (*BaseDriver) DriverName ¶
func (d *BaseDriver) DriverName() string
DriverName returns the name of the driver
func (*BaseDriver) GetMachineName ¶
func (d *BaseDriver) GetMachineName() string
GetMachineName returns the machine name
func (*BaseDriver) GetSSHKeyPath ¶
func (d *BaseDriver) GetSSHKeyPath() string
GetSSHKeyPath returns the ssh key path
func (*BaseDriver) GetSSHPort ¶
func (d *BaseDriver) GetSSHPort() (int, error)
GetSSHPort returns the ssh port, 22 if not specified
func (*BaseDriver) GetSSHUsername ¶
func (d *BaseDriver) GetSSHUsername() string
GetSSHUsername returns the ssh user name, root if not specified
func (*BaseDriver) PreCreateCheck ¶
func (d *BaseDriver) PreCreateCheck() error
PreCreateCheck is called to enforce pre-creation steps
func (*BaseDriver) ResolveStorePath ¶
func (d *BaseDriver) ResolveStorePath(file string) string
ResolveStorePath returns the store path where the machine is
func (*BaseDriver) SetSwarmConfigFromFlags ¶
func (d *BaseDriver) SetSwarmConfigFromFlags(flags DriverOptions)
SetSwarmConfigFromFlags configures the driver for swarm
type Driver ¶
type Driver interface {
// Create a host using the driver's config
Create() error
// DriverName returns the name of the driver
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
// 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
// Start a host
Start() error
// Stop a host gracefully
Stop() error
// List VMs
List() (string, 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)