Documentation
¶
Index ¶
- Constants
- func GetNonConfidentialArgs(profile *Profile, args *shell.Args) *shell.Args
- func GetNonConfidentialValues(profile *Profile, values []string) []string
- func ProcessConfidentialValues(profile *Profile)
- func ShowStruct(w io.Writer, orig interface{}, name string) error
- type BackupSection
- type ConfidentialValue
- type Config
- func (c *Config) AllSettings() map[string]interface{}
- func (c *Config) Get(key string) interface{}
- func (c *Config) GetConfigFile() string
- func (c *Config) GetGlobalSection() (*Global, error)
- func (c *Config) GetProfile(profileKey string) (*Profile, error)
- func (c *Config) GetProfileGroup(groupKey string) ([]string, error)
- func (c *Config) GetProfileGroups() map[string][]string
- func (c *Config) GetProfileSections() map[string]ProfileInfo
- func (c *Config) HasProfile(profileKey string) bool
- func (c *Config) HasProfileGroup(groupKey string) bool
- func (c *Config) IsSet(key string) bool
- type Display
- type Entry
- type Global
- type OtherSectionWithSchedule
- type Profile
- func (p *Profile) GetBackupSource() []string
- func (p *Profile) GetCommandFlags(command string) *shell.Args
- func (p *Profile) GetCommonFlags() *shell.Args
- func (p *Profile) GetRetentionFlags() *shell.Args
- func (p *Profile) HasDeprecatedRetentionSchedule() bool
- func (p *Profile) SchedulableCommands() []string
- func (p *Profile) Schedules() []*ScheduleConfig
- func (p *Profile) SetHost(hostname string)
- func (p *Profile) SetLegacyArg(legacy bool)
- func (p *Profile) SetRootPath(rootPath string)
- type ProfileInfo
- type ProfileTemplateData
- type RetentionSection
- type ScheduleConfig
- func (s *ScheduleConfig) Arguments() []string
- func (s *ScheduleConfig) Command() string
- func (s *ScheduleConfig) Configfile() string
- func (s *ScheduleConfig) Environment() map[string]string
- func (s *ScheduleConfig) GetFlag(name string) (string, bool)
- func (s *ScheduleConfig) JobDescription() string
- func (s *ScheduleConfig) LockMode() ScheduleLockMode
- func (s *ScheduleConfig) LockWait() time.Duration
- func (s *ScheduleConfig) Logfile() string
- func (s *ScheduleConfig) Permission() string
- func (s *ScheduleConfig) Priority() string
- func (s *ScheduleConfig) Schedules() []string
- func (s *ScheduleConfig) SetCommand(wd, command string, args []string)
- func (s *ScheduleConfig) SetFlag(name, value string)
- func (s *ScheduleConfig) SetJobDescription(description string)
- func (s *ScheduleConfig) SetTimerDescription(description string)
- func (s *ScheduleConfig) SubTitle() string
- func (s *ScheduleConfig) TimerDescription() string
- func (s *ScheduleConfig) Title() string
- func (s *ScheduleConfig) WorkingDirectory() string
- type ScheduleLockMode
- type ScheduleSection
- type TemplateData
Constants ¶
const ( // ScheduleLockModeDefault waits on acquiring a lock (local and repository) for up to ScheduleConfig lockWait (duration), before failing a schedule. // With lockWait set to 0, ScheduleLockModeDefault and ScheduleLockModeFail behave the same. ScheduleLockModeDefault = ScheduleLockMode(0) // ScheduleLockModeFail fails immediately on a lock failure without waiting. ScheduleLockModeFail = ScheduleLockMode(1) // ScheduleLockModeIgnore does not create or fail on resticprofile locks. Repository locks cause an immediate failure. ScheduleLockModeIgnore = ScheduleLockMode(2) )
const ConfidentialReplacement = "×××"
Variables ¶
This section is empty.
Functions ¶
func GetNonConfidentialArgs ¶ added in v0.15.0
GetNonConfidentialArgs returns new shell.Args with confidential values being replaced with their public representation
func GetNonConfidentialValues ¶ added in v0.15.0
GetNonConfidentialValues returns a new list with confidential values being replaced with their public representation
func ProcessConfidentialValues ¶ added in v0.15.0
func ProcessConfidentialValues(profile *Profile)
ProcessConfidentialValues hides confidential parts inside the specified Profile.
Types ¶
type BackupSection ¶
type BackupSection struct {
ScheduleSection `mapstructure:",squash"`
CheckBefore bool `mapstructure:"check-before"`
CheckAfter bool `mapstructure:"check-after"`
RunBefore []string `mapstructure:"run-before"`
RunAfter []string `mapstructure:"run-after"`
UseStdin bool `mapstructure:"stdin" argument:"stdin"`
Source []string `mapstructure:"source"`
Exclude []string `mapstructure:"exclude" argument:"exclude" argument-type:"no-glob"`
Iexclude []string `mapstructure:"iexclude" argument:"iexclude" argument-type:"no-glob"`
ExcludeFile []string `mapstructure:"exclude-file" argument:"exclude-file"`
FilesFrom []string `mapstructure:"files-from" argument:"files-from"`
ExtendedStatus bool `mapstructure:"extended-status" argument:"json"`
NoErrorOnWarning bool `mapstructure:"no-error-on-warning"`
OtherFlags map[string]interface{} `mapstructure:",remain"`
}
BackupSection contains the specific configuration to the 'backup' command
type ConfidentialValue ¶ added in v0.15.0
type ConfidentialValue struct {
// contains filtered or unexported fields
}
ConfidentialValue is a string value with a public and a confidential representation
func NewConfidentialValue ¶ added in v0.15.0
func NewConfidentialValue(value string) ConfidentialValue
func (*ConfidentialValue) IsConfidential ¶ added in v0.15.0
func (c *ConfidentialValue) IsConfidential() bool
func (ConfidentialValue) String ¶ added in v0.15.0
func (c ConfidentialValue) String() string
func (ConfidentialValue) Value ¶ added in v0.15.0
func (c ConfidentialValue) Value() string
type Config ¶ added in v0.8.0
type Config struct {
// contains filtered or unexported fields
}
Config wraps up a viper configuration object
func LoadFile ¶ added in v0.8.0
LoadFile loads configuration from file Leave format blank for auto-detection from the file extension
func (*Config) AllSettings ¶ added in v0.8.0
AllSettings merges all settings and returns them as a map[string]interface{}.
func (*Config) GetConfigFile ¶ added in v0.8.0
GetConfigFile returns the config file used
func (*Config) GetGlobalSection ¶ added in v0.8.0
GetGlobalSection returns the global configuration
func (*Config) GetProfile ¶ added in v0.8.0
GetProfile in configuration
func (*Config) GetProfileGroup ¶ added in v0.8.0
GetProfileGroup returns the list of profiles in a group
func (*Config) GetProfileGroups ¶ added in v0.8.0
GetProfileGroups returns all groups from the configuration
If the groups section does not exist, it returns an empty map
func (*Config) GetProfileSections ¶ added in v0.8.0
func (c *Config) GetProfileSections() map[string]ProfileInfo
GetProfileSections returns a list of profiles with all the sections defined inside each
func (*Config) HasProfile ¶ added in v0.8.0
HasProfile returns true if the profile exists in the configuration
func (*Config) HasProfileGroup ¶ added in v0.8.0
HasProfileGroup returns true if the group of profiles exists in the configuration
type Display ¶ added in v0.11.0
type Display struct {
// contains filtered or unexported fields
}
Display is a temporary struct to display a config object to the console
type Entry ¶ added in v0.11.0
type Entry struct {
// contains filtered or unexported fields
}
Entry of configuration to display to the console
type Global ¶
type Global struct {
IONice bool `mapstructure:"ionice"`
IONiceClass int `mapstructure:"ionice-class"`
IONiceLevel int `mapstructure:"ionice-level"`
Nice int `mapstructure:"nice"`
Priority string `mapstructure:"priority"`
DefaultCommand string `mapstructure:"default-command"`
Initialize bool `mapstructure:"initialize"`
ResticBinary string `mapstructure:"restic-binary"`
ResticLockRetryAfter time.Duration `mapstructure:"restic-lock-retry-after"`
ResticStaleLockAge time.Duration `mapstructure:"restic-stale-lock-age"`
MinMemory uint64 `mapstructure:"min-memory"`
Scheduler string `mapstructure:"scheduler"`
LegacyArguments bool `mapstructure:"legacy-arguments"` // broken arguments mode (before v0.15.0)
}
Global holds the configuration from the global section
type OtherSectionWithSchedule ¶ added in v0.9.0
type OtherSectionWithSchedule struct {
ScheduleSection `mapstructure:",squash"`
OtherFlags map[string]interface{} `mapstructure:",remain"`
}
OtherSectionWithSchedule is a section containing schedule only specific parameters (the other parameters being for restic)
type Profile ¶
type Profile struct {
Name string
Description string `mapstructure:"description"`
Quiet bool `mapstructure:"quiet" argument:"quiet"`
Verbose bool `mapstructure:"verbose" argument:"verbose"`
Repository ConfidentialValue `mapstructure:"repository" argument:"repo"`
PasswordFile string `mapstructure:"password-file" argument:"password-file"`
CacheDir string `mapstructure:"cache-dir" argument:"cache-dir"`
CACert string `mapstructure:"cacert" argument:"cacert"`
TLSClientCert string `mapstructure:"tls-client-cert" argument:"tls-client-cert"`
Initialize bool `mapstructure:"initialize"`
Inherit string `mapstructure:"inherit"`
Lock string `mapstructure:"lock"`
ForceLock bool `mapstructure:"force-inactive-lock"`
RunBefore []string `mapstructure:"run-before"`
RunAfter []string `mapstructure:"run-after"`
RunAfterFail []string `mapstructure:"run-after-fail"`
StatusFile string `mapstructure:"status-file"`
PrometheusSaveToFile string `mapstructure:"prometheus-save-to-file"`
PrometheusPush string `mapstructure:"prometheus-push"`
PrometheusLabels map[string]string `mapstructure:"prometheus-labels"`
OtherFlags map[string]interface{} `mapstructure:",remain"`
Environment map[string]ConfidentialValue `mapstructure:"env"`
Backup *BackupSection `mapstructure:"backup"`
Retention *RetentionSection `mapstructure:"retention"`
Check *OtherSectionWithSchedule `mapstructure:"check"`
Prune *OtherSectionWithSchedule `mapstructure:"prune"`
Snapshots map[string]interface{} `mapstructure:"snapshots"`
Forget *OtherSectionWithSchedule `mapstructure:"forget"`
Mount map[string]interface{} `mapstructure:"mount"`
// contains filtered or unexported fields
}
Profile contains the whole profile configuration
func NewProfile ¶
NewProfile instantiates a new blank profile
func (*Profile) GetBackupSource ¶
GetBackupSource returns the directories to backup
func (*Profile) GetCommandFlags ¶
GetCommandFlags returns the flags specific to the command (backup, snapshots, forget, etc.)
func (*Profile) GetCommonFlags ¶
GetCommonFlags returns the flags common to all commands
func (*Profile) GetRetentionFlags ¶
GetRetentionFlags returns the flags specific to the "forget" command being run as part of a backup
func (*Profile) HasDeprecatedRetentionSchedule ¶ added in v0.11.0
HasDeprecatedRetentionSchedule indicates if there's one or more schedule parameters in the retention section, which is deprecated as of 0.11.0
func (*Profile) SchedulableCommands ¶ added in v0.12.0
SchedulableCommands returns all command names that could have a schedule
func (*Profile) Schedules ¶ added in v0.9.0
func (p *Profile) Schedules() []*ScheduleConfig
Schedules returns a slice of ScheduleConfig that satisfy the schedule.Config interface
func (*Profile) SetLegacyArg ¶ added in v0.15.0
SetLegacyArg is used to activate the legacy (broken) mode of sending arguments on the restic command line
func (*Profile) SetRootPath ¶
SetRootPath changes the path of all the relative paths and files in the configuration
type ProfileInfo ¶ added in v0.15.0
ProfileInfo is used to display a quick information on available profiles (descrition and defined commands)
func NewProfileInfo ¶ added in v0.15.0
func NewProfileInfo() ProfileInfo
type ProfileTemplateData ¶ added in v0.10.0
type ProfileTemplateData struct {
Name string
}
ProfileTemplateData contains profile data
type RetentionSection ¶
type RetentionSection struct {
ScheduleSection `mapstructure:",squash"`
BeforeBackup bool `mapstructure:"before-backup"`
AfterBackup bool `mapstructure:"after-backup"`
OtherFlags map[string]interface{} `mapstructure:",remain"`
}
RetentionSection contains the specific configuration to the 'forget' command when running as part of a backup
type ScheduleConfig ¶ added in v0.9.0
type ScheduleConfig struct {
// contains filtered or unexported fields
}
ScheduleConfig contains all information to schedule a profile command
func (*ScheduleConfig) Arguments ¶ added in v0.9.0
func (s *ScheduleConfig) Arguments() []string
func (*ScheduleConfig) Command ¶ added in v0.9.0
func (s *ScheduleConfig) Command() string
func (*ScheduleConfig) Configfile ¶ added in v0.11.0
func (s *ScheduleConfig) Configfile() string
func (*ScheduleConfig) Environment ¶ added in v0.9.0
func (s *ScheduleConfig) Environment() map[string]string
func (*ScheduleConfig) GetFlag ¶ added in v0.11.0
func (s *ScheduleConfig) GetFlag(name string) (string, bool)
func (*ScheduleConfig) JobDescription ¶ added in v0.9.0
func (s *ScheduleConfig) JobDescription() string
func (*ScheduleConfig) LockMode ¶ added in v0.14.0
func (s *ScheduleConfig) LockMode() ScheduleLockMode
func (*ScheduleConfig) LockWait ¶ added in v0.14.0
func (s *ScheduleConfig) LockWait() time.Duration
func (*ScheduleConfig) Logfile ¶ added in v0.9.0
func (s *ScheduleConfig) Logfile() string
func (*ScheduleConfig) Permission ¶ added in v0.9.0
func (s *ScheduleConfig) Permission() string
func (*ScheduleConfig) Priority ¶ added in v0.11.0
func (s *ScheduleConfig) Priority() string
Priority is either "background" or "standard"
func (*ScheduleConfig) Schedules ¶ added in v0.9.0
func (s *ScheduleConfig) Schedules() []string
func (*ScheduleConfig) SetCommand ¶ added in v0.9.0
func (s *ScheduleConfig) SetCommand(wd, command string, args []string)
func (*ScheduleConfig) SetFlag ¶ added in v0.11.0
func (s *ScheduleConfig) SetFlag(name, value string)
func (*ScheduleConfig) SetJobDescription ¶ added in v0.9.0
func (s *ScheduleConfig) SetJobDescription(description string)
func (*ScheduleConfig) SetTimerDescription ¶ added in v0.9.0
func (s *ScheduleConfig) SetTimerDescription(description string)
func (*ScheduleConfig) SubTitle ¶ added in v0.9.0
func (s *ScheduleConfig) SubTitle() string
func (*ScheduleConfig) TimerDescription ¶ added in v0.9.0
func (s *ScheduleConfig) TimerDescription() string
func (*ScheduleConfig) Title ¶ added in v0.9.0
func (s *ScheduleConfig) Title() string
func (*ScheduleConfig) WorkingDirectory ¶ added in v0.9.0
func (s *ScheduleConfig) WorkingDirectory() string
type ScheduleLockMode ¶ added in v0.14.0
type ScheduleLockMode int8
type ScheduleSection ¶ added in v0.11.0
type ScheduleSection struct {
Schedule []string `mapstructure:"schedule"`
SchedulePermission string `mapstructure:"schedule-permission"`
ScheduleLog string `mapstructure:"schedule-log"`
SchedulePriority string `mapstructure:"schedule-priority"`
ScheduleLockMode string `mapstructure:"schedule-lock-mode"`
ScheduleLockWait time.Duration `mapstructure:"schedule-lock-wait"`
}
ScheduleSection contains the parameters for scheduling a command (backup, check, forget, etc.)