github.com/sneal/packer@v0.5.2/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 InstanceConfig struct { 27 Description string 28 Image string 29 MachineType string 30 Metadata map[string]string 31 Name string 32 Network string 33 Tags []string 34 Zone string 35 }