serviceusage

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

Documentation

Overview

Package serviceusage tracks which APIs a project has enabled.

It is deploy-tooling plumbing, not something an app calls at runtime: a `terraform apply` or a `gcloud services enable` turns an API on before using it, and a stub that always answers "enabled" makes a config that toggles a service look like it changed nothing. Tracking real state lets that config round-trip — enable, read back enabled, disable, read back disabled.

Index

Constants

View Source
const MaxBodyBytes = 4 << 20

MaxBodyBytes caps a JSON request body; the port is shared.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service is the Service Usage REST API over the shared store.

func New

func New(kv store.Store) *Service

New wires the routes gcloud and Terraform drive.

func (*Service) Matches

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

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

func (*Service) Reset

func (a *Service) Reset(ctx context.Context, project string) error

Reset clears the enablement state for a project, or all of it when project is empty. The emulator's Reset calls this, since this state lives under its own key prefix rather than the storage tree a project reset otherwise clears.

func (*Service) ServeHTTP

func (a *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