backup

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChildrenType_QEMU    ChildrenType = "qemu"
	ChildrenType_LXC     ChildrenType = "lxc"
	ChildrenType_UNKNOWN ChildrenType = "unknown"

	Compress_0    Compress = "0"
	Compress_1    Compress = "1"
	Compress_GZIP Compress = "gzip"
	Compress_LZO  Compress = "lzo"
	Compress_ZSTD Compress = "zstd"

	Mailnotification_ALWAYS  Mailnotification = "always"
	Mailnotification_FAILURE Mailnotification = "failure"

	Mode_SNAPSHOT Mode = "snapshot"
	Mode_SUSPEND  Mode = "suspend"
	Mode_STOP     Mode = "stop"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Children added in v0.0.10

type Children struct {
	Id       string       `url:"id" json:"id"`             // Configuration key of the volume.
	Included util.PVEBool `url:"included" json:"included"` // Whether the volume is included in the backup or not.
	Name     string       `url:"name" json:"name"`         // Name of the volume.
	Reason   string       `url:"reason" json:"reason"`     // The reason why the volume is included (or excluded).

}

type ChildrenType added in v0.0.15

type ChildrenType string

func PtrChildrenType added in v0.0.15

func PtrChildrenType(i ChildrenType) *ChildrenType

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(c HTTPClient) *Client

func (*Client) Create

func (c *Client) Create(ctx context.Context, req CreateRequest) error

Create Create new vzdump backup job.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, req DeleteRequest) error

Delete Delete vzdump backup job definition.

func (*Client) Find

func (c *Client) Find(ctx context.Context, req FindRequest) (map[string]interface{}, error)

Find Read vzdump backup job definition.

func (*Client) GetVolumeBackupIncludedIncludedVolumes

GetVolumeBackupIncludedIncludedVolumes Returns included guests and the backup status of their disks. Optimized to be used in ExtJS tree views.

func (*Client) Index

func (c *Client) Index(ctx context.Context) ([]IndexResponse, error)

Index List vzdump backup schedule.

func (*Client) Update

func (c *Client) Update(ctx context.Context, req UpdateRequest) error

Update Update vzdump backup job definition.

type Compress added in v0.0.15

type Compress string

func PtrCompress added in v0.0.15

func PtrCompress(i Compress) *Compress

type CreateRequest

