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)"
|
||||
}
|
||||
33
backend/internal/config/adapters/kubernetes.go
Normal file
33
backend/internal/config/adapters/kubernetes.go
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package adapters
|
||||
|
||||
// KubernetesAdapter is a stub for future Kubernetes CRD/Gateway management.
|
||||
// Phase 2 does not implement K8s adapter; it only defines the interface.
|
||||
|
||||
type KubernetesAdapter interface {
|
||||
ListIngresses(namespace string) ([]K8sResource, error)
|
||||
ListCRDs(namespace string) ([]K8sResource, error)
|
||||
PreviewResource(kind, namespace, name string, yaml string) (string, error)
|
||||
ApplyResource(kind, namespace, name string, yaml string, confirm bool) error
|
||||
}
|
||||
|
||||
type K8sResource struct {
|
||||
Kind string `json:"kind"`
|
||||
Namespace string `json:"namespace"`
|
||||
Name string `json:"name"`
|
||||
YAML string `json:"yaml"`
|
||||
}
|
||||
|
||||
type StubKubernetesAdapter struct{}
|
||||
|
||||
func (s *StubKubernetesAdapter) ListIngresses(string) ([]K8sResource, error) {
|
||||
return nil, errNotImplemented("kubernetes")
|
||||
}
|
||||
func (s *StubKubernetesAdapter) ListCRDs(string) ([]K8sResource, error) {
|
||||
return nil, errNotImplemented("kubernetes")
|
||||
}
|
||||
func (s *StubKubernetesAdapter) PreviewResource(string, string, string, string) (string, error) {
|
||||
return "", errNotImplemented("kubernetes")
|
||||
}
|
||||
func (s *StubKubernetesAdapter) ApplyResource(string, string, string, string, bool) error {
|
||||
return errNotImplemented("kubernetes")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue