Documentation
¶
Index ¶
- type GcloudAccessConfig
- type GcloudDisk
- type GcloudHost
- func (g GcloudHost) CreateServer(namespace, zone, name, machineType, sourceImage, source string) (Instance, error)
- func (g GcloudHost) DeleteServer(namespace, zone, name string) error
- func (g GcloudHost) GetServer(project, zone, name string) (Instance, error)
- func (g GcloudHost) GetServers(namespace string) ([]Instance, error)
- type GcloudInstance
- type GcloudNetworkInterface
- type GcloudServiceAccounts
- type HostProvider
- type Instance
- type InstanceTemplate
- type LocalHost
- func (l LocalHost) CreateServer(namespace, zone, name, machineType, sourceImage, source string) (Instance, error)
- func (l LocalHost) DeleteServer(namespace, zone, name string) error
- func (l LocalHost) GetServer(project, zone, name string) (Instance, error)
- func (l LocalHost) GetServers(namespace string) ([]Instance, error)
- type LocalInstance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GcloudAccessConfig ¶
type GcloudAccessConfig struct {
Kind string `json:"kind"`
AccessType string `json:"type"`
Name string `json:"name"`
NatIP string `json:"natIP"`
}
GcloudAccessConfig is a nested struct for network access data
type GcloudDisk ¶
type GcloudDisk struct {
Kind string `json:"kind"`
Index int `json:"index"`
DiskType string `json:"type"`
Mode string `json:"mode"`
Source string `json:"source"`
DeviceName string `json:"deviceName"`
Boot bool `json:"boot"`
InitializeParams struct {
DiskName string `json:"diskName"`
SourceImage string `json:"sourceImage"`
DiskSizeGb uint64 `json:"diskSizeGb"`
DiskType string `json:"diskType"`
} `json:"initializeParams"`
AutoDelete bool `json:"autoDelete"`
Licenses []string `json:"licenses"`
DiskInterface string `json:"interface"`
}
GcloudDisk is a struct for data about an instances disk(s)
type GcloudHost ¶
type GcloudHost struct {
HostProvider
Project string
Zones []string
Instances []*GcloudInstance
Client *http.Client
}
GcloudHost is the HostProvider struct for gcloud, used to control instances on GCE
func NewGcloud ¶
func NewGcloud(p, jsonFile string) *GcloudHost
NewGcloud returns a new GCE HostProvider
func (GcloudHost) CreateServer ¶
func (g GcloudHost) CreateServer(namespace, zone, name, machineType, sourceImage, source string) (Instance, error)
CreateServer will send a POST to the GCE api to create an instance
func (GcloudHost) DeleteServer ¶
func (g GcloudHost) DeleteServer(namespace, zone, name string) error
DeleteServer will send GCE a DELETE to delete a specific instance
func (GcloudHost) GetServer ¶
func (g GcloudHost) GetServer(project, zone, name string) (Instance, error)
GetServer returns a specific server on GCE
func (GcloudHost) GetServers ¶
func (g GcloudHost) GetServers(namespace string) ([]Instance, error)
GetServers returns a slice of servers in GCE
type GcloudInstance ¶
type GcloudInstance struct {
Instance
Kind string `json:"kind"`
ID uint64 `json:"id"`
CreationTimestamp string `json:"creationTimestamp"`
Zone string `json:"zone"`
Status string `json:"status"`
StatusMessage string `json:"statusMessage"`
Name string `json:"name"`
Description string `json:"description"`
Tags struct {
Items []string `json:"items"`
Fingerprint []byte `json:"fingerprint"`
} `json:"tags"`
MachineType string `json:"machineType"`
CanIPForward bool `json:"canIpForward"`
NetworkInterfaces []GcloudNetworkInterface `json:"networkInterfaces"`
Disks []GcloudDisk `json:"disks"`
Metadata struct {
Kind string `json:"kind"`
Fingerprint []byte `json:"fingerPrint"`
Items []struct {
Key string `json:"key"`
Value string `json:"value"`
} `json:"items"`
} `json:"metaData"`
ServiceAccounts []GcloudServiceAccounts `json:"serviceAccounts"`
SelfLink string `json:"selfLink"`
Scheduling struct {
OnHostMaintenance string `json:"onHostMaintenance"`
AutomaticRestart bool `json:"automaticRestart"`
Preemptible bool `json:"preemptible"`
} `json:"scheduling"`
CPUPlatform string `json:"cpuPlatform"`
}
GcloudInstance is the outer most struct for GCE instance data
func NewGCEInstance ¶
func NewGCEInstance() *GcloudInstance
NewGCEInstance returns a new GceInstance struct
func (GcloudInstance) GetInternalIP ¶
func (g GcloudInstance) GetInternalIP() string
GetInternalIP returns the internal IP of its instance
type GcloudNetworkInterface ¶
type GcloudNetworkInterface struct {
Network string `json:"network"`
NetworkIP string `json:"networkIP"`
Name string `json:"name"`
AccessConfigs []GcloudAccessConfig `json:"accessConfigs"`
}
GcloudNetworkInterface is a nested struct for network access data
type GcloudServiceAccounts ¶
GcloudServiceAccounts is a struct for GCE service account data
type HostProvider ¶
type HostProvider interface {
// GetServers returns a slice of instances
GetServers(namespace string) ([]Instance, error)
// GetServer returns a specific instance
GetServer(project, zone, name string) (Instance, error)
// CreateServer creates an instance for the platform
CreateServer(namespace, zone, name, machineType, sourceImage, source string) (Instance, error)
// DeleteServer deletes an instance for the platform
DeleteServer(namespace, zone, name string) error
}
HostProvider is the interface for HostProviders for each platform to control instances on the platform
type Instance ¶
type Instance interface {
// GetInternalIP returns a string of the instance's internal IP
GetInternalIP() string
}
Instance is an interface for a platform's instances
type InstanceTemplate ¶
type InstanceTemplate struct {
Name string `json:"name"`
MachineType string `json:"machineType"`
SourceImage string `json:"sourceImage"`
Source string `json:"source"`
}
InstanceTemplate is a struct for request data to create a server
type LocalHost ¶
type LocalHost struct {
HostProvider
Instances []Instance
}
LocalHost controls Instances for the "local" platform
func (LocalHost) CreateServer ¶
func (l LocalHost) CreateServer(namespace, zone, name, machineType, sourceImage, source string) (Instance, error)
CreateServer creates a new server
func (LocalHost) DeleteServer ¶
DeleteServer will delete a registered server i.e. kill a process