$ show Telmate/proxmox-api-go
This repository is a Go SDK and command-line tool for managing Proxmox VE. The core `proxmox` package provides typed configuration structs and client interfaces for nearly every Proxmox resource: QEMU VMs, LXC containers, storage backends, users, groups, pools, API tokens, snapshots, ACME accounts, metric servers, HA rules, SDN, and content templates/ISOs. The SDK maps strongly-typed Go structs to and from Proxmox's `/api2/json` endpoints, with pervasive validation, version-aware feature gates, and both legacy and modern client layers. A Cobra-based CLI in `cli/` exposes these operations to end users, while a deprecated `main.go` still exists for legacy command-line usage.
The LLM identified 4 files worth highlighting for reuse:
Implements three specialized URL-encoding modes tailored to Proxmox API quirks: path segments, API token values, and QEMU SSH keys. Uses a precomputed lookup table for efficiency. The package is isolated and could be extracted into any Go project needing custom percent-encoding rules for non-standard API path parameters.
Provides a declarative mock HTTP server for testing API clients without a live backend. It validates request parameters and returns canned responses, enabling realistic integration-style tests in unit tests. Although its request builders are Proxmox-flavored, the core server is a reusable pattern for any HTTP client test suite.
Defines a custom AuthorizedKey type with JSON marshal/unmarshal and URL encoding/decoding logic for OpenSSH authorized keys. It handles the awkward escaping Proxmox requires and is a self-contained example of a robust domain type that could be reused in other infrastructure tooling.
Contains snapshot CRUD plus a raw snapshot tree builder that reconstructs parent/child relationships from Proxmox snapshot metadata. The tree-building logic is generic enough to be lifted into any project needing hierarchical reconstruction from flat parent references, and is well-covered by tests.