restic

package
v0.113.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PasswordIncorrect = "Password is incorrect"
	RepoDoesNotExist  = "Repo does not exist"
)
View Source
const (
	ResticPassword   = "RESTIC_PASSWORD"
	ResticRepository = "RESTIC_REPOSITORY"
	ResticCommand    = "restic"
)

Variables

This section is empty.

Functions

func BackupCommandByTag

func BackupCommandByTag(profile *param.Profile, repository, backupTag, includePath, encryptionKey string, insecureTLS bool) ([]string, error)

BackupCommandByTag returns restic backup command with tag

func CheckIfRepoIsReachable

func CheckIfRepoIsReachable(
	ctx context.Context,
	profile *param.Profile,
	artifactPrefix string,
	encryptionKey string,
	insecureTLS bool,
	cli kubernetes.Interface,
	namespace string,
	pod string,
	container string,
) error

CheckIfRepoIsReachable checks if repo can be reached by trying to list snapshots

func DoesRepoExist

func DoesRepoExist(output string) bool

DoesRepoExist checks if repo exists from Snapshot Command log

func ForgetCommandByID

func ForgetCommandByID(profile *param.Profile, repository, id, encryptionKey string, insecureTLS bool) ([]string, error)

ForgetCommandByID returns restic forget command

func GeneratePassword

func GeneratePassword() string

GeneratePassword generates a password

func GetOrCreateRepository

func GetOrCreateRepository(
	ctx context.Context,
	cli kubernetes.Interface,
	namespace,
	pod,
	container,
	artifactPrefix,
	encryptionKey string,
	insecureTLS bool,
	profile *param.Profile,
) error

GetOrCreateRepository will check if the repository already exists and initialize one if not

func InitCommand

func InitCommand(profile *param.Profile, repository, encryptionKey string, insecureTLS bool) ([]string, error)

InitCommand returns restic init command

func IsPasswordIncorrect

func IsPasswordIncorrect(output string) bool

IsPasswordIncorrect checks if password was wrong from Snapshot Command log

func LatestSnapshotsCommand

func LatestSnapshotsCommand(profile *param.Profile, repository, encryptionKey string, insecureTLS bool) ([]string, error)

LatestSnapshotsCommand returns restic snapshots command for last snapshots

func ParseResticSizeStringBytes

func ParseResticSizeStringBytes(sizeStr string) int64

ParseResticSizeStringBytes parses size strings as formatted by restic to a int64 number of bytes

func PruneCommand

func PruneCommand(profile *param.Profile, repository, encryptionKey string, insecureTLS bool) ([]string, error)

PruneCommand returns restic prune command

func RestoreCommandByID

func RestoreCommandByID(profile *param.Profile, repository, id, restorePath, encryptionKey string, insecureTLS bool) ([]string, error)

RestoreCommandByID returns restic restore command with snapshotID as the identifier

func RestoreCommandByTag

func RestoreCommandByTag(profile *param.Profile, repository, tag, restorePath, encryptionKey string, insecureTLS bool) ([]string, error)

RestoreCommandByTag returns restic restore command with tag as the identifier

func SnapshotIDFromBackupLog

func SnapshotIDFromBackupLog(output string) string

SnapshotIDFromBackupLog gets the SnapshotID from Backup Command log

func SnapshotIDFromSnapshotLog

func SnapshotIDFromSnapshotLog(output string) (string, error)

SnapshotIDFromSnapshotLog gets the SnapshotID from Snapshot Command log

func SnapshotStatsFromBackupLog

func SnapshotStatsFromBackupLog(output string) (fileCount string, backupSize string, phySize string)

SnapshotStatsFromBackupLog gets the Snapshot file count and size from Backup Command log

func SnapshotStatsFromStatsLog

func SnapshotStatsFromStatsLog(output string) (string, string, string)

SnapshotStatsFromStatsLog gets the Snapshot Stats from Stats Command log

func SnapshotStatsModeFromStatsLog

func SnapshotStatsModeFromStatsLog(output string) string

SnapshotStatsModeFromStatsLog gets the Stats mode from Stats Command log

func SnapshotsCommand

func SnapshotsCommand(profile *param.Profile, repository, encryptionKey string) ([]string, error)

SnapshotsCommand returns restic snapshots command

func SnapshotsCommandByTag

func SnapshotsCommandByTag(profile *param.Profile, repository, tag, encryptionKey string, insecureTLS bool) ([]string, error)

SnapshotsCommandByTag returns restic snapshots command

func SpaceFreedFromPruneLog

func SpaceFreedFromPruneLog(output string) string

SpaceFreedFromPruneLog gets the space freed from the prune log output For reference, here is the logging command from restic codebase:

	Verbosef("will delete %d packs and rewrite %d packs, this frees %s\n",
              len(removePacks), len(rewritePacks), formatBytes(uint64(removeBytes)))

func StatsCommandByID

func StatsCommandByID(profile *param.Profile, repository, id, mode, encryptionKey string) ([]string, error)

StatsCommandByID returns restic stats command

Types

This section is empty.

Jump to

Keyboard shortcuts

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