Documentation
¶
Overview ¶
Package pbs is the server-side Proxmox Backup Server REST client. It is deliberately limited to reading (ping, credentials for the backup protocol): FallBCK never prunes, forgets or deletes anything on PBS, and the API tokens it is given should not carry the privileges to (Datastore.Backup only). Retention is a PBS datastore prune job. Do not add mutating calls here.
Index ¶
- Variables
- func AuthorizationHeader(raw string) string
- func DecodePBSResponse(body io.Reader, out interface{}) error
- func ExportKeyFile(key [32]byte, passphrase, hint string) ([]byte, error)
- func GenerateKey() ([32]byte, string, error)
- func KeyFingerprint(key [32]byte) (string, error)
- func NormalizeAPIToken(raw string) (string, error)
- func SplitAPIToken(raw string) (authID, secret string, err error)
- func TokenID(raw string) string
- func ValidateMasterPublicKey(pemText string) (string, error)
- type BackupManifest
- type BackupStats
- type BackupType
- type ChunkDigest
- type Client
- type FileInfo
- type ImportedKey
- type SnapshotIdentifier
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAPIToken = errors.New("invalid PBS API token: expected user@realm!tokenid:secret")
ErrInvalidAPIToken is returned for tokens that cannot be parsed
Functions ¶
func AuthorizationHeader ¶ added in v0.6.0
AuthorizationHeader returns the PBS Authorization header value for a token in any accepted spelling; malformed tokens are passed through so PBS reports the failure
func DecodePBSResponse ¶
DecodePBSResponse helper
func ExportKeyFile ¶ added in v0.13.0
ExportKeyFile renders the key as a passphrase-protected (scrypt) key file that proxmox-backup-client restores with (--keyfile)
func GenerateKey ¶ added in v0.13.0
GenerateKey returns a fresh 32-byte key and its fingerprint
func KeyFingerprint ¶ added in v0.13.0
KeyFingerprint is the colon-separated fingerprint proxmox-backup shows for a key
func NormalizeAPIToken ¶ added in v0.6.0
NormalizeAPIToken returns the canonical "user@realm!tokenid:secret" form
func SplitAPIToken ¶ added in v0.6.0
SplitAPIToken parses a token in any accepted spelling into its auth id ("user@realm!tokenid") and secret
func ValidateMasterPublicKey ¶ added in v0.13.0
ValidateMasterPublicKey checks an RSA public key in PEM form ("PUBLIC KEY" or "RSA PUBLIC KEY"), at least 2048 bits, and returns it normalised
Types ¶
type BackupManifest ¶
type BackupManifest struct {
BackupType BackupType `json:"backup-type"`
BackupID string `json:"backup-id"`
BackupTime int64 `json:"backup-time"`
Files []FileInfo `json:"files"`
Signature string `json:"signature,omitempty"`
}
BackupManifest represents the PBS V2 manifest (index.json)
type BackupStats ¶
type BackupStats struct {
BytesScanned int64 `json:"bytes_scanned"`
BytesUploaded int64 `json:"bytes_uploaded"`
ChunkCount int `json:"chunk_count"`
DedupRatio float64 `json:"dedup_ratio"`
Duration time.Duration `json:"duration"`
SnapshotID string `json:"snapshot_id"`
}
BackupStats summarizes an executed backup run
type BackupType ¶
type BackupType string
BackupType represents the type of backup in PBS (host, ct, vm)
const ( BackupTypeHost BackupType = "host" BackupTypeCT BackupType = "ct" BackupTypeVM BackupType = "vm" )
type Client ¶
type Client struct {
Endpoint string
APIToken string
TLSVerify bool
Fingerprint string
// contains filtered or unexported fields
}
Client is an HTTP client for Proxmox Backup Server
type FileInfo ¶
type FileInfo struct {
Filename string `json:"filename"` // e.g. "root.pxar.didx" or "catalog.pcat1.didx"
Size int64 `json:"size"`
Csum string `json:"csum"`
}
FileInfo describes an archive or index file inside a snapshot
type ImportedKey ¶ added in v0.13.0
ImportedKey is a key read from a proxmox-backup-client key file
func ImportKeyFile ¶ added in v0.13.0
func ImportKeyFile(data []byte, passphrase string) (ImportedKey, error)
ImportKeyFile reads a key file (passphrase-protected or plain)
type SnapshotIdentifier ¶
type SnapshotIdentifier struct {
Datastore string `json:"datastore"`
Namespace string `json:"namespace,omitempty"`
BackupType BackupType `json:"backup_type"`
BackupID string `json:"backup_id"`
BackupTime int64 `json:"backup_time"` // Unix timestamp
}
SnapshotIdentifier uniquely identifies a PBS snapshot
func (SnapshotIdentifier) String ¶
func (s SnapshotIdentifier) String() string