cloudsql

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cloudsql implements the GCP Cloud SQL Admin REST API as a server.Handler. Real google.golang.org/api/sqladmin/v1 clients configured with a custom endpoint hit this handler the same way they hit sqladmin.googleapis.com.

MVP coverage:

POST   /v1/projects/{p}/instances                            — Insert
GET    /v1/projects/{p}/instances                            — List
GET    /v1/projects/{p}/instances/{i}                        — Get
PATCH  /v1/projects/{p}/instances/{i}                        — Patch
PUT    /v1/projects/{p}/instances/{i}                        — Update
DELETE /v1/projects/{p}/instances/{i}                        — Delete
POST   /v1/projects/{p}/instances/{i}/restart                — Restart
POST   /v1/projects/{p}/instances/{i}/restoreBackup          — Restore from backup
POST   /v1/projects/{p}/instances/{i}/backupRuns             — Create backup run
GET    /v1/projects/{p}/instances/{i}/backupRuns             — List backup runs
GET    /v1/projects/{p}/instances/{i}/backupRuns/{id}        — Get backup run
DELETE /v1/projects/{p}/instances/{i}/backupRuns/{id}        — Delete backup run
GET    /v1/projects/{p}/operations/{op}                      — Poll operation (always DONE)

All mutating endpoints return Operation envelopes with status=DONE so SDK pollers terminate on the first response. Start/Stop are emulated via Patch with settings.activationPolicy=ALWAYS|NEVER, matching real Cloud SQL.

The /v1/projects/ prefix is shared with Cloud Functions, Pub/Sub, and Firestore. Matches narrows by the third path segment so dispatch stays unambiguous: it only claims "instances" or "operations" — anything else (locations, topics, subscriptions, databases) falls through.

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 Cloud SQL Admin REST requests against a relationaldb driver.

func New

New returns a Cloud SQL handler backed by db.

func (*Handler) Matches

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

Matches accepts /v1/projects/{p}/{instances|operations}/... paths. Other resource types under /v1/projects/ (locations, topics, subscriptions, databases) belong to Cloud Functions, Pub/Sub, or Firestore respectively and must fall through.

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