{"modulePath":"github.com/osapi-io/osapi","version":"v0.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package agent\n\nPackage agent provides agent-related API handlers.\n\n## Functions\n\n```go\nfunc Handler(\n\tlogger *slog.Logger,\n\tjobClient client.JobClient,\n\tsigningKey string,\n\tcustomRoles map[string][]string,\n\tenrollmentMgr EnrollmentManager,\n) []func(e *echo.Echo)\n```\nHandler returns agent route registration functions.\n\n## Types\n\n```go\ntype Agent struct {\n\t// JobClient provides job-based operations for agent queries.\n\tJobClient client.JobClient\n\t// contains filtered or unexported fields\n}\n```\nAgent implementation of the Agent APIs operations.\n\n```go\nfunc New(\n\tlogger *slog.Logger,\n\tjobClient client.JobClient,\n\tenrollmentMgr EnrollmentManager,\n) *Agent\n```\nNew factory to create a new instance.\n\n```go\nfunc (a *Agent) AcceptAgent(\n\tctx context.Context,\n\trequest gen.AcceptAgentRequestObject,\n) (gen.AcceptAgentResponseObject, error)\n```\nAcceptAgent handles POST /agent/{hostname}/accept.\n\n```go\nfunc (a *Agent) DrainAgent(\n\tctx context.Context,\n\trequest gen.DrainAgentRequestObject,\n) (gen.DrainAgentResponseObject, error)\n```\nDrainAgent handles POST /agent/{hostname}/drain.\n\n```go\nfunc (a *Agent) GetAgentDetails(\n\tctx context.Context,\n\trequest gen.GetAgentDetailsRequestObject,\n) (gen.GetAgentDetailsResponseObject, error)\n```\nGetAgentDetails retrieves detailed information about a specific agent.\n\n```go\nfunc (a *Agent) GetAgents(\n\tctx context.Context,\n\t_ gen.GetAgentsRequestObject,\n) (gen.GetAgentsResponseObject, error)\n```\nGetAgents discovers all active agents in the fleet.\n\n```go\nfunc (a *Agent) GetAgentsPending(\n\tctx context.Context,\n\t_ gen.GetAgentsPendingRequestObject,\n) (gen.GetAgentsPendingResponseObject, error)\n```\nGetAgentsPending handles GET /agent/pending.\n\n```go\nfunc (a *Agent) RejectAgent(\n\tctx context.Context,\n\trequest gen.RejectAgentRequestObject,\n) (gen.RejectAgentResponseObject, error)\n```\nRejectAgent handles POST /agent/{hostname}/reject.\n\n```go\nfunc (a *Agent) UndrainAgent(\n\tctx context.Context,\n\trequest gen.UndrainAgentRequestObject,\n) (gen.UndrainAgentResponseObject, error)\n```\nUndrainAgent handles POST /agent/{hostname}/undrain.\n\n```go\ntype EnrollmentManager interface {\n\tListPending(ctx context.Context) ([]enrollment.PendingAgent, error)\n\tAcceptByHostname(ctx context.Context, hostname string) error\n\tAcceptByFingerprint(ctx context.Context, fingerprint string) error\n\tRejectByHostname(ctx context.Context, hostname string, reason string) error\n}\n```\nEnrollmentManager defines the enrollment operations needed by the agent API handlers. When nil, enrollment endpoints return 500.\n\n","path":"github.com/osapi-io/osapi/internal/controller/api/agent","name":"agent","synopsis":"Package agent provides agent-related API handlers.","isRedistributable":true}
