mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat(coderd/agentapi): implement sub agent api (#17823)
Closes https://github.com/coder/internal/issues/619 Implement the `coderd` side of the AgentAPI for the upcoming dev-container agents work. `agent/agenttest/client.go` is left unimplemented for a future PR working to implement the agent side of this feature.
This commit is contained in:
@ -51,6 +51,7 @@ type API struct {
|
||||
*LogsAPI
|
||||
*ScriptsAPI
|
||||
*AuditAPI
|
||||
*SubAgentAPI
|
||||
*tailnet.DRPCService
|
||||
|
||||
mu sync.Mutex
|
||||
@ -59,9 +60,10 @@ type API struct {
|
||||
var _ agentproto.DRPCAgentServer = &API{}
|
||||
|
||||
type Options struct {
|
||||
AgentID uuid.UUID
|
||||
OwnerID uuid.UUID
|
||||
WorkspaceID uuid.UUID
|
||||
AgentID uuid.UUID
|
||||
OwnerID uuid.UUID
|
||||
WorkspaceID uuid.UUID
|
||||
OrganizationID uuid.UUID
|
||||
|
||||
Ctx context.Context
|
||||
Log slog.Logger
|
||||
@ -193,6 +195,16 @@ func New(opts Options) *API {
|
||||
NetworkTelemetryHandler: opts.NetworkTelemetryHandler,
|
||||
}
|
||||
|
||||
api.SubAgentAPI = &SubAgentAPI{
|
||||
OwnerID: opts.OwnerID,
|
||||
OrganizationID: opts.OrganizationID,
|
||||
AgentID: opts.AgentID,
|
||||
AgentFn: api.agent,
|
||||
Log: opts.Log,
|
||||
Clock: opts.Clock,
|
||||
Database: opts.Database,
|
||||
}
|
||||
|
||||
return api
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user