api

package
v0.0.0-...-c46e20b Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package api provides the REST API server and handler registration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Echo *echo.Echo
	// contains filtered or unexported fields
}

Server implementation of the Server's API operations.

func New

func New(
	appConfig config.Config,
	logger *slog.Logger,
) *Server

New initialize a new Server and configure an Echo server.

func (*Server) GetHealthHandler

func (s *Server) GetHealthHandler(
	checker health.Checker,
	startTime time.Time,
	version string,
	metrics health.MetricsProvider,
) []func(e *echo.Echo)

GetHealthHandler returns health handler for registration.

func (*Server) GetJobHandler

func (s *Server) GetJobHandler(
	jobClient client.JobClient,
) []func(e *echo.Echo)

GetJobHandler returns job handler for registration.

func (*Server) GetMetricsHandler

func (s *Server) GetMetricsHandler(
	metricsHandler http.Handler,
	path string,
) []func(e *echo.Echo)

GetMetricsHandler returns a handler that registers the Prometheus scrape endpoint.

func (*Server) GetNetworkHandler

func (s *Server) GetNetworkHandler(
	jobClient client.JobClient,
) []func(e *echo.Echo)

GetNetworkHandler returns network handler for registration.

func (*Server) GetSystemHandler

func (s *Server) GetSystemHandler(
	jobClient client.JobClient,
) []func(e *echo.Echo)

GetSystemHandler returns system handler for registration.

func (*Server) RegisterHandlers

func (s *Server) RegisterHandlers(
	handlers []func(e *echo.Echo),
)

RegisterHandlers registers a list of handlers with the Echo instance.

func (*Server) Start

func (s *Server) Start()

Start starts the Echo server with the configured port.

func (*Server) Stop

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

Stop gracefully shuts down the Echo server.

type TokenValidator

type TokenValidator interface {
	Validate(
		tokenString string,
		signingKey string,
	) (*authtoken.CustomClaims, error)
}

TokenValidator parses and validates JWT tokens.

Directories

Path Synopsis
common
gen
Package gen provides primitives to interact with the openapi HTTP API.
Package gen provides primitives to interact with the openapi HTTP API.
Package health provides health check API handlers.
Package health provides health check API handlers.
gen
Package gen contains generated code for the health API.
Package gen contains generated code for the health API.
job
Package job provides job queue API handlers.
Package job provides job queue API handlers.
gen
Package gen contains generated code for the job API.
Package gen contains generated code for the job API.
Package metrics provides the Prometheus metrics endpoint handler.
Package metrics provides the Prometheus metrics endpoint handler.
Package network provides network-related API handlers.
Package network provides network-related API handlers.
gen
Package gen contains generated code for the network API.
Package gen contains generated code for the network API.
Package system provides system-related API handlers.
Package system provides system-related API handlers.
gen
Package gen contains generated code for the system API.
Package gen contains generated code for the system API.

Jump to

Keyboard shortcuts

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