43 lines
1.5 KiB
Go
43 lines
1.5 KiB
Go
package adapters
|
|
|
|
// DockerAdapter is a stub for future Docker label management.
|
|
// Phase 2 does not implement Docker label adapter; it only defines the interface
|
|
// so Phase 3 can plug it in without changing call sites.
|
|
|
|
type DockerAdapter interface {
|
|
// ListContainers returns containers that could be managed via labels
|
|
ListContainers() ([]Container, error)
|
|
// PreviewLabels returns diff for label changes (no write)
|
|
PreviewLabels(containerID string, labels map[string]string) (string, error)
|
|
// ApplyLabels writes label changes (requires confirmation)
|
|
ApplyLabels(containerID string, labels map[string]string, confirm bool) error
|
|
}
|
|
|
|
type Container struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Labels map[string]string `json:"labels"`
|
|
}
|
|
|
|
// StubDockerAdapter returns not-implemented for all operations
|
|
type StubDockerAdapter struct{}
|
|
|
|
func (s *StubDockerAdapter) ListContainers() ([]Container, error) {
|
|
return nil, errNotImplemented("docker")
|
|
}
|
|
func (s *StubDockerAdapter) PreviewLabels(string, map[string]string) (string, error) {
|
|
return "", errNotImplemented("docker")
|
|
}
|
|
func (s *StubDockerAdapter) ApplyLabels(string, map[string]string, bool) error {
|
|
return errNotImplemented("docker")
|
|
}
|
|
|
|
func errNotImplemented(provider string) error {
|
|
return &NotImplementedError{Provider: provider}
|
|
}
|
|
|
|
type NotImplementedError struct{ Provider string }
|
|
|
|
func (e *NotImplementedError) Error() string {
|
|
return "provider " + e.Provider + " adapter not implemented in Phase 2 (stub only)"
|
|
}
|