api

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package api implements the deeplo admin API served over a Unix socket. All endpoints return JSON. File-system permissions on the socket are the only access control mechanism; no authentication layer is added.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SocketPath string
	StartedAt  time.Time
	Version    string
	GetConfig  func() *config.Config
	Bootstrap  *bootstrap.Config
	Store      *state.FileStore
	RunsDir    string
	OnReload   func(ctx context.Context) error
	OnRefresh  func(ctx context.Context) []RefreshHost
	OnProbe    func(ctx context.Context) []ProbeHost
	OnDeploy   func(ctx context.Context, project, host string) ([]string, error)
	Logger     *slog.Logger
}

type DeployResponse

type DeployResponse struct {
	Targets []string `json:"targets"`
}

type DeploymentsResponse

type DeploymentsResponse struct {
	Deployments []*state.Deployment `json:"deployments"`
}

type HealthResponse

type HealthResponse struct {
	OK      bool   `json:"ok"`
	Version string `json:"version"`
	Uptime  string `json:"uptime"`
}

type ProbeHost

type ProbeHost struct {
	Host    string `json:"host"`
	Address string `json:"address"`
	OK      bool   `json:"ok"`
	Error   string `json:"error,omitempty"`
}

type ProbeResponse

type ProbeResponse struct {
	Hosts []ProbeHost `json:"hosts"`
}

type RefreshHost

type RefreshHost struct {
	Host     string           `json:"host"`
	Error    string           `json:"error,omitempty"`
	Projects []RefreshProject `json:"projects,omitempty"`
}

type RefreshProject

type RefreshProject struct {
	Project  string           `json:"project"`
	Error    string           `json:"error,omitempty"`
	Services []RefreshService `json:"services"`
}

type RefreshResponse

type RefreshResponse struct {
	Hosts []RefreshHost `json:"hosts"`
}

type RefreshService

type RefreshService struct {
	Service string `json:"service"`
	State   string `json:"state"`
	Status  string `json:"status"`
}

type ReloadResponse

type ReloadResponse struct {
	OK      bool   `json:"ok"`
	Message string `json:"message"`
}

type RunsResponse

type RunsResponse struct {
	Runs []*state.Deployment `json:"runs"`
}

type Server

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

func New

func New(serverConfig Config) *Server

Wires up the admin API server. Call Start to begin accepting connections.

func (*Server) Shutdown

func (server *Server) Shutdown(ctx context.Context) error

Gracefully stops the server and removes the socket file.

func (*Server) Start

func (server *Server) Start() error

Opens the Unix socket and begins serving in a background goroutine.

Jump to

Keyboard shortcuts

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