github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/builder/googlecompute/driver.go (about) 1 package googlecompute 2 3 // Driver is the interface that has to be implemented to communicate 4 // with GCE. The Driver interface exists mostly to allow a mock implementation 5 // to be used to test the steps. 6 type Driver interface { 7 // CreateImage creates an image with the given URL in Google Storage. 8 CreateImage(name, description, url string) <-chan error 9 10 // DeleteImage deletes the image with the given name. 11 DeleteImage(name string) <-chan error 12 13 // DeleteInstance deletes the given instance. 14 DeleteInstance(zone, name string) (<-chan error, error) 15 16 // GetNatIP gets the NAT IP address for the instance. 17 GetNatIP(zone, name string) (string, error) 18 19 // RunInstance takes the given config and launches an instance. 20 RunInstance(*InstanceConfig) (<-chan error, error) 21 22 // WaitForInstance waits for an instance to reach the given state. 23 WaitForInstance(state, zone, name string) <-chan error 24 } 25 26 type Image struct { 27 Name string 28 ProjectId string 29 } 30 31 type InstanceConfig struct { 32 Description string 33 DiskSizeGb int64 34 Image Image 35 MachineType string 36 Metadata map[string]string 37 Name string 38 Network string 39 Tags []string 40 Zone string 41 }