{"modulePath":"github.com/stackpointcloud/packer","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package googlecompute\n\nThe googlecompute package contains a packer.Builder implementation that builds images for Google Compute Engine.\n\n## Constants\n\n```go\nconst BuilderId = \"packer.googlecompute\"\n```\nThe unique ID for this builder.\n\n## Variables\n\n```go\nvar DriverScopes = []string{\"https://www.googleapis.com/auth/compute\", \"https://www.googleapis.com/auth/devstorage.full_control\"}\n```\n\n## Types\n\n```go\ntype Artifact struct {\n\t// contains filtered or unexported fields\n}\n```\nArtifact represents a GCE image as the result of a Packer build.\n\n```go\nfunc (*Artifact) BuilderId() string\n```\nBuilderId returns the builder Id.\n\n```go\nfunc (a *Artifact) Destroy() error\n```\nDestroy destroys the GCE image represented by the artifact.\n\n```go\nfunc (*Artifact) Files() []string\n```\nFiles returns the files represented by the artifact.\n\n```go\nfunc (a *Artifact) Id() string\n```\nId returns the GCE image name.\n\n```go\nfunc (a *Artifact) State(name string) interface{}\n```\n\n```go\nfunc (a *Artifact) String() string\n```\nString returns the string representation of the artifact.\n\n```go\ntype Builder struct {\n\t// contains filtered or unexported fields\n}\n```\nBuilder represents a Packer Builder.\n\n```go\nfunc (b *Builder) Cancel()\n```\nCancel.\n\n```go\nfunc (b *Builder) Prepare(raws ...interface{}) ([]string, error)\n```\nPrepare processes the build configuration parameters.\n\n```go\nfunc (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error)\n```\nRun executes a googlecompute Packer build and returns a packer.Artifact representing a GCE machine image.\n\n```go\ntype Config struct {\n\tcommon.PackerConfig `mapstructure:\",squash\"`\n\tComm                communicator.Config `mapstructure:\",squash\"`\n\n\tAccountFile string `mapstructure:\"account_file\"`\n\tProjectId   string `mapstructure:\"project_id\"`\n\n\tDiskName             string            `mapstructure:\"disk_name\"`\n\tDiskSizeGb           int64             `mapstructure:\"disk_size\"`\n\tDiskType             string            `mapstructure:\"disk_type\"`\n\tImageName            string            `mapstructure:\"image_name\"`\n\tImageDescription     string            `mapstructure:\"image_description\"`\n\tInstanceName         string            `mapstructure:\"instance_name\"`\n\tMachineType          string            `mapstructure:\"machine_type\"`\n\tMetadata             map[string]string `mapstructure:\"metadata\"`\n\tNetwork              string            `mapstructure:\"network\"`\n\tSubnetwork           string            `mapstructure:\"subnetwork\"`\n\tAddress              string            `mapstructure:\"address\"`\n\tPreemptible          bool              `mapstructure:\"preemptible\"`\n\tSourceImage          string            `mapstructure:\"source_image\"`\n\tSourceImageProjectId string            `mapstructure:\"source_image_project_id\"`\n\tRawStateTimeout      string            `mapstructure:\"state_timeout\"`\n\tTags                 []string          `mapstructure:\"tags\"`\n\tUseInternalIP        bool              `mapstructure:\"use_internal_ip\"`\n\tRegion               string            `mapstructure:\"region\"`\n\tZone                 string            `mapstructure:\"zone\"`\n\t// contains filtered or unexported fields\n}\n```\nConfig is the configuration structure for the GCE builder. It stores both the publicly settable state as well as the privately generated state of the config object.\n\n```go\nfunc NewConfig(raws ...interface{}) (*Config, []string, error)\n```\n\n```go\ntype Driver interface {\n\t// ImageExists returns true if the specified image exists. If an error\n\t// occurs calling the API, this method returns false.\n\tImageExists(name string) bool\n\n\t// CreateImage creates an image from the given disk in Google Compute\n\t// Engine.\n\tCreateImage(name, description, zone, disk string) \u003c-chan error\n\n\t// DeleteImage deletes the image with the given name.\n\tDeleteImage(name string) \u003c-chan error\n\n\t// DeleteInstance deletes the given instance, keeping the boot disk.\n\tDeleteInstance(zone, name string) (\u003c-chan error, error)\n\n\t// DeleteDisk deletes the disk with the given name.\n\tDeleteDisk(zone, name string) (\u003c-chan error, error)\n\n\t// GetNatIP gets the NAT IP address for the instance.\n\tGetNatIP(zone, name string) (string, error)\n\n\t// GetInternalIP gets the GCE-internal IP address for the instance.\n\tGetInternalIP(zone, name string) (string, error)\n\n\t// RunInstance takes the given config and launches an instance.\n\tRunInstance(*InstanceConfig) (\u003c-chan error, error)\n\n\t// WaitForInstance waits for an instance to reach the given state.\n\tWaitForInstance(state, zone, name string) \u003c-chan error\n}\n```\nDriver 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.\n\n```go\nfunc NewDriverGCE(ui packer.Ui, p string, a *accountFile) (Driver, error)\n```\n\n```go\ntype DriverMock struct {\n\tImageExistsName   string\n\tImageExistsResult bool\n\n\tCreateImageName  string\n\tCreateImageDesc  string\n\tCreateImageZone  string\n\tCreateImageDisk  string\n\tCreateImageErrCh \u003c-chan error\n\n\tDeleteImageName  string\n\tDeleteImageErrCh \u003c-chan error\n\n\tDeleteInstanceZone  string\n\tDeleteInstanceName  string\n\tDeleteInstanceErrCh \u003c-chan error\n\tDeleteInstanceErr   error\n\n\tDeleteDiskZone  string\n\tDeleteDiskName  string\n\tDeleteDiskErrCh \u003c-chan error\n\tDeleteDiskErr   error\n\n\tGetNatIPZone   string\n\tGetNatIPName   string\n\tGetNatIPResult string\n\tGetNatIPErr    error\n\n\tGetInternalIPZone   string\n\tGetInternalIPName   string\n\tGetInternalIPResult string\n\tGetInternalIPErr    error\n\n\tRunInstanceConfig *InstanceConfig\n\tRunInstanceErrCh  \u003c-chan error\n\tRunInstanceErr    error\n\n\tWaitForInstanceState string\n\tWaitForInstanceZone  string\n\tWaitForInstanceName  string\n\tWaitForInstanceErrCh \u003c-chan error\n}\n```\nDriverMock is a Driver implementation that is a mocked out so that it can be used for tests.\n\n```go\nfunc (d *DriverMock) CreateImage(name, description, zone, disk string) \u003c-chan error\n```\n\n```go\nfunc (d *DriverMock) DeleteDisk(zone, name string) (\u003c-chan error, error)\n```\n\n```go\nfunc (d *DriverMock) DeleteImage(name string) \u003c-chan error\n```\n\n```go\nfunc (d *DriverMock) DeleteInstance(zone, name string) (\u003c-chan error, error)\n```\n\n```go\nfunc (d *DriverMock) GetInternalIP(zone, name string) (string, error)\n```\n\n```go\nfunc (d *DriverMock) GetNatIP(zone, name string) (string, error)\n```\n\n```go\nfunc (d *DriverMock) ImageExists(name string) bool\n```\n\n```go\nfunc (d *DriverMock) RunInstance(c *InstanceConfig) (\u003c-chan error, error)\n```\n\n```go\nfunc (d *DriverMock) WaitForInstance(state, zone, name string) \u003c-chan error\n```\n\n```go\ntype Image struct {\n\tName      string\n\tProjectId string\n}\n```\n\n```go\ntype InstanceConfig struct {\n\tDescription string\n\tDiskSizeGb  int64\n\tDiskType    string\n\tImage       Image\n\tMachineType string\n\tMetadata    map[string]string\n\tName        string\n\tNetwork     string\n\tSubnetwork  string\n\tAddress     string\n\tPreemptible bool\n\tTags        []string\n\tRegion      string\n\tZone        string\n}\n```\n\n```go\ntype StepCheckExistingImage int\n```\nStepCheckExistingImage represents a Packer build step that checks if the target image already exists, and aborts immediately if so.\n\n```go\nfunc (s *StepCheckExistingImage) Cleanup(state multistep.StateBag)\n```\nCleanup.\n\n```go\nfunc (s *StepCheckExistingImage) Run(state multistep.StateBag) multistep.StepAction\n```\nRun executes the Packer build step that checks if the image already exists.\n\n```go\ntype StepCreateImage int\n```\nStepCreateImage represents a Packer build step that creates GCE machine images.\n\n```go\nfunc (s *StepCreateImage) Cleanup(state multistep.StateBag)\n```\nCleanup.\n\n```go\nfunc (s *StepCreateImage) Run(state multistep.StateBag) multistep.StepAction\n```\nRun executes the Packer build step that creates a GCE machine image.\n\nThe image is created from the persistent disk used by the instance. The instance must be deleted and the disk retained before doing this step.\n\n```go\ntype StepCreateInstance struct {\n\tDebug bool\n}\n```\nStepCreateInstance represents a Packer build step that creates GCE instances.\n\n```go\nfunc (s *StepCreateInstance) Cleanup(state multistep.StateBag)\n```\nCleanup destroys the GCE instance created during the image creation process.\n\n```go\nfunc (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction\n```\nRun executes the Packer build step that creates a GCE instance.\n\n```go\ntype StepCreateSSHKey struct {\n\tDebug        bool\n\tDebugKeyPath string\n}\n```\nStepCreateSSHKey represents a Packer build step that generates SSH key pairs.\n\n```go\nfunc (s *StepCreateSSHKey) Cleanup(state multistep.StateBag)\n```\nNothing to clean up. SSH keys are associated with a single GCE instance.\n\n```go\nfunc (s *StepCreateSSHKey) Run(state multistep.StateBag) multistep.StepAction\n```\nRun executes the Packer build step that generates SSH key pairs.\n\n```go\ntype StepInstanceInfo struct {\n\tDebug bool\n\t// contains filtered or unexported fields\n}\n```\nstepInstanceInfo represents a Packer build step that gathers GCE instance info.\n\n```go\nfunc (s *StepInstanceInfo) Cleanup(state multistep.StateBag)\n```\nCleanup.\n\n```go\nfunc (s *StepInstanceInfo) Run(state multistep.StateBag) multistep.StepAction\n```\nRun executes the Packer build step that gathers GCE instance info.\n\n```go\ntype StepTeardownInstance struct {\n\tDebug bool\n}\n```\nStepTeardownInstance represents a Packer build step that tears down GCE instances.\n\n```go\nfunc (s *StepTeardownInstance) Cleanup(state multistep.StateBag)\n```\nDeleting the instance does not remove the boot disk. This cleanup removes the disk.\n\n```go\nfunc (s *StepTeardownInstance) Run(state multistep.StateBag) multistep.StepAction\n```\nRun executes the Packer build step that tears down a GCE instance.\n\n","path":"github.com/stackpointcloud/packer/builder/googlecompute","name":"googlecompute","synopsis":"The googlecompute package contains a packer.Builder implementation that builds images for Google Compute Engine.","isRedistributable":true}
