pbs

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func AuthorizationHeader(raw string) string

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

func DecodePBSResponse(body io.Reader, out interface{}) error

DecodePBSResponse helper

func NormalizeAPIToken added in v0.6.0

func NormalizeAPIToken(raw string) (string, error)

NormalizeAPIToken returns the canonical "user@realm!tokenid:secret" form

func SplitAPIToken added in v0.6.0

func SplitAPIToken(raw string) (authID, secret string, err error)

SplitAPIToken parses a token in any accepted spelling into its auth id ("user@realm!tokenid") and secret

func TokenID added in v0.6.0

func TokenID(raw string) string

TokenID returns the loggable part of a token (no secret)

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 ChunkDigest

type ChunkDigest [32]byte

ChunkDigest represents a SHA256 hex digest of a chunk

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

func NewClient

func NewClient(endpoint, apiToken string, tlsVerify bool, fingerprint string) *Client

NewClient creates a new PBS API client

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping checks if the PBS endpoint is reachable

func (*Client) PruneDatastore

func (c *Client) PruneDatastore(ctx context.Context, datastore, namespace, backupType, backupID string, keepLast, keepDaily, keepWeekly, keepMonthly int) error

PruneDatastore executes a prune job on the PBS datastore according to retention policy

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 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL