pubsub

package
v1.6.3 Latest Latest
Warning

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

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

Documentation

Overview

Package pubsub implements the GCP Pub/Sub v1 REST API as a server.Handler. Real google.golang.org/api/pubsub/v1 clients configured with a custom endpoint hit this handler the same way they hit pubsub.googleapis.com.

MVP coverage:

PUT    /v1/projects/{p}/topics/{name}                  — Create
GET    /v1/projects/{p}/topics/{name}                  — Get
GET    /v1/projects/{p}/topics                         — List
DELETE /v1/projects/{p}/topics/{name}                  — Delete
POST   /v1/projects/{p}/topics/{name}:publish          — Publish
PUT    /v1/projects/{p}/subscriptions/{name}           — Create
GET    /v1/projects/{p}/subscriptions/{name}           — Get
GET    /v1/projects/{p}/subscriptions                  — List
DELETE /v1/projects/{p}/subscriptions/{name}           — Delete
POST   /v1/projects/{p}/subscriptions/{name}:pull      — Pull
POST   /v1/projects/{p}/subscriptions/{name}:acknowledge — Ack

The portable messagequeue driver pairs a topic and subscription under a single queue keyed by name. SDK-compat reflects this: a subscription's "topic" must point at a topic with the same trailing name. Cross-name subscriptions (sub "billing-events" linked to topic "events") are not modeled in the MVP.

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 Pub/Sub v1 REST requests against a messagequeue driver.

func New

func New(mq mqdriver.MessageQueue) *Handler

New returns a Pub/Sub handler backed by mq.

func (*Handler) Matches

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

Matches accepts /v1/projects/{p}/topics[...] and /v1/projects/{p}/subscriptions[...]. The resource-type guard prevents this handler from claiming Cloud Functions (locations/functions) or Firestore (databases) URLs that share the same /v1/projects/ prefix.

func (*Handler) ServeHTTP

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

ServeHTTP routes by URL shape.

Jump to

Keyboard shortcuts

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