mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
This refactor improves separation of API and containers with minimal changes to logic. Highlights: - Routes are now defined in `agentcontainers` package - Handler renamed to API - API lazy init was moved into NewAPI - Tests that don't need to be internal were made external
25 lines
694 B
Go
25 lines
694 B
Go
package agentcontainers
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/coder/coder/v2/codersdk"
|
|
)
|
|
|
|
// Lister is an interface for listing containers visible to the
|
|
// workspace agent.
|
|
type Lister interface {
|
|
// List returns a list of containers visible to the workspace agent.
|
|
// This should include running and stopped containers.
|
|
List(ctx context.Context) (codersdk.WorkspaceAgentListContainersResponse, error)
|
|
}
|
|
|
|
// NoopLister is a Lister interface that never returns any containers.
|
|
type NoopLister struct{}
|
|
|
|
var _ Lister = NoopLister{}
|
|
|
|
func (NoopLister) List(_ context.Context) (codersdk.WorkspaceAgentListContainersResponse, error) {
|
|
return codersdk.WorkspaceAgentListContainersResponse{}, nil
|
|
}
|