Documentation
¶
Index ¶
- Constants
- func BASH(command string) ([]byte, []byte, error)
- func SHELL(name string, sType string, cmdStr string) ([][]byte, error)
- type Auth
- type CMD
- type Connection
- type ContainSnapshot
- type ContainerCPU
- type ContainerMemory
- type ContainerNetwork
- type ContainerOutput
- type ContainerState
- type GoCluster
- func (cu *GoCluster) CreateContainer(auth *Auth, controller bool, name string, cType string, cRelease string, ...) error
- func (cu *GoCluster) CreateImage(cName string, sName string) error
- func (cu *GoCluster) DeleteContainer(cName string) error
- func (cu *GoCluster) DeleteImage(fingerprint string) error
- func (cu *GoCluster) ExportContainer(cName string) (*GoImage, error)
- func (cu *GoCluster) GetContainer(cName string) (*GoContainer, error)
- func (cu *GoCluster) GetContainers() ([]*GoContainer, error)
- func (cu *GoCluster) ImportContainer(containerName string, image *GoImage) (*GoContainer, error)
- func (cu *GoCluster) Scan() ([]*GoContainer, error)
- func (cu *GoCluster) ScanImages() ([]*GoImage, error)
- type GoContainer
- func (co *GoContainer) Boot() error
- func (co *GoContainer) CMD(cmd string, userName string, reErr bool) ([]byte, error)
- func (co *GoContainer) Create() error
- func (co *GoContainer) CreateSnapshot() (string, error)
- func (co *GoContainer) Delete() error
- func (co *GoContainer) DeleteSnapshot(snapName string) error
- func (co *GoContainer) Export() (*GoImage, error)
- func (co *GoContainer) GetSnapshots() ([]*GoSnapshot, error)
- func (co *GoContainer) Image(snapShot string) (*GoImage, error)
- func (co *GoContainer) Import(image *GoImage) error
- func (co *GoContainer) OpenSSH() error
- func (co *GoContainer) Reboot() error
- func (co *GoContainer) Restore(snapName string) error
- func (co *GoContainer) Stop() error
- type GoImage
- type GoSnapshot
- type ImageOutput
- type ImageProperties
- type ImagesOutput
- type LXCConfig
- type ListOutput
- type Network
- type NetworkEntry
- type NetworkOutput
- type SSHClient
- type Shell
Constants ¶
const SRCYAML = `` /* 1046-byte string literal not displayed */
TODO: Build in system for generating cloud init config with proper ssh keys!
const ShellToUse = "bash"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CMD ¶
type CMD struct {
Type string
ScriptName string
Raw string
Args []string
Cmd *exec.Cmd
Status int // 0 - Error, 1 - Initialized, 2 - Executed, 3 - Finished
OutputBytes []byte
}
CMD defines a async os command
type Connection ¶
Connection stores info relating to externally connecting to a GoContainer
func NewConnection ¶
func NewConnection(name string, cType string, port string) *Connection
NewConnection create a pointer to a new Connection
type ContainSnapshot ¶
type ContainSnapshot struct {
Name string `json:"name,omitempty"`
Architecture string `json:"architecture,omitempty"`
Config LXCConfig `json:"config,omitempty"`
LastUsed string `json:"last_used_at,omitempty"`
}
ContainSnapshot
type ContainerMemory ¶
type ContainerMemory struct {
Usage int `json:"usage,omitempty"`
UsagePeak int `json:"usage_peak,omitempty"`
}
ContainerMemory
type ContainerNetwork ¶
type ContainerNetwork struct {
Usage int `json:"usage,omitempty"`
UsagePeak int `json:"usage_peak,omitempty"`
}
ContainerNetwork
type ContainerOutput ¶
type ContainerOutput struct {
Architecture string `json:"architecture,omitempty"`
Config LXCConfig `json:"config,omitempty"`
State ContainerState `json:"state,omitempty"`
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
StatusCode int `json:"status_code,omitempty"`
LastUsed string `json:"last_used_at,omitempty"`
}
ContainerOutput
type ContainerState ¶
type ContainerState struct {
Memory ContainerMemory `json:"memory,omitempty"`
CPU ContainerCPU `json:"cpu,omitempty"`
PID int `json:"pid,omitempty"`
Processes int `json:"processes,omitempty"`
SnapShots []ContainSnapshot `json:"snapshots,omitempty"`
}
ContainerState
type GoCluster ¶
type GoCluster struct {
Name string
Type string
ReverseProxy string
LoadBalancer string
Controller string
Containers []*GoContainer
Images []*GoImage
Network *Network
}
A GoCluster is a deployment of GoContainers
func NewGoCluster ¶
func NewGoCluster(name string, cType string, reverseProxy string, loadBalancer string, controller string) *GoCluster
NewGoCluster creates a pointer to a new GoCluster
func (*GoCluster) CreateContainer ¶
func (cu *GoCluster) CreateContainer(auth *Auth, controller bool, name string, cType string, cRelease string, config []byte) error
CreateContainer create a new GoContainer in the GoCluster
func (*GoCluster) CreateImage ¶
CreateImage an image of a GoCluster's GoContainer
func (*GoCluster) DeleteContainer ¶
DeleteContainer deletes the GoContainer whose name is inputted
func (*GoCluster) DeleteImage ¶
DeleteImage an Image from the GoCluster
func (*GoCluster) ExportContainer ¶
ExportContainer from the GoCluster
func (*GoCluster) GetContainer ¶
func (cu *GoCluster) GetContainer(cName string) (*GoContainer, error)
GetContainer gets a single container back from the GoCluster with GoContainer name as the filter
func (*GoCluster) GetContainers ¶
func (cu *GoCluster) GetContainers() ([]*GoContainer, error)
GetContainers gets all containers for a given GoCluster
func (*GoCluster) ImportContainer ¶
func (cu *GoCluster) ImportContainer(containerName string, image *GoImage) (*GoContainer, error)
ImportContainer into the GoCluster
func (*GoCluster) Scan ¶
func (cu *GoCluster) Scan() ([]*GoContainer, error)
Scan gets each GoContainer in a given GoCluster
func (*GoCluster) ScanImages ¶
ScanImages from a GoCluster
type GoContainer ¶
type GoContainer struct {
Name string
Controller bool
SSHClient *SSHClient
Type string
Release string
Services []string
InitFile []byte
Storage string
Network *Network
Auth *Auth
GoSnapshots []*GoSnapshot
Status string
}
A GoContainer defines the structure of a lxc container
func NewGoContainer ¶
func NewGoContainer(name string, controller bool, cType string, release string, services []string, initFile []byte, storage string, network *Network, auth *Auth) *GoContainer
NewGoContainer creates a pointer to a new GoContainer
func (*GoContainer) CreateSnapshot ¶
func (co *GoContainer) CreateSnapshot() (string, error)
CreateSnapshot creates a new GoSnapshot off an existing GoContainer
func (*GoContainer) Delete ¶
func (co *GoContainer) Delete() error
Delete an existing GoContainer from the GoCluster
func (*GoContainer) DeleteSnapshot ¶
func (co *GoContainer) DeleteSnapshot(snapName string) error
DeleteSnapshot deletes a GoSnapshot
func (*GoContainer) Export ¶
func (co *GoContainer) Export() (*GoImage, error)
Export a GoContainer from the GoCluster
func (*GoContainer) GetSnapshots ¶
func (co *GoContainer) GetSnapshots() ([]*GoSnapshot, error)
GetSnapshots for all containers
func (*GoContainer) Image ¶
func (co *GoContainer) Image(snapShot string) (*GoImage, error)
Image of the GoContainer
func (*GoContainer) Import ¶
func (co *GoContainer) Import(image *GoImage) error
Import a GoContainer into the GoCluster
func (*GoContainer) OpenSSH ¶
func (co *GoContainer) OpenSSH() error
OpenSSH begins an SSHClient session
func (*GoContainer) Reboot ¶
func (co *GoContainer) Reboot() error
Reboot Stops then Boots an online GoContainer
func (*GoContainer) Restore ¶
func (co *GoContainer) Restore(snapName string) error
Restore a GoContainer from a snapshot
type GoImage ¶
type GoImage struct {
Name string
Type string
Fingerprint string
TarMeta []string
Contents [][]byte
DateTime string
}
GoImage represents a GoImage of a GoContainer stored in the cluster
func NewGoImage ¶
NewGoImage loads a new GoImage
type GoSnapshot ¶
GoSnapshot represents a GoContainer's snapshot
func NewGoSnapshot ¶
func NewGoSnapshot(name string, dt string) *GoSnapshot
NewGoSnapshot loads a GoSnapshot
type ImageOutput ¶
type ImageOutput struct {
Public bool `json:"public,omitempty"`
Props ImageProperties `json:"properties,omitempty"`
Filename string `json:"filename,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
Size int `json:"size,omitempty"`
Type string `json:"type,omitempty"`
Created string `json:"created_at,omitempty"`
}
ImageOutput
type ImageProperties ¶
type ImageProperties struct {
Architecture string `json:"architecture,omitempty"`
OSType string `json:"os,omitempty"`
OSRelease string `json:"os_release,omitempty"`
}
ImageProperties
type ImagesOutput ¶
type ImagesOutput struct {
Outputs []ImageOutput `json:"output,omitempty"`
}
ImagesOutput
type LXCConfig ¶
type LXCConfig struct {
ImageArchitecture string `json:"image.architecture,omitempty"`
ImageDescription string `json:"image.description,omitempty"`
ImageOS string `json:"image.os,omitempty"`
ImageRelease string `json:"image.release,omitempty"`
}
LXCConfig
type ListOutput ¶
type ListOutput struct {
Outputs []ContainerOutput `json:"output,omitempty"`
}
ListOutput
func (*ListOutput) GetContainers ¶
func (lo *ListOutput) GetContainers() []*GoContainer
GetContainers
type Network ¶
type Network struct {
PublicIP string
PrivateIP string
HWAddr string
Type string
HostName string
SSL bool
DNS string
Connections []*Connection
}
Network stores the network info for a GoContainer
func (*Network) AddConnection ¶
func (n *Network) AddConnection(conn *Connection)
AddConnection to a Network
func (*Network) LoadEntry ¶
func (n *Network) LoadEntry(nw *NetworkEntry) error
LoadEntry loads a lxc data into a pointer to NetworkEntry struct
type NetworkEntry ¶
type NetworkEntry struct {
Hostname string `json:"hostname,omitempty"`
HWAddr string `json:"hwaddr,omitempty"`
Address string `json:"address,omitempty"`
Type string `json:"type,omitempty"`
Location string `json:"location,omitempty"`
}
NetworkEntry
type NetworkOutput ¶
type NetworkOutput struct {
NetworkEntries []NetworkEntry `json:"network_entries,omitempty"`
}
NetworkOutput
func LoadNetworkOutput ¶
func LoadNetworkOutput(jsonStr string) (*NetworkOutput, error)
LoadNetworkOutput
func (*NetworkOutput) GetContainerEntry ¶
func (nwo *NetworkOutput) GetContainerEntry(containerName string) *Network
GetContainerEntry