gce

package
v0.0.0-...-ecf4224 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetComputeClient

func GetComputeClient() (*compute.Service, error)

GetComputeClient creates a GCE client with a 1 minute deadline.

Types

type Instance

type Instance struct {
	Name           string
	Zone           string
	Project        string
	MachineType    string
	ExternalIP     string
	SshKey         string
	SshUser        string
	ComputeService *compute.Service
}

Instance represents a GCE instance.

func CreateInstance

func CreateInstance(instance Instance, imageName string, imageProject string) (Instance, error)

CreateInstance creates a GCE instance with provided spec.

func (*Instance) DeleteInstance

func (ins *Instance) DeleteInstance() error

DeleteInstance deletes a GCE instance.

func (*Instance) PushFile

func (ins *Instance) PushFile(srcPath, destPath string) error

PushFile pushes a local file to a GCE instance.

func (*Instance) RunCommand

func (ins *Instance) RunCommand(cmd string) ssh.Result

RunCommand runs a command on the GCE instance and returns the command result.

func (*Instance) RunCommandOrFail

func (ins *Instance) RunCommandOrFail(cmd string) ssh.Result

RunCommand runs a command on the GCE instance and returns the command result, and fails the test when the command failed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL