Documentation
¶
Overview ¶
Package api is branchd's REST control plane: a thin JSON layer over the engine. stdlib net/http only; routes use Go 1.22 method patterns. All /v1 routes require the bearer token; /healthz does not.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branch ¶
type Branch struct {
Name string `json:"name"`
Source string `json:"source"`
// Parent is the branch this one was created from (branch-from-branch);
// "" when created directly from the source.
Parent string `json:"parent,omitempty"`
State string `json:"state"`
Host string `json:"host"`
Port int `json:"port"`
User string `json:"user"`
// Password is the branch's own rotated password — present only when
// branchd runs with --rotate-branch-credentials; otherwise the branch
// inherits the source's credentials and the field is omitted.
Password string `json:"password,omitempty"`
Database string `json:"database"`
// ProxyDatabase is the database param to use when connecting through the
// wire-protocol router: dbname@branch.
ProxyDatabase string `json:"proxy_database"`
ExpiresAt string `json:"expires_at,omitempty"`
CreatedAt string `json:"created_at"`
}
type CreateBranchRequest ¶
type CreateBranchRequest struct {
Name string `json:"name"`
Source string `json:"source,omitempty"`
Parent string `json:"parent,omitempty"`
TTLSeconds int `json:"ttl_seconds"`
}
CreateBranchRequest creates a branch off a source (Source) or off another branch (Parent) — exactly one of the two must be set.
type CreateSourceRequest ¶
type CreateSourceRequest struct {
Name string `json:"name"`
Host string `json:"host"`
Port int `json:"port"`
User string `json:"user"`
Database string `json:"database"`
Network string `json:"network"`
PGVersion string `json:"pg_version"`
Password string `json:"password"`
// Via selects the seeding method: "basebackup" (default) or "dump".
Via string `json:"via,omitempty"`
// DumpSchemas scopes a via=dump seed to the given schemas (empty = the
// whole database). Only valid with via=dump.
DumpSchemas []string `json:"dump_schemas,omitempty"`
}
type MaskScript ¶
MaskScript is one per-source masking statement, applied in order inside every new/reset branch before it is marked ready.
type RefreshSourceRequest ¶
type RefreshSourceRequest struct {
Password string `json:"password"`
}
type Source ¶
type Source struct {
Name string `json:"name"`
PGVersion string `json:"pg_version"`
Host string `json:"host"`
Port int `json:"port"`
User string `json:"user"`
Database string `json:"database"`
Network string `json:"network,omitempty"`
// Via is the seeding method: "basebackup" (pg_basebackup) or "dump"
// (pg_dump — managed Postgres without REPLICATION privilege).
Via string `json:"via"`
DumpSchemas []string `json:"dump_schemas,omitempty"`
State string `json:"state"`
Generation int `json:"generation"`
CreatedAt string `json:"created_at"`
}
Click to show internal directories.
Click to hide internal directories.