secretmanager

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

Documentation

Overview

Package secretmanager is the Secret Manager emulation.

A secret is a container; the value lives in numbered versions beneath it, and "latest" is an alias for the newest one still enabled. That indirection is the whole model, and the reason a rotated credential does not need the code reading it to change.

Index

Constants

View Source
const LatestAlias = "latest"

LatestAlias is the version name every caller uses instead of a number.

View Source
const MaxBodyBytes = 4 << 20

MaxBodyBytes caps a JSON request body.

These are metadata APIs: the largest thing they legitimately carry is a secret payload or a message, both far below this. Without a cap, one unauthenticated request with an endless body allocates until the emulator dies, which is a cheap way to take down everything else sharing the port.

Variables

This section is empty.

Functions

This section is empty.

Types

type REST

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

REST serves the Secret Manager JSON API over the same service the gRPC half uses. gcloud speaks REST; the Go client speaks gRPC.

func NewREST

func NewREST(s *Service) *REST

NewREST wires the routes gcloud drives.

func (*REST) Matches

func (a *REST) Matches(method, escapedPath string) bool

Matches reports whether a route here claims the request; /v1/ is shared.

func (*REST) ServeHTTP

func (a *REST) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Service

type Service struct {
	secretmanagerpb.UnimplementedSecretManagerServiceServer
	// contains filtered or unexported fields
}

Service holds secrets and their versions.

func New

func New(kv store.Store, clk clock.Clock) *Service

New wires a service.

func (*Service) AccessSecretVersion

AccessSecretVersion returns the value. This is the call everything else exists to serve.

func (*Service) AddSecretVersion

AddSecretVersion stores a new value. Versions are numbered from one and never reused, so a reference to a version always means the same bytes.

func (*Service) CreateSecret

func (*Service) DeleteSecret

func (*Service) GetSecret

func (*Service) UpdateSecret

UpdateSecret applies the fields named by the update mask. `gcloud secrets update` reaches this to change labels.

Jump to

Keyboard shortcuts

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