backup: pre-hardening baseline
This commit is contained in:
commit
9e4c612dcb
57 changed files with 10393 additions and 0 deletions
43
backend/internal/config/adapters/docker.go
Normal file
43
backend/internal/config/adapters/docker.go
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
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)"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue