Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package api implements the wire-compatible control-plane REST surface: Anthropic Managed Agents resource CRUD (agents / environments / sessions) with the reference paths, JSON shapes, ID prefixes, pagination envelope, error envelope, and x-api-key management auth. The `?beta=true` query and anthropic-version / anthropic-beta headers are accepted and ignored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureAPIKey

func EnsureAPIKey(ctx context.Context, pool *pgxpool.Pool, name, key string) error

EnsureAPIKey makes key the one live credential for the named logical key: it inserts (or un-revokes) the hash and revokes every other unrevoked key under the same name. That gives rotation-by-restart semantics — changing CONTROLPLANE_API_KEY and restarting cmd/controlplane revokes the previous key instead of leaving it valid forever. All replicas must therefore share one key value per name.

func EnsureEnvironmentKey

func EnsureEnvironmentKey(ctx context.Context, pool *pgxpool.Pool, environmentID, key string) error

EnsureEnvironmentKey makes key the one live worker credential for an environment: it inserts (or un-revokes) the hash and revokes every other unrevoked key for the same environment_id. That gives one live Authorization: Bearer credential per environment's work queue, with rotation-by-re-mint semantics (registering a fresh value revokes the prior one). Only the hash is stored.

Issuance is a deliberate divergence: the reference mints environment keys in its console with no public wire endpoint, so a self-hostable platform owns this provisioning primitive. The consuming side — resolving a Bearer token to its environment — stays wire-locked by the real `ant beta:worker` client.

func NewHandler

func NewHandler(pool *pgxpool.Pool) http.Handler

NewHandler assembles the control-plane HTTP surface over the given pool.

Types

This section is empty.

Jump to

Keyboard shortcuts

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