gcs

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: 8 Imported by: 0

Documentation

Overview

Package gcs implements the Google Cloud Storage JSON REST API as a server.Handler. Real cloud.google.com/go/storage clients configured with a custom endpoint hit this handler the same way they hit storage.googleapis.com.

Supported operations (parity with AWS S3):

POST   /storage/v1/b?project={p}                    — create bucket
GET    /storage/v1/b?project={p}                    — list buckets
GET    /storage/v1/b/{bucket}                       — get bucket
DELETE /storage/v1/b/{bucket}                       — delete bucket
POST   /upload/storage/v1/b/{bucket}/o?uploadType=media&name={obj}  — upload object
GET    /storage/v1/b/{bucket}/o                     — list objects
GET    /storage/v1/b/{bucket}/o/{obj}               — get object metadata
GET    /storage/v1/b/{bucket}/o/{obj}?alt=media     — download object
DELETE /storage/v1/b/{bucket}/o/{obj}               — delete object
POST   /storage/v1/b/{bucket}/o/{obj}/rewriteTo/b/{dst}/o/{dstObj}  — copy
POST   /storage/v1/b/{srcBucket}/o/{srcObj}/copyTo/b/{dst}/o/{dstObj}  — legacy copy

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 GCS JSON REST requests against a storage.Bucket driver.

func New

New returns a GCS handler backed by b.

func (*Handler) Matches

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

Matches returns true for /storage/v1/, /upload/storage/v1/, and direct /{bucket}/{object} media URLs (used by Reader.NewRangeReader).

func (*Handler) ServeHTTP

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

ServeHTTP routes the request based on URL path shape.

Jump to

Keyboard shortcuts

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