2013-12-13 00:38:34 -05:00
|
|
|
package googlecompute
|
|
|
|
|
|
|
|
// Driver is the interface that has to be implemented to communicate
|
|
|
|
// with GCE. The Driver interface exists mostly to allow a mock implementation
|
|
|
|
// to be used to test the steps.
|
|
|
|
type Driver interface {
|
2013-12-13 22:03:10 -05:00
|
|
|
// CreateImage creates an image with the given URL in Google Storage.
|
|
|
|
CreateImage(name, description, url string) <-chan error
|
|
|
|
|
2013-12-13 22:07:10 -05:00
|
|
|
// DeleteImage deletes the image with the given name.
|
|
|
|
DeleteImage(name string) <-chan error
|
|
|
|
|
2013-12-13 01:34:47 -05:00
|
|
|
// DeleteInstance deletes the given instance.
|
|
|
|
DeleteInstance(zone, name string) (<-chan error, error)
|
|
|
|
|
2013-12-13 16:01:28 -05:00
|
|
|
// GetNatIP gets the NAT IP address for the instance.
|
|
|
|
GetNatIP(zone, name string) (string, error)
|
|
|
|
|
2013-12-13 00:38:34 -05:00
|
|
|
// RunInstance takes the given config and launches an instance.
|
|
|
|
RunInstance(*InstanceConfig) (<-chan error, error)
|
2013-12-13 16:01:28 -05:00
|
|
|
|
|
|
|
// WaitForInstance waits for an instance to reach the given state.
|
|
|
|
WaitForInstance(state, zone, name string) <-chan error
|
2013-12-13 00:38:34 -05:00
|
|
|
}
|
|
|
|
|
2014-08-20 13:20:28 -04:00
|
|
|
type Image struct {
|
|
|
|
Name string
|
|
|
|
ProjectId string
|
|
|
|
}
|
|
|
|
|
2013-12-13 00:38:34 -05:00
|
|
|
type InstanceConfig struct {
|
|
|
|
Description string
|
2014-08-07 15:34:08 -04:00
|
|
|
DiskSizeGb int64
|
2014-08-20 13:20:28 -04:00
|
|
|
Image Image
|
2013-12-13 00:38:34 -05:00
|
|
|
MachineType string
|
|
|
|
Metadata map[string]string
|
|
|
|
Name string
|
|
|
|
Network string
|
|
|
|
Tags []string
|
|
|
|
Zone string
|
|
|
|
}
|