gce

package
v0.0.0-...-07b455f Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 32

Documentation

Overview

Package gce provides wrappers around Google Compute Engine (GCE) APIs. It is assumed that the program itself also runs on GCE as APIs operate on the current project/zone.

See https://cloud.google.com/compute/docs for details. In particular, API reference: https://cloud.google.com/compute/docs/reference/latest and Go API wrappers: https://godoc.org/google.golang.org/api/compute/v1

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GcpSecret

func GcpSecret(name string) ([]byte, error)

GcpSecret returns the GCP Secret Manager blob as a []byte data.

Types

type Context

type Context struct {
	ProjectID  string
	ZoneID     string
	RegionID   string
	Instance   string
	InternalIP string
	ExternalIP string
	Network    string
	Subnetwork string
	// contains filtered or unexported fields
}

func NewContext

func NewContext(customZoneID string) (*Context, error)

func (*Context) CreateImage

func (ctx *Context) CreateImage(imageName, gcsFile string) error

func (*Context) CreateInstance

func (ctx *Context) CreateInstance(name, machineType, image, sshkey string,
	preemptible, displayDevice bool) (string, error)

func (*Context) DeleteImage

func (ctx *Context) DeleteImage(imageName string) error

func (*Context) DeleteInstance

func (ctx *Context) DeleteInstance(name string, wait bool) error

func (*Context) IsInstanceRunning

func (ctx *Context) IsInstanceRunning(name string) bool

type CreateArgs

type CreateArgs struct {
	Preemptible   bool
	DisplayDevice bool
}

Jump to

Keyboard shortcuts

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