type CreateRequest struct {

	// The following parameters are optional
	All              *util.PVEBool     `url:"all,omitempty" json:"all,omitempty"`                           // Backup all known guest systems on this host.
	Bwlimit          *int              `url:"bwlimit,omitempty" json:"bwlimit,omitempty"`                   // Limit I/O bandwidth (KBytes per second).
	Comment          *string           `url:"comment,omitempty" json:"comment,omitempty"`                   // Description for the Job.
	Compress         *Compress         `url:"compress,omitempty" json:"compress,omitempty"`                 // Compress dump file.
	Dow              *string           `url:"dow,omitempty" json:"dow,omitempty"`                           // Day of week selection.
	Dumpdir          *string           `url:"dumpdir,omitempty" json:"dumpdir,omitempty"`                   // Store resulting files to specified directory.
	Enabled          *util.PVEBool     `url:"enabled,omitempty" json:"enabled,omitempty"`                   // Enable or disable the job.
	Exclude          *string           `url:"exclude,omitempty" json:"exclude,omitempty"`                   // Exclude specified guest systems (assumes --all)
	ExcludePath      *string           `url:"exclude-path,omitempty" json:"exclude-path,omitempty"`         // Exclude certain files/directories (shell globs). Paths starting with '/' are anchored to the container's root, other paths match relative to each subdirectory.
	Id               *string           `url:"id,omitempty" json:"id,omitempty"`                             // Job ID (will be autogenerated).
	Ionice           *int              `url:"ionice,omitempty" json:"ionice,omitempty"`                     // Set CFQ ionice priority.
	Lockwait         *int              `url:"lockwait,omitempty" json:"lockwait,omitempty"`                 // Maximal time to wait for the global lock (minutes).
	Mailnotification *Mailnotification `url:"mailnotification,omitempty" json:"mailnotification,omitempty"` // Specify when to send an email
	Mailto           *string           `url:"mailto,omitempty" json:"mailto,omitempty"`                     // Comma-separated list of email addresses or users that should receive email notifications.
	Maxfiles         *int              `url:"maxfiles,omitempty" json:"maxfiles,omitempty"`                 // Deprecated: use 'prune-backups' instead. Maximal number of backup files per guest system.
	Mode             *Mode             `url:"mode,omitempty" json:"mode,omitempty"`                         // Backup mode.
	Node             *string           `url:"node,omitempty" json:"node,omitempty"`                         // Only run if executed on this node.
	NotesTemplate    *string           `url:"notes-template,omitempty" json:"notes-template,omitempty"`     // Template string for generating notes for the backup(s). It can contain variables which will be replaced by their values. Currently supported are {{cluster}}, {{guestname}}, {{node}}, and {{vmid}}, but more might be added in the future. Needs to be a single line, newline and backslash need to be escaped as '\n' and '\\' respectively.
	Performance      *string           `url:"performance,omitempty" json:"performance,omitempty"`           // Other performance-related settings.
	Pigz             *int              `url:"pigz,omitempty" json:"pigz,omitempty"`                         // Use pigz instead of gzip when N>0. N=1 uses half of cores, N>1 uses N as thread count.
	Pool             *string           `url:"pool,omitempty" json:"pool,omitempty"`                         // Backup all known guest systems included in the specified pool.
	Protected        *util.PVEBool     `url:"protected,omitempty" json:"protected,omitempty"`               // If true, mark backup(s) as protected.
	PruneBackups     *string           `url:"prune-backups,omitempty" json:"prune-backups,omitempty"`       // Use these retention options instead of those from the storage configuration.
	Quiet            *util.PVEBool     `url:"quiet,omitempty" json:"quiet,omitempty"`                       // Be quiet.
	Remove           *util.PVEBool     `url:"remove,omitempty" json:"remove,omitempty"`                     // Prune older backups according to 'prune-backups'.
	RepeatMissed     *util.PVEBool     `url:"repeat-missed,omitempty" json:"repeat-missed,omitempty"`       // If true, the job will be run as soon as possible if it was missed while the scheduler was not running.
	Schedule         *string           `url:"schedule,omitempty" json:"schedule,omitempty"`                 // Backup schedule. The format is a subset of `systemd` calendar events.
	Script           *string           `url:"script,omitempty" json:"script,omitempty"`                     // Use specified hook script.
	Starttime        *string           `url:"starttime,omitempty" json:"starttime,omitempty"`               // Job Start time.
	Stdexcludes      *util.PVEBool     `url:"stdexcludes,omitempty" json:"stdexcludes,omitempty"`           // Exclude temporary files and logs.
	Stop             *util.PVEBool     `url:"stop,omitempty" json:"stop,omitempty"`                         // Stop running backup jobs on this host.
	Stopwait         *int              `url:"stopwait,omitempty" json:"stopwait,omitempty"`                 // Maximal time to wait until a guest system is stopped (minutes).
	Storage          *string           `url:"storage,omitempty" json:"storage,omitempty"`                   // Store resulting file to this storage.
	Tmpdir           *string           `url:"tmpdir,omitempty" json:"tmpdir,omitempty"`                     // Store temporary files to specified directory.
	Vmid             *string           `url:"vmid,omitempty" json:"vmid,omitempty"`                         // The ID of the guest system you want to backup.
	Zstd             *int              `url:"zstd,omitempty" json:"zstd,omitempty"`                         // Zstd threads. N=0 uses half of the available cores, N>0 uses N as thread count.
}

type DeleteRequest

type DeleteRequest struct {
	Id string `url:"id" json:"id"` // The job ID.

}

type FindRequest

type FindRequest struct {
	Id string `url:"id" json:"id"` // The job ID.

}

type GetVolumeBackupIncludedIncludedVolumesRequest

type GetVolumeBackupIncludedIncludedVolumesRequest struct {
	Id string `url:"id" json:"id"` // The job ID.

}

type GetVolumeBackupIncludedIncludedVolumesResponse

type GetVolumeBackupIncludedIncludedVolumesResponse struct {
	Children []Children `url:"children" json:"children"`
}

Root node of the tree object. Children represent guests, grandchildren represent volumes of that guest.

type HTTPClient

type HTTPClient interface {
	Do(context.Context, string, string, interface{}, interface{}) error
}

type IndexResponse

type IndexResponse struct {
	Id string `url:"id" json:"id"` // The job ID.

}

type Mailnotification added in v0.0.15

type Mailnotification string

func PtrMailnotification added in v0.0.15

func PtrMailnotification(i Mailnotification) *Mailnotification

type Mode added in v0.0.15

type Mode string

func PtrMode added in v0.0.15

func PtrMode(i Mode) *Mode

type SubChildren added in v0.0.10

type SubChildren struct {
	Id   int          `url:"id" json:"id"`     // VMID of the guest.
	Type ChildrenType `url:"type" json:"type"` // Type of the guest, VM, CT or unknown for removed but not purged guests.

	// The following parameters are optional
	Children *[]Children `url:"children,omitempty" json:"children,omitempty"` // The volumes of the guest with the information if they will be included in backups.
	Name     *string     `url:"name,omitempty" json:"name,omitempty"`         // Name of the guest
}

type UpdateRequest

