compute

package
v0.0.0-...-b69053b Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package compute contains wrappers around the GCE compute API.

Package compute contains wrappers around the GCE compute API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildInstanceMetadataItem

func BuildInstanceMetadataItem(key, value string) *api.MetadataItems

BuildInstanceMetadataItem create an metadata item

func WaitForSerialOutput

func WaitForSerialOutput(successMatch string, failureMatches []string, port int64, interval, timeout time.Duration, project, zone, instanceName string, client daisyCompute.Client) error

WaitForSerialOutput waits to a string match on a serial port.

Types

type Image

type Image struct {
	*api.Image
	Client  computeApi.Client
	Project string
}

Image is a compute image.

func CreateImageObject

func CreateImageObject(ctx context.Context, project string, name string) (*Image, error)

CreateImageObject creates an image object to be operated by API client

func (*Image) Cleanup

func (i *Image) Cleanup() error

Cleanup deletes the image.

type Instance

type Instance struct {
	*api.Instance
	Client        daisyCompute.Client
	Project, Zone string
	IsWindows     bool
}

Instance is a compute instance.

func CreateInstanceObject

func CreateInstanceObject(ctx context.Context, project string, zone string, name string, isWindows bool) (*Instance, error)

CreateInstanceObject creates an instance object to be operated by GA API client

func SetMetadata

func SetMetadata(ctx context.Context, project, zone, name, key, value string, isWindows bool) (*Instance, error)

SetMetadata sets metadata for the given instance.

func (*Instance) Cleanup

func (i *Instance) Cleanup() error

Cleanup deletes the Instance.

func (*Instance) RestartWithScriptCode

func (i *Instance) RestartWithScriptCode(script string) error

RestartWithScriptCode restarts the instance with given startup script.

func (*Instance) StartWithScriptCode

func (i *Instance) StartWithScriptCode(script string, instanceMetadata map[string]string) error

StartWithScriptCode starts the instance with given startup script and metadata

func (*Instance) WaitForSerialOutput

func (i *Instance) WaitForSerialOutput(match string, failureMatches []string, port int64, interval, timeout time.Duration) error

WaitForSerialOutput waits to a string match on a serial port.

type InstanceBeta

type InstanceBeta struct {
	*apiBeta.Instance
	Client        daisyCompute.Client
	Project, Zone string
	IsWindows     bool
}

InstanceBeta is a compute instance using Beta API.

func CreateInstanceBeta

func CreateInstanceBeta(ctx context.Context, project string, zone string, name string, isWindows bool, machineImageName string) (*InstanceBeta, error)

CreateInstanceBeta creates an image object to be operated by Beta API client

func (*InstanceBeta) Cleanup

func (i *InstanceBeta) Cleanup() error

Cleanup deletes the InstanceBeta.

func (*InstanceBeta) StartWithScriptCode

func (i *InstanceBeta) StartWithScriptCode(script string, instanceMetadata map[string]string) error

StartWithScriptCode starts the instance with given startup script and metadata.

func (*InstanceBeta) WaitForSerialOutput

func (i *InstanceBeta) WaitForSerialOutput(match string, failureMatches []string, port int64, interval, timeout time.Duration) error

WaitForSerialOutput waits to a string match on a serial port.

Jump to

Keyboard shortcuts

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