Documentation
¶
Index ¶
- Variables
- func GetSSHClientFromDriver(d Driver) (ssh.Client, error)
- func MachineInState(d Driver, desiredState state.State) func() bool
- func RunSSHCommandFromDriver(d Driver, command string) (string, error)
- func WaitForSSH(d Driver) error
- type BaseDriver
- type Driver
- type DriverOptions
- type DriverOptionsMock
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHostIsNotRunning = errors.New("Host is not running")
Functions ¶
func RunSSHCommandFromDriver ¶
func WaitForSSH ¶
Types ¶
type BaseDriver ¶
type BaseDriver struct {
IPAddress string
SSHUser string
SSHPort int
MachineName string
SwarmMaster bool
SwarmHost string
SwarmDiscovery string
StorePath 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 - This must be implemented in every driver
func (*BaseDriver) ResolveStorePath ¶
func (d *BaseDriver) ResolveStorePath(file string) string
ResolveStorePath -
type Driver ¶
type Driver interface {
// Create a host using the driver's config
Create() 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
// GetCreateFlags returns the mcnflag.Flag slice representing the flags
// that can be set, their descriptions and defaults.
GetCreateFlags() []mcnflag.Flag
// SetConfigFromFlags configures the driver with the object that was returned
// by RegisterCreateFlags
SetConfigFromFlags(opts 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)
type DriverOptions ¶
type DriverOptionsMock ¶
type DriverOptionsMock struct {
Data map[string]interface{}
}
func (DriverOptionsMock) Bool ¶
func (d DriverOptionsMock) Bool(key string) bool
func (DriverOptionsMock) Int ¶
func (d DriverOptionsMock) Int(key string) int
func (DriverOptionsMock) String ¶
func (d DriverOptionsMock) String(key string) string
func (DriverOptionsMock) StringSlice ¶
func (d DriverOptionsMock) StringSlice(key string) []string
Click to show internal directories.
Click to hide internal directories.