compute

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package compute serves GCP Compute Engine REST API requests against a CloudEmu compute driver. Real cloud.google.com/go/compute clients configured with a custom endpoint hit this handler the same way they hit compute.googleapis.com.

Supported operations (instance lifecycle parity with AWS EC2):

POST   /compute/v1/projects/{p}/zones/{z}/instances              — insert
GET    /compute/v1/projects/{p}/zones/{z}/instances/{name}       — get
GET    /compute/v1/projects/{p}/zones/{z}/instances              — list
DELETE /compute/v1/projects/{p}/zones/{z}/instances/{name}       — delete
POST   /compute/v1/projects/{p}/zones/{z}/instances/{name}/start — start
POST   /compute/v1/projects/{p}/zones/{z}/instances/{name}/stop  — stop
POST   /compute/v1/projects/{p}/zones/{z}/instances/{name}/reset — reset
GET    /compute/v1/projects/{p}/zones/{z}/operations/{name}      — get operation (always DONE)

Less-used surfaces (aggregated list, snapshots, disks, images) are not yet wired and return 501 Not Implemented.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler serves GCP Compute Engine REST requests for instances and zone operations.

func New

New returns a Compute handler backed by c.

func (*Handler) Matches

func (*Handler) Matches(r *http.Request) bool

Matches returns true for /compute/v1/projects/... URLs targeting instances or operations resources. Other resource types fall through so future handlers (disks, networks) can register independently.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP routes the parsed path to the matching operation.

Jump to

Keyboard shortcuts

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