gce

package
v0.0.0-...-9200169 Latest Latest
Warning

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

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

Documentation

Overview

Package gce contains high-level functionality for manipulating GCE resources.

Package gce contains high-level functionality for manipulating GCE resources.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTimeout indicates that an operation timed out.
	ErrTimeout = errors.New("operation timed out")

	// ErrImageNotFound indicates that a GCE image could not be found
	ErrImageNotFound = errors.New("image not found")
)

Functions

func CreateImage

func CreateImage(svc *compute.Service, sourceURL, imageName, imageProject string) error

CreateImage creates an image with imageName with the source-url from gcs storage

func DeleteOldVMWithLabel

func DeleteOldVMWithLabel(gceService *compute.Service, project, zone, labelKey, labelValue string, ttl time.Duration) error

DeleteOldVmWithLabel deletes all old VMs in the target project in the target zone with the given label. If the value of the label is empty, all VMs with the provided key of the label will be deleted. ttl must be at least 1 hour.

func DeprecateInFamily

func DeprecateInFamily(ctx context.Context, svc *compute.Service, newImage *config.Image, ttl int) error

DeprecateInFamily deprecates all of the old images in an image family. Allows for assigning TTLs (in seconds) to deprecated images.

func ImageExists

func ImageExists(svc *compute.Service, project, name string) (bool, error)

ImageExists checks to see if the given image exists in the given project.

func ResolveMilestone

func ResolveMilestone(ctx context.Context, svc *compute.Service, milestone int) (string, error)

ResolveMilestone gets the name of the latest COS image on the given milestone. This resolution is done by looking at the image names in cos-cloud.

Types

This section is empty.

Jump to

Keyboard shortcuts

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