gcloud

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstanceIPs

func InstanceIPs(inst *compute.Instance) (intIP, extIP string)

Taken from: https://github.com/golang/build/blob/master/buildlet/gce.go

func ParseDisk

func ParseDisk(spec string, zone string) (*compute.AttachedDisk, error)

["5G:channel=nvme"], by default the disk type is local-ssd

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func New

func New(opts *Options) (*API, error)

func (*API) Client

func (a *API) Client() *http.Client

func (*API) CreateImage

func (a *API) CreateImage(spec *ImageSpec, overwrite bool) (*compute.Operation, *Pending, error)

CreateImage creates an image on GCP and returns operation details and a Pending. If overwrite is true, an existing image will be overwritten if it exists.

func (*API) CreateInstance

func (a *API) CreateInstance(userdata string, keys []*agent.Key, opts platform.MachineOptions, useServiceAcct bool) (*compute.Instance, error)

CreateInstance creates a Google Compute Engine instance.

func (*API) DeleteImage

func (a *API) DeleteImage(name string) (*Pending, error)

func (*API) DeprecateImage

func (a *API) DeprecateImage(name string, state DeprecationState, replacement string) (*Pending, error)

func (*API) GC

func (a *API) GC(gracePeriod time.Duration) error

func (*API) GetConsoleOutput

func (a *API) GetConsoleOutput(name string) (string, error)

func (*API) GetPendingForImage

func (a *API) GetPendingForImage(image *compute.Image) (*Pending, error)

func (*API) ListImages

func (a *API) ListImages(ctx context.Context, prefix string, family string) ([]*compute.Image, error)

func (*API) ListInstances

func (a *API) ListInstances(prefix string) ([]*compute.Instance, error)

func (*API) NewPending

func (a *API) NewPending(desc string, do doable) *Pending

func (*API) TerminateInstance

func (a *API) TerminateInstance(name string) error

func (*API) UpdateImage

func (a *API) UpdateImage(name string, family string, description string) (*Pending, error)

type DeprecationState

type DeprecationState string
const (
	DeprecationStateActive     DeprecationState = "ACTIVE"
	DeprecationStateDeprecated DeprecationState = "DEPRECATED"
	DeprecationStateObsolete   DeprecationState = "OBSOLETE"
	DeprecationStateDeleted    DeprecationState = "DELETED"
)

type ImageSpec

type ImageSpec struct {
	Architecture string
	SourceImage  string
	Family       string
	Name         string
	Description  string
	Licenses     []string // short names
}

type Options

type Options struct {
	Image        string
	Project      string
	Zone         string
	MachineType  string
	DiskType     string
	Network      string
	ServiceAcct  string
	JSONKeyFile  string
	ServiceAuth  bool
	Confidential bool
	*platform.Options
}

type Pending

type Pending struct {
	Interval time.Duration
	Timeout  time.Duration // for default progress function
	Progress func(desc string, elapsed time.Duration, op *compute.Operation) error
	// contains filtered or unexported fields
}

func (*Pending) Wait

func (p *Pending) Wait() error

Jump to

Keyboard shortcuts

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