restic

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigNotFound           = errors.New("config file not found")
	ErrConfigBackupNameNotFound = errors.New("backup name in config not found")
)
View Source
var (
	ErrSshConfigNotFound = errors.New("user ssh config file not found")
)

Functions

func ResticCheck

func ResticCheck() error

ResticCheck checks if "restic" command is available in system path

Types

type Backup

type Backup struct {
	Name   string           `yaml:"name"`
	Type   string           `yaml:"type"`
	Config BackupTypeConfig `yaml:"config"`
}

type BackupTypeConfig

type BackupTypeConfig interface {
	Validate() error
	String() string
}

type Config

type Config struct {
	Repository ConfigRepository `yaml:"repository"`
	Backups    []Backup         `yaml:"backups"`
}

func NewConfig

func NewConfig(filepath string) (*Config, error)

NewConfig read in file and return restic Config type struct

func (*Config) BackupNames

func (c *Config) BackupNames() []string

func (*Config) CreateRepositoryStruct

func (c *Config) CreateRepositoryStruct(bConf BackupTypeConfig) (ResticRepository, error)

func (*Config) CreateTestStruct

func (c *Config) CreateTestStruct(bConf BackupTypeConfig) (tests.ResticTest, error)

func (*Config) IsValidName

func (c *Config) IsValidName(name string) bool

func (*Config) ReadBackup

func (c *Config) ReadBackup(name string) (Backup, error)

ReadBackup find Backup struct with given name and returns it. Return ErrConfigBackupNameNotFound error if no matching name found in config

type ConfigRepository

type ConfigRepository struct {
	Password string `yaml:"password"`
}

type LocalBackupConfig

type LocalBackupConfig struct {
	Sources     []string `yaml:"sources"`
	Destination string   `yaml:"destination"`
	Excludes    []string `yaml:"excludes"`
}

func (LocalBackupConfig) String

func (c LocalBackupConfig) String() string

func (LocalBackupConfig) Validate

func (c LocalBackupConfig) Validate() error

type LocalBackupRepository

type LocalBackupRepository struct {
	Password    string
	Destination string
	Sources     []string
	Excludes    []string
}

func (LocalBackupRepository) Backup

func (r LocalBackupRepository) Backup() error

func (LocalBackupRepository) Check

func (r LocalBackupRepository) Check() error

func (LocalBackupRepository) Init

func (r LocalBackupRepository) Init() ([]byte, error)

func (LocalBackupRepository) Snapshots

func (r LocalBackupRepository) Snapshots() ([]byte, error)

type ResticRepository

type ResticRepository interface {
	Init() ([]byte, error)
	Backup() error
	Snapshots() ([]byte, error)
	Check() error
}

type S3BackupConfig

type S3BackupConfig struct {
	AccessKeyId     string   `yaml:"accessKeyId"`
	SecretAccessKey string   `yaml:"secretAccessKey"`
	Region          string   `yaml:"region"`
	Sources         []string `yaml:"sources"`
	Destination     string   `yaml:"destination"`
	Excludes        []string `yaml:"excludes"`
}

func (S3BackupConfig) String

func (c S3BackupConfig) String() string

func (S3BackupConfig) Validate

func (c S3BackupConfig) Validate() error

type S3BackupRepository

type S3BackupRepository struct {
	Password        string
	Destination     string
	Sources         []string
	Excludes        []string
	AccessKeyId     string
	SecretAccessKey string
}

func (S3BackupRepository) Backup

func (r S3BackupRepository) Backup() error

func (S3BackupRepository) Check

func (r S3BackupRepository) Check() error

func (S3BackupRepository) Init

func (r S3BackupRepository) Init() ([]byte, error)

func (S3BackupRepository) Snapshots

func (r S3BackupRepository) Snapshots() ([]byte, error)

type SftpBackupConfig

type SftpBackupConfig struct {
	Host        string   `yaml:"host"`
	Sources     []string `yaml:"sources"`
	Destination string   `yaml:"destination"`
	Excludes    []string `yaml:"excludes"`
}

func (SftpBackupConfig) String

func (c SftpBackupConfig) String() string

func (SftpBackupConfig) Validate

func (c SftpBackupConfig) Validate() error

type SftpBackupRepository

type SftpBackupRepository struct {
	Password    string
	Destination string
	Sources     []string
	Excludes    []string
	ConfigHost  string
}

func (SftpBackupRepository) Backup

func (r SftpBackupRepository) Backup() error

func (SftpBackupRepository) Check

func (r SftpBackupRepository) Check() error

func (SftpBackupRepository) Init

func (r SftpBackupRepository) Init() ([]byte, error)

func (SftpBackupRepository) Snapshots

func (r SftpBackupRepository) Snapshots() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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