agent

package
v0.0.0-...-36014f3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package agent provides agent-related API handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(
	logger *slog.Logger,
	jobClient client.JobClient,
	signingKey string,
	customRoles map[string][]string,
	enrollmentMgr EnrollmentManager,
) []func(e *echo.Echo)

Handler returns agent route registration functions.

Types

type Agent

type Agent struct {
	// JobClient provides job-based operations for agent queries.
	JobClient client.JobClient
	// contains filtered or unexported fields
}

Agent implementation of the Agent APIs operations.

func New

func New(
	logger *slog.Logger,
	jobClient client.JobClient,
	enrollmentMgr EnrollmentManager,
) *Agent

New factory to create a new instance.

func (*Agent) AcceptAgent

AcceptAgent handles POST /agent/{hostname}/accept.

func (*Agent) DrainAgent

DrainAgent handles POST /agent/{hostname}/drain.

func (*Agent) GetAgentDetails

GetAgentDetails retrieves detailed information about a specific agent.

func (*Agent) GetAgents

GetAgents discovers all active agents in the fleet.

func (*Agent) GetAgentsPending

GetAgentsPending handles GET /agent/pending.

func (*Agent) RejectAgent

RejectAgent handles POST /agent/{hostname}/reject.

func (*Agent) UndrainAgent

UndrainAgent handles POST /agent/{hostname}/undrain.

type EnrollmentManager

type EnrollmentManager interface {
	ListPending(ctx context.Context) ([]enrollment.PendingAgent, error)
	AcceptByHostname(ctx context.Context, hostname string) error
	AcceptByFingerprint(ctx context.Context, fingerprint string) error
	RejectByHostname(ctx context.Context, hostname string, reason string) error
}

EnrollmentManager defines the enrollment operations needed by the agent API handlers. When nil, enrollment endpoints return 500.

Directories

Path Synopsis
Package gen provides primitives to interact with the openapi HTTP API.
Package gen provides primitives to interact with the openapi HTTP API.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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