cloudfunctions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package cloudfunctions serves the Cloud Functions v1 REST API, so real gcloud and the GCP SDKs can drive the emulator.

v1 rather than v2 for one reason: v1 is the only generation with an invoke method. A v2 function is a Cloud Run service, called at its own URL with an identity token, so a v2-only emulator can store function metadata but can never run one.

Index

Constants

View Source
const UploadPath = "/_emu/upload"

UploadPath is where generateUploadUrl points a client.

Real GCF hands out a signed GCS URL. cloudrig hands out one of its own: the emulator controls the address it returns, so the source can land here without a bucket, an object store, or a signature to verify.

Variables

View Source
var Prefixes = []string{"/v1/", "/v2/", UploadPath + "/"}

Prefixes are the path prefixes this service claims.

v2 is here for a single endpoint: gcloud validates --runtime against /v2/{parent}/runtimes even when deploying a gen1 function.

Functions

This section is empty.

Types

type Service

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

Service is the v1 API over a function registry. It holds no state of its own beyond operations: the registry is the single source of truth, so the API and the runner cannot drift apart.

func New

func New(reg *functions.Registry, clk clock.Clock, events io.Writer) *Service

New wires the API onto a registry.

func (*Service) Close

func (s *Service) Close() error

Close removes the staging directories the service made. Without it they outlive the emulator: nothing else knows where they are.

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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