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

admin

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const Slug = "admin"

Variables

This section is empty.

Functions

func Command

func Command(d Deps) *cobra.Command

Command builds a fresh admin subtree for a runtime or generator mount.

func ServeCommand added in v1.4.14

func ServeCommand(d ServeDeps) *cobra.Command

ServeCommand creates an API-only server command, independently of compat mode.

Types

type AdminConnection

type AdminConnection struct {
	Name       string `json:"name"`
	Host       string `json:"host"`
	User       string `json:"user"`
	Port       int    `json:"port"`
	LocalPort  int    `json:"local_port"`
	RemotePort int    `json:"remote_port"`
}

AdminConnection represents a saved remote admin connection.

type AdminProject

type AdminProject struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Path    string `json:"path"`
	Host    string `json:"host"`
	SSHUser string `json:"ssh_user"`
	URL     string `json:"url"`
}

AdminProject represents a project in the multi-project config.

type Deps

type Deps struct {
	LoadHealthConfig  func() (*config.Config, string, error)
	OpenBrowserCmd    func(context.Context, string) *exec.Cmd
	ResolveEnvFile    func(string) (string, error)
	SetEnvKeyInFile   func(string, string, string) error
	ShouldOpenBrowser func() bool
}

Deps carries the command package helpers used by the admin family.

type HealthData added in v1.4.15

type HealthData struct {
	// URL is the probed health URL.
	URL string `json:"url"`
	// Healthy is always true in a success envelope.
	Healthy bool `json:"healthy"`
	// StatusCode is the HTTP status the probe got.
	StatusCode int `json:"status_code"`
}

HealthData is the data of `admin health` (an unhealthy Admin is an error).

type Hub added in v1.4.15

type Hub struct {
	// Subcommands are the available subcommands in registration order.
	Subcommands []HubEntry `json:"subcommands"`
}

Hub is the data of an admin command group: its subcommands.

type HubEntry added in v1.4.15

type HubEntry struct {
	// Name is the subcommand name.
	Name string `json:"name"`
	// Summary is its one-line description.
	Summary string `json:"summary"`
}

HubEntry is one subcommand of a Hub.

type LogRecord added in v1.4.15

type LogRecord struct {
	// Type is always "log".
	Type string `json:"type"`
	// Message is the log line.
	Message string `json:"message"`
}

LogRecord is one line of `admin logs --json --follow` (contract:cli.json-stream v1).

func (LogRecord) RecordType added in v1.4.15

func (LogRecord) RecordType() string

RecordType names the stream record kind (data.type) of a LogRecord.

type LogsData added in v1.4.15

type LogsData struct {
	// Container is the Admin container the lines came from.
	Container string `json:"container"`
	// Lines are the log lines in the order docker printed them.
	Lines []string `json:"lines"`
}

LogsData is the data of `admin logs` without --follow.

type LogsEnd added in v1.4.15

type LogsEnd struct {
	// Lines is the number of record lines written.
	Lines int `json:"lines"`
}

LogsEnd holds the members of the last line of `admin logs --json --follow`.

type OpenData added in v1.4.15

type OpenData struct {
	// URL is the local Admin URL.
	URL string `json:"url"`
	// Opened is true when a browser was started (false in headless runs).
	Opened bool `json:"opened"`
}

OpenData is the data of `admin`: where the dashboard lives and whether a browser was launched for it.

type ProjectChange added in v1.4.15

type ProjectChange struct {
	// ID is the project id that was added or removed.
	ID string `json:"id"`
	// Action is "added" or "removed".
	Action string `json:"action"`
}

ProjectChange is the data of `admin projects add|remove`.

type ProjectList added in v1.4.15

type ProjectList []AdminProject

ProjectList is the data of `admin projects list`: the saved projects.

type ServeDeps added in v1.4.14

type ServeDeps struct {
	// Registry supplies the command snapshot used by the server.
	Registry func() (*cmdregistry.Registry, error)
	// DataSchema provides committed command data schemas for OpenAPI.
	DataSchema func(string) ([]byte, bool)
	// ProjectDir resolves the invocation working directory.
	ProjectDir func() (string, error)
	// Listen binds the listener before announcing readiness; nil uses net.Listen.
	Listen func(network, address string) (net.Listener, error)
}

ServeDeps supplies composition-root providers without importing commands.

type StartData added in v1.4.15

type StartData struct {
	// Listen is the host:port Admin is bound to, "" when it could not be observed.
	Listen string `json:"listen"`
	// ExposeNetwork is true when a binding is beyond loopback (false when unobserved).
	ExposeNetwork bool `json:"expose_network"`
	// Observed is true when Listen and ExposeNetwork were read from the container.
	Observed bool `json:"observed"`
}

StartData is the data of `admin start`. The binding is read from the running container (docker port), not from the flags of this run: an Admin that was already running keeps the binding it was started with.

func BindingOf added in v1.4.15

func BindingOf(ports []string) StartData

BindingOf reads the host bindings of a container as internal/docker formats them ("127.0.0.1:3021->3021/tcp", and for IPv6 the unbracketed ":::3021->3021/tcp"). Listen is the first binding in sorted order, with an IPv6 host bracketed ("[::]:3021"). ExposeNetwork fails closed: any host that is not a loopback address, or that cannot be parsed, marks the exposure.

type StopData added in v1.4.15

type StopData struct {
	// Container is the stopped container.
	Container string `json:"container"`
	// Force is true when the graceful drain was skipped.
	Force bool `json:"force"`
}

StopData is the data of `admin stop`.

Jump to

Keyboard shortcuts

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