proxmox: config block, IDs, marks, state mapping, classify, registration
Phase 2 of the proxmox provider plan. Adds the proxmox: config block with its validation, registers the type in the config allow-list and the constructor map, and starts internal/provider/proxmox: the api seam and its data types, providerIDs (vms/<vmid>/<name>) with the UID-derived VMID, the description mark, state mapping, and error classification. Tests read the responses captured from pv1-1 in Phase 0 rather than repeating Proxmox's wording, and every matcher is run against every captured error so none fires on the wrong message. The contract methods are Transient stubs until Phases 5 to 7. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,8 @@ type ProviderConfig struct {
|
||||
// KVM2 is the same block shape as KVM, for the kvm2 provider type: one
|
||||
// or more libvirt/KVM hypervisors reached over SSH.
|
||||
KVM2 *KVMConfig `json:"kvm2,omitempty"`
|
||||
// Proxmox is a Proxmox VE cluster reached through its REST API.
|
||||
Proxmox *ProxmoxConfig `json:"proxmox,omitempty"`
|
||||
}
|
||||
|
||||
// setBlocks names the type-specific blocks that are non-nil, so validate can
|
||||
@@ -43,6 +45,9 @@ func (p ProviderConfig) setBlocks() []string {
|
||||
if p.KVM2 != nil {
|
||||
out = append(out, "kvm2")
|
||||
}
|
||||
if p.Proxmox != nil {
|
||||
out = append(out, "proxmox")
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -106,7 +111,7 @@ func (c *Config) validate() error {
|
||||
|
||||
prefix := fmt.Sprintf("providers[%d] %q", i, p.Name)
|
||||
switch p.Type {
|
||||
case "kubernetes", "gcp", "kvm", "kvm2":
|
||||
case "kubernetes", "gcp", "kvm", "kvm2", "proxmox":
|
||||
case "":
|
||||
return fmt.Errorf("%s: type is required", prefix)
|
||||
default:
|
||||
@@ -130,6 +135,10 @@ func (c *Config) validate() error {
|
||||
if err := validateKVMBlock(prefix, "kvm2", p.KVM2); err != nil {
|
||||
return err
|
||||
}
|
||||
case "proxmox":
|
||||
if err := validateProxmox(prefix, p.Proxmox); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user