libmachine

package
v0.0.0-...-1f8c09f 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: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHostname     = errors.New("Invalid hostname specified")
	ErrUnknownProviderType = errors.New("Unknown hypervisor type")
)

Functions

func ValidateHostName

func ValidateHostName(name string) bool

func WaitForSSH

func WaitForSSH(h *Host) error

Types

type CertPathInfo

type CertPathInfo struct {
	CaCertPath     string
	CaKeyPath      string
	ClientCertPath string
	ClientKeyPath  string
	ServerCertPath string
	ServerKeyPath  string
}

type ErrHostDoesNotExist

type ErrHostDoesNotExist struct {
	Name string
}

func (ErrHostDoesNotExist) Error

func (e ErrHostDoesNotExist) Error() string

type ErrSavingConfig

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

func (ErrSavingConfig) Error

func (e ErrSavingConfig) Error() string

type Filestore

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

func NewFilestore

func NewFilestore(rootPath string, caCert string, privateKey string) *Filestore

func (Filestore) Exists

func (s Filestore) Exists(name string) (bool, error)

func (Filestore) Get

func (s Filestore) Get(name string) (*Host, error)

func (Filestore) GetActive

func (s Filestore) GetActive() (*Host, error)

func (Filestore) GetCACertificatePath

func (s Filestore) GetCACertificatePath() (string, error)

func (Filestore) GetPath

func (s Filestore) GetPath() string

func (Filestore) GetPrivateKeyPath

func (s Filestore) GetPrivateKeyPath() (string, error)

func (Filestore) List

func (s Filestore) List() ([]*Host, error)

func (Filestore) Remove

func (s Filestore) Remove(name string, force bool) error

func (Filestore) Save

func (s Filestore) Save(host *Host) error

type Host

type Host struct {
	ConfigVersion int
	Driver        drivers.Driver
	DriverName    string
	HostOptions   *HostOptions
	Name          string `json:"-"`
	StorePath     string
}

func LoadHost

func LoadHost(name string, StorePath string) (*Host, error)

func MigrateHost

func MigrateHost(h *Host, data []byte) (*Host, error)

func MigrateHostV0ToHostV1

func MigrateHostV0ToHostV1(hostV0 *HostV0) *Host

validates host config and modifies if needed this is used for configuration updates

func NewHost

func NewHost(name, driverName string, hostOptions *HostOptions) (*Host, error)

func (*Host) ConfigureAuth

func (h *Host) ConfigureAuth() error

func (*Host) Create

func (h *Host) Create(name string) error

func (*Host) CreateSSHClient

func (h *Host) CreateSSHClient() (ssh.Client, error)

func (*Host) CreateSSHShell

func (h *Host) CreateSSHShell() error

func (*Host) GetURL

func (h *Host) GetURL() (string, error)

func (*Host) IsActive

func (h *Host) IsActive() (bool, error)

IsActive provides a single method for determining if a host is active based on both the url and if the host is stopped.

func (*Host) Kill

func (h *Host) Kill() error

func (*Host) LoadConfig

func (h *Host) LoadConfig() error

func (*Host) PrintIP

func (h *Host) PrintIP() error

func (*Host) Remove

func (h *Host) Remove(force bool) error

func (*Host) Restart

func (h *Host) Restart() error

func (*Host) RunSSHCommand

func (h *Host) RunSSHCommand(command string) (string, error)

func (*Host) SaveConfig

func (h *Host) SaveConfig() error

func (*Host) Start

func (h *Host) Start() error

func (*Host) Stop

func (h *Host) Stop() error

func (*Host) Upgrade

func (h *Host) Upgrade() error

type HostListItem

type HostListItem struct {
	Name         string
	Active       bool
	DriverName   string
	State        state.State
	URL          string
	SwarmOptions swarm.SwarmOptions
}

func GetHostListItems

func GetHostListItems(hostList []*Host) []HostListItem

type HostMetadata

type HostMetadata struct {
	ConfigVersion int
	DriverName    string
	HostOptions   HostOptions
}

func MigrateHostMetadataV0ToHostMetadataV1

func MigrateHostMetadataV0ToHostMetadataV1(m *HostMetadataV0) *HostMetadata

fills nested host metadata and modifies if needed this is used for configuration updates

type HostMetadataV0

type HostMetadataV0 struct {
	HostOptions HostOptions
	DriverName  string

	StorePath      string
	CaCertPath     string
	PrivateKeyPath string
	ServerCertPath string
	ServerKeyPath  string
	ClientCertPath string
}

type HostOptions

type HostOptions struct {
	Driver        string
	Memory        int
	Disk          int
	EngineOptions *engine.EngineOptions
	SwarmOptions  *swarm.SwarmOptions
	AuthOptions   *auth.AuthOptions
}

type HostV0

type HostV0 struct {
	Name          string `json:"-"`
	Driver        drivers.Driver
	DriverName    string
	ConfigVersion int
	HostOptions   *HostOptions

	StorePath      string
	CaCertPath     string
	PrivateKeyPath string
	ServerCertPath string
	ServerKeyPath  string
	ClientCertPath string
	SwarmHost      string
	SwarmMaster    bool
	SwarmDiscovery string
	ClientKeyPath  string
}

type Provider

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

func New

func New(store Store) (*Provider, error)

func (*Provider) Create

func (provider *Provider) Create(name string, driverName string, hostOptions *HostOptions, driverConfig drivers.DriverOptions) (*Host, error)

func (*Provider) Exists

func (provider *Provider) Exists(name string) (bool, error)

func (*Provider) Get

func (provider *Provider) Get(name string) (*Host, error)

func (*Provider) GetActive

func (provider *Provider) GetActive() (*Host, error)

func (*Provider) List

func (provider *Provider) List() ([]*Host, error)

func (*Provider) Remove

func (provider *Provider) Remove(name string, force bool) error

type Store

type Store interface {
	// Exists returns whether a machine exists or not
	Exists(name string) (bool, error)
	// GetActive returns the active host
	GetActive() (*Host, error)
	// GetPath returns the path to the store
	GetPath() string
	// GetCACertPath returns the CA certificate
	GetCACertificatePath() (string, error)
	// GetPrivateKeyPath returns the private key
	GetPrivateKeyPath() (string, error)
	// List returns a list of hosts
	List() ([]*Host, error)
	// Load loads a host by name
	Get(name string) (*Host, error)
	// Remove removes a machine from the store
	Remove(name string, force bool) error
	// Save persists a machine in the store
	Save(host *Host) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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