type UpdateRequest struct {
	Id string `url:"id" json:"id"` // The job ID.

	// The following parameters are optional
	All              *util.PVEBool     `url:"all,omitempty" json:"all,omitempty"`                           // Backup all known guest systems on this host.
	Bwlimit          *int              `url:"bwlimit,omitempty" json:"bwlimit,omitempty"`                   // Limit I/O bandwidth (KBytes per second).
	Comment          *string           `url:"comment,omitempty" json:"comment,omitempty"`                   // Description for the Job.
	Compress         *Compress         `url:"compress,omitempty" json:"compress,omitempty"`                 // Compress dump file.
	Delete           *string           `url:"delete,omitempty" json:"delete,omitempty"`                     // A list of settings you want to delete.
	Dow              *string           `url:"dow,omitempty" json:"dow,omitempty"`                           // Day of week selection.
	Dumpdir          *string           `url:"dumpdir,omitempty" json:"dumpdir,omitempty"`                   // Store resulting files to specified directory.
	Enabled          *util.PVEBool     `url:"enabled,omitempty" json:"enabled,omitempty"`                   // Enable or disable the job.
	Exclude          *string           `url:"exclude,omitempty" json:"exclude,omitempty"`                   // Exclude specified guest systems (assumes --all)
	ExcludePath      *string           `url:"exclude-path,omitempty" json:"exclude-path,omitempty"`         // Exclude certain files/directories (shell globs). Paths starting with '/' are anchored to the container's root, other paths match relative to each subdirectory.
	Ionice           *int              `url:"ionice,omitempty" json:"ionice,omitempty"`                     // Set CFQ ionice priority.
	Lockwait         *int              `url:"lockwait,omitempty" json:"lockwait,omitempty"`                 // Maximal time to wait for the global lock (minutes).
	Mailnotification *Mailnotification `url:"mailnotification,omitempty" json:"mailnotification,omitempty"` // Specify when to send an email
	Mailto           *string           `url:"mailto,omitempty" json:"mailto,omitempty"`                     // Comma-separated list of email addresses or users that should receive email notifications.
	Maxfiles         *int              `url:"maxfiles,omitempty" json:"maxfiles,omitempty"`                 // Deprecated: use 'prune-backups' instead. Maximal number of backup files per guest system.
	Mode             *Mode             `url:"mode,omitempty" json:"mode,omitempty"`                         // Backup mode.
	Node             *string           `url:"node,omitempty" json:"node,omitempty"`                         // Only run if executed on this node.
	NotesTemplate    *string           `url:"notes-template,omitempty" json:"notes-template,omitempty"`     // Template string for generating notes for the backup(s). It can contain variables which will be replaced by their values. Currently supported are {{cluster}}, {{guestname}}, {{node}}, and {{vmid}}, but more might be added in the future. Needs to be a single line, newline and backslash need to be escaped as '\n' and '\\' respectively.
	Performance      *string           `url:"performance,omitempty" json:"performance,omitempty"`           // Other performance-related settings.
	Pigz             *int              `url:"pigz,omitempty" json:"pigz,omitempty"`                         // Use pigz instead of gzip when N>0. N=1 uses half of cores, N>1 uses N as thread count.
	Pool             *string           `url:"pool,omitempty" json:"pool,omitempty"`                         // Backup all known guest systems included in the specified pool.
	Protected        *util.PVEBool     `url:"protected,omitempty" json:"protected,omitempty"`               // If true, mark backup(s) as protected.
	PruneBackups     *string           `url:"prune-backups,omitempty" json:"prune-backups,omitempty"`       // Use these retention options instead of those from the storage configuration.
	Quiet            *util.PVEBool     `url:"quiet,omitempty" json:"quiet,omitempty"`                       // Be quiet.
	Remove           *util.PVEBool     `url:"remove,omitempty" json:"remove,omitempty"`                     // Prune older backups according to 'prune-backups'.
	RepeatMissed     *util.PVEBool     `url:"repeat-missed,omitempty" json:"repeat-missed,omitempty"`       // If true, the job will be run as soon as possible if it was missed while the scheduler was not running.
	Schedule         *string           `url:"schedule,omitempty" json:"schedule,omitempty"`                 // Backup schedule. The format is a subset of `systemd` calendar events.
	Script           *string           `url:"script,omitempty" json:"script,omitempty"`                     // Use specified hook script.
	Starttime        *string           `url:"starttime,omitempty" json:"starttime,omitempty"`               // Job Start time.
	Stdexcludes      *util.PVEBool     `url:"stdexcludes,omitempty" json:"stdexcludes,omitempty"`           // Exclude temporary files and logs.
	Stop             *util.PVEBool     `url:"stop,omitempty" json:"stop,omitempty"`                         // Stop running backup jobs on this host.
	Stopwait         *int              `url:"stopwait,omitempty" json:"stopwait,omitempty"`                 // Maximal time to wait until a guest system is stopped (minutes).
	Storage          *string           `url:"storage,omitempty" json:"storage,omitempty"`                   // Store resulting file to this storage.
	Tmpdir           *string           `url:"tmpdir,omitempty" json:"tmpdir,omitempty"`                     // Store temporary files to specified directory.
	Vmid             *string           `url:"vmid,omitempty" json:"vmid,omitempty"`                         // The ID of the guest system you want to backup.
	Zstd             *int              `url:"zstd,omitempty" json:"zstd,omitempty"`                         // Zstd threads. N=0 uses half of the available cores, N>0 uses N as thread count.
}

Jump to

Keyboard shortcuts

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