rest

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package rest provides the REST API server for AgentManager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v1.1.0

type Option func(*Server)

Option configures a Server during construction.

func WithStartTime added in v1.1.0

func WithStartTime(t time.Time) Option

WithStartTime overrides the server's start time (primarily for tests).

func WithVersion added in v1.1.0

func WithVersion(v string) Option

WithVersion sets the server version string reported by /status.

type Server

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

Server is the REST API server.

func NewServer

func NewServer(
	cfg *config.Config,
	plat platform.Platform,
	store storage.Store,
	det *detector.Detector,
	cat *catalog.Manager,
	inst *installer.Manager,
	opts ...Option,
) *Server

NewServer creates a new REST server.

func (*Server) Address

func (s *Server) Address() string

Address returns the server's listening address.

func (*Server) Start

func (s *Server) Start(ctx context.Context, cfg ServerConfig) error

Start starts the REST server.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop gracefully stops the REST server.

type ServerConfig

type ServerConfig struct {
	Address  string
	TLS      bool
	CertFile string
	KeyFile  string
	APIKey   string // Optional API key for authentication
}

ServerConfig configures the REST server.

Jump to

Keyboard shortcuts

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