Documentation ¶
Index ¶
- Constants
- Variables
- func ExcludeProfileProperty(sectionName, propertyName string)
- func ExcludeProfileSection(sectionName string)
- func GetDeclaredSectionsWith[T any](p *Profile) (sections map[string]T)
- func GetNonConfidentialArgs(profile *Profile, args *shell.Args) *shell.Args
- func GetNonConfidentialValues(profile *Profile, values []string) []string
- func GetSectionWith[T any](p *Profile, name string) (result T, ok bool)
- func GetSectionsWith[T any](p *Profile) (sections map[string]T)
- func NewUTF8Reader(reader io.ReadSeeker) io.Reader
- func ProcessConfidentialValues(profile *Profile)
- func RegisterCharsetDecoder(fn DecoderFunc)
- func ShowStruct(w io.Writer, orig any, name string) error
- type BackupSection
- type ConfidentialValue
- type Config
- func (c *Config) DisplayConfigurationIssues()
- 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 *Profile, err error)
- func (c *Config) GetProfileGroup(groupKey string) (*Group, error)
- func (c *Config) GetProfileGroups() map[string]Group
- func (c *Config) GetProfileNames() (names []string)
- func (c *Config) GetProfiles() map[string]*Profile
- func (c *Config) GetScheduleSections() (schedules map[string]Schedule, err error)
- func (c *Config) GetSchedules() ([]*ScheduleConfig, error)
- func (c *Config) GetVersion() Version
- func (c *Config) HasProfile(profileKey string) bool
- func (c *Config) HasProfileGroup(groupKey string) bool
- func (c *Config) IsSet(key ...string) bool
- type CopySection
- type DecoderFunc
- type Display
- type Empty
- type Entry
- type GenericSection
- type Global
- type Group
- type InitSection
- type Monitoring
- type Named
- type NamedPropertySet
- type NumericRange
- type OtherFlags
- type OtherFlagsSection
- type Profile
- func (p *Profile) AllSections() (sections map[string]any)
- func (p *Profile) DefinedCommands() (commands []string)
- func (p *Profile) GetBackupSource() []string
- func (p *Profile) GetCommandFlags(command string) (flags *shell.Args)
- func (p *Profile) GetCommonFlags() (flags *shell.Args)
- func (p *Profile) GetCopyInitializeFlags() (args *shell.Args)
- func (p *Profile) GetMonitoringSections(command string) (monitoring SendMonitoringSections)
- func (p *Profile) GetRetentionFlags() *shell.Args
- func (p *Profile) GetRunShellCommandsSections(command string) (profileCommands RunShellCommandsSection, ...)
- func (p *Profile) HasDeprecatedRetentionSchedule() bool
- func (p *Profile) ResolveConfiguration()
- func (p *Profile) SchedulableCommands() (commands []string)
- func (p *Profile) Schedules() []*ScheduleConfig
- func (p *Profile) SetHost(hostname string)
- func (p *Profile) SetLegacyArg(legacy bool)
- func (p *Profile) SetPath(sourcePaths ...string)
- func (p *Profile) SetResticVersion(resticVersion string) (err error)
- func (p *Profile) SetRootPath(rootPath string)
- func (p *Profile) SetTag(tags ...string)
- type ProfileInfo
- type ProfileTemplateData
- type PropertyInfo
- type PropertySet
- type RetentionSection
- type RunShellCommands
- type RunShellCommandsSection
- type Schedule
- type ScheduleBaseSection
- type ScheduleConfig
- func (s *ScheduleConfig) Export() Schedule
- func (s *ScheduleConfig) GetFlag(name string) (string, bool)
- func (s *ScheduleConfig) GetLockMode() ScheduleLockMode
- func (s *ScheduleConfig) GetLockWait() time.Duration
- func (s *ScheduleConfig) GetPriority() string
- func (s *ScheduleConfig) SetCommand(wd, command string, args []string)
- func (s *ScheduleConfig) SetFlag(name, value string)
- type ScheduleLockMode
- type ScheduleTemplateData
- type Scheduling
- type SectionInfo
- type SectionWithScheduleAndMonitoring
- type SendMonitoringHeader
- type SendMonitoringSection
- type SendMonitoringSections
- type StreamErrorSection
- type TemplateData
- type TemplateInfoData
- type Version
Constants ¶
const ( FormatTOML = "toml" FormatYAML = "yaml" FormatJSON = "json" FormatHCL = "hcl" )
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 ¶
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func ExcludeProfileProperty ¶ added in v0.21.0
func ExcludeProfileProperty(sectionName, propertyName string)
ExcludeProfileProperty allows to exclude a section from the profile. To be used for overlapping commands used by restic and resticprofile.
func ExcludeProfileSection ¶ added in v0.21.0
func ExcludeProfileSection(sectionName string)
ExcludeProfileSection allows to exclude a section from the profile. To be used for overlapping commands used by restic and resticprofile.
func GetDeclaredSectionsWith ¶ added in v0.21.0
GetDeclaredSectionsWith returns all sections that implement a certain interface (including nil values)
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 GetSectionWith ¶ added in v0.21.0
GetSectionWith returns a section that implement a certain interface (excluding nil values)
func GetSectionsWith ¶ added in v0.21.0
GetSectionsWith returns all sections that implement a certain interface (excluding nil values)
func NewUTF8Reader ¶ added in v0.21.0
func NewUTF8Reader(reader io.ReadSeeker) io.Reader
NewUTF8Reader returns a reader that decodes the provided input to an UTF8 stream using registered DecoderFunc
func ProcessConfidentialValues ¶ added in v0.15.0
func ProcessConfidentialValues(profile *Profile)
ProcessConfidentialValues hides confidential parts inside the specified Profile.
func RegisterCharsetDecoder ¶ added in v0.21.0
func RegisterCharsetDecoder(fn DecoderFunc)
RegisterCharsetDecoder allow to register a func that detects and decodes the charset of an arbitrary text stream
Types ¶
type BackupSection ¶
type BackupSection struct { SectionWithScheduleAndMonitoring `mapstructure:",squash"` RunShellCommandsSection `mapstructure:",squash"` CheckBefore bool `mapstructure:"check-before" description:"Check the repository before starting the backup command"` CheckAfter bool `mapstructure:"check-after" description:"Check the repository after the backup command succeeded"` UseStdin bool `mapstructure:"stdin" argument:"stdin"` StdinCommand []string `` /* 175-byte string literal not displayed */ Source []string `mapstructure:"source" examples:"/opt/;/home/user/;C:\\Users\\User\\Documents" description:"The paths to backup"` 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" description:"Do not fail the backup when some files could not be read"` // contains filtered or unexported fields }
BackupSection contains the specific configuration to the 'backup' command
func (*BackupSection) IsEmpty ¶ added in v0.17.0
func (s *BackupSection) IsEmpty() bool
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) DisplayConfigurationIssues ¶ added in v0.17.0
func (c *Config) DisplayConfigurationIssues()
DisplayConfigurationIssues logs issues in the configuration for all profiles previously returned by GetProfile
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. If the profile is not found, it returns errNotFound
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) GetProfileNames ¶ added in v0.17.0
GetProfileNames returns all profile names defined in the configuration
func (*Config) GetProfiles ¶ added in v0.17.0
GetProfiles returns a map of all available profiles with their configuration
func (*Config) GetScheduleSections ¶ added in v0.16.1
GetScheduleSections returns a list of schedules
func (*Config) GetSchedules ¶ added in v0.16.1
func (c *Config) GetSchedules() ([]*ScheduleConfig, error)
GetSchedules loads all schedules from the configuration. !!! Nothing is using this method yet !!!
func (*Config) GetVersion ¶ added in v0.16.1
GetVersion returns the version of the configuration file. Default is Version01 if not specified or invalid
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 CopySection ¶ added in v0.16.0
type CopySection struct { SectionWithScheduleAndMonitoring `mapstructure:",squash"` RunShellCommandsSection `mapstructure:",squash"` Initialize bool `mapstructure:"initialize" description:"Initialize the secondary repository if missing"` InitializeCopyChunkerParams *bool `` /* 141-byte string literal not displayed */ Repository ConfidentialValue `mapstructure:"repository" description:"Destination repository to copy snapshots to"` RepositoryFile string `mapstructure:"repository-file" description:"File from which to read the destination repository location to copy snapshots to"` PasswordFile string `mapstructure:"password-file" description:"File to read the destination repository password from"` PasswordCommand string `mapstructure:"password-command" description:"Shell command to obtain the destination repository password from"` KeyHint string `mapstructure:"key-hint" description:"Key ID of key to try decrypting the destination repository first"` }
CopySection contains the destination parameters for a copy command
func (*CopySection) IsEmpty ¶ added in v0.17.0
func (s *CopySection) IsEmpty() bool
type DecoderFunc ¶ added in v0.21.0
type DecoderFunc func(reader io.ReadSeeker) transform.Transformer
DecoderFunc detects a charset and provides a transformer for it. May return nil when no charset was detected. The func is responsible for setting the reader's offset (e.g. rewind) before returning.
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 Empty ¶ added in v0.17.0
type Empty interface {
IsEmpty() bool
}
Empty allows to test if a section is specified or not
type Entry ¶ added in v0.11.0
type Entry struct {
// contains filtered or unexported fields
}
Entry of configuration to display to the console
type GenericSection ¶ added in v0.20.0
type GenericSection struct { OtherFlagsSection `mapstructure:",squash"` RunShellCommandsSection `mapstructure:",squash"` }
GenericSection is used for all restic commands that are not covered in specific section types
func (*GenericSection) IsEmpty ¶ added in v0.20.0
func (g *GenericSection) IsEmpty() bool
type Global ¶
type Global struct { IONice bool `` /* 161-byte string literal not displayed */ IONiceClass int `` /* 134-byte string literal not displayed */ IONiceLevel int `` /* 134-byte string literal not displayed */ Nice int `` /* 141-byte string literal not displayed */ Priority string `` /* 179-byte string literal not displayed */ DefaultCommand string `` /* 137-byte string literal not displayed */ Initialize bool `mapstructure:"initialize" default:"false" description:"Initialize a repository if missing"` ResticBinary string `mapstructure:"restic-binary" description:"Full path of the restic executable (detected if not set)"` ResticVersion string // not configurable at the moment. To be set after ResticBinary is known. FilterResticFlags bool `` /* 138-byte string literal not displayed */ ResticLockRetryAfter time.Duration `` /* 197-byte string literal not displayed */ ResticStaleLockAge time.Duration `` /* 237-byte string literal not displayed */ ShellBinary []string `` /* 152-byte string literal not displayed */ MinMemory uint64 `` /* 184-byte string literal not displayed */ Scheduler string `` /* 139-byte string literal not displayed */ LegacyArguments bool `` /* 148-byte string literal not displayed */ SystemdUnitTemplate string `` /* 194-byte string literal not displayed */ SystemdTimerTemplate string `` /* 196-byte string literal not displayed */ SenderTimeout time.Duration `` /* 204-byte string literal not displayed */ CACertificates []string `` /* 240-byte string literal not displayed */ PreventSleep bool `` /* 190-byte string literal not displayed */ GroupContinueOnError bool `` /* 160-byte string literal not displayed */ }
Global holds the configuration from the global section
func NewGlobal ¶ added in v0.14.0
func NewGlobal() *Global
NewGlobal instantiates a new Global with default values
func (*Global) SetRootPath ¶ added in v0.16.0
type Group ¶ added in v0.16.1
type Group struct { Description string `mapstructure:"description" description:"Describe the group"` Profiles []string `mapstructure:"profiles" description:"Names of the profiles belonging to this group"` ContinueOnError *bool `` /* 151-byte string literal not displayed */ }
Group of profiles
type InitSection ¶ added in v0.18.0
type InitSection struct { OtherFlagsSection `mapstructure:",squash"` CopyChunkerParams bool `mapstructure:"copy-chunker-params" argument:"copy-chunker-params"` FromKeyHint string `mapstructure:"from-key-hint" argument:"from-key-hint"` FromRepository ConfidentialValue `mapstructure:"from-repository" argument:"from-repo"` FromRepositoryFile string `mapstructure:"from-repository-file" argument:"from-repository-file"` FromPasswordFile string `mapstructure:"from-password-file" argument:"from-password-file"` FromPasswordCommand string `mapstructure:"from-password-command" argument:"from-password-command"` }
InitSection contains the specific configuration to the 'init' command
func (*InitSection) IsEmpty ¶ added in v0.19.0
func (i *InitSection) IsEmpty() bool
type Monitoring ¶ added in v0.19.0
type Monitoring interface {
GetSendMonitoring() *SendMonitoringSections
}
Monitoring provides access to http hooks inside a section
type Named ¶ added in v0.21.0
type Named interface { // Name provides the name of the item Name() string // Description provides a possibly empty description of the item Description() string }
Named provides Name and Description for an item
type NamedPropertySet ¶ added in v0.21.0
type NamedPropertySet interface { Named PropertySet }
NamedPropertySet is Named and PropertySet
func NewGlobalInfo ¶ added in v0.21.0
func NewGlobalInfo() NamedPropertySet
NewGlobalInfo returns structural information on the "global" config section
func NewGroupInfo ¶ added in v0.21.0
func NewGroupInfo() NamedPropertySet
NewGroupInfo returns structural information on the "group" config v2 section
func NewMixinUseInfo ¶ added in v0.21.0
func NewMixinUseInfo() NamedPropertySet
NewMixinUseInfo returns structural information on the mixin "use" flags in config v2
func NewMixinsInfo ¶ added in v0.21.0
func NewMixinsInfo() NamedPropertySet
NewMixinsInfo returns structural information on the "mixins" config v2 section
type NumericRange ¶ added in v0.21.0
NumericRange holds a numeric range constraint of a PropertyInfo
type OtherFlags ¶ added in v0.19.0
OtherFlags provides access to dynamic commandline flags
type OtherFlagsSection ¶ added in v0.19.0
OtherFlagsSection contains additional restic command line flags
func (OtherFlagsSection) GetOtherFlags ¶ added in v0.19.0
func (o OtherFlagsSection) GetOtherFlags() map[string]any
type Profile ¶
type Profile struct { RunShellCommandsSection `mapstructure:",squash"` OtherFlagsSection `mapstructure:",squash"` Name string Description string `mapstructure:"description" description:"Describes the profile"` Quiet bool `mapstructure:"quiet" argument:"quiet"` Verbose int `mapstructure:"verbose" argument:"verbose"` KeyHint string `mapstructure:"key-hint" argument:"key-hint"` Repository ConfidentialValue `mapstructure:"repository" argument:"repo"` RepositoryFile string `mapstructure:"repository-file" argument:"repository-file"` PasswordFile string `mapstructure:"password-file" argument:"password-file"` PasswordCommand string `mapstructure:"password-command" argument:"password-command"` 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" default:"" description:"Initialize the restic repository if missing"` Inherit string `mapstructure:"inherit" show:"noshow" description:"Name of the profile to inherit all of the settings from"` Lock string `mapstructure:"lock" description:"Path to the lock file to use with resticprofile locks"` ForceLock bool `mapstructure:"force-inactive-lock" description:"Allows to lock when the existing lock is considered stale"` StreamError []StreamErrorSection `mapstructure:"stream-error" description:"Run shell command(s) when a pattern matches the stderr of restic"` StatusFile string `mapstructure:"status-file" description:"Path to the status file to update with a summary of last restic command result"` PrometheusSaveToFile string `` /* 147-byte string literal not displayed */ PrometheusPush string `` /* 149-byte string literal not displayed */ PrometheusLabels map[string]string `mapstructure:"prometheus-labels" description:"Additional prometheus labels to set"` Environment map[string]ConfidentialValue `mapstructure:"env" description:"Additional environment variables to set in any child process"` Init *InitSection `mapstructure:"init"` Backup *BackupSection `mapstructure:"backup"` Retention *RetentionSection `mapstructure:"retention" command:"forget"` Check *SectionWithScheduleAndMonitoring `mapstructure:"check"` Prune *SectionWithScheduleAndMonitoring `mapstructure:"prune"` Forget *SectionWithScheduleAndMonitoring `mapstructure:"forget"` Copy *CopySection `mapstructure:"copy"` OtherSections map[string]*GenericSection `show:",remain"` // contains filtered or unexported fields }
Profile contains the whole profile configuration
func NewProfile ¶
NewProfile instantiates a new blank profile
func (*Profile) AllSections ¶ added in v0.21.0
AllSections returns all possible sections of this profile (including undefined sections set to nil)
func (*Profile) DefinedCommands ¶ added in v0.17.0
DefinedCommands returns all commands (also called sections) defined in the profile (backup, check, forget, etc.)
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) GetCopyInitializeFlags ¶ added in v0.21.0
GetCopyInitializeFlags returns the flags specific to the "init" command when used to initialize the copy destination
func (*Profile) GetMonitoringSections ¶ added in v0.18.0
func (p *Profile) GetMonitoringSections(command string) (monitoring SendMonitoringSections)
func (*Profile) GetRetentionFlags ¶
GetRetentionFlags returns the flags specific to the "forget" command being run as part of a backup
func (*Profile) GetRunShellCommandsSections ¶ added in v0.19.0
func (p *Profile) GetRunShellCommandsSections(command string) (profileCommands RunShellCommandsSection, sectionCommands RunShellCommandsSection)
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) ResolveConfiguration ¶ added in v0.17.0
func (p *Profile) ResolveConfiguration()
ResolveConfiguration resolves dependencies between profile config flags
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) SetPath ¶ added in v0.17.0
SetPath will replace any path value from a boolean to sourcePaths and change paths to absolute
func (*Profile) SetResticVersion ¶ added in v0.21.0
SetResticVersion sets the effective restic version for validation and to determine how to format flags. Note that flags filtering happens later inside resticWrapper and is not necessary inside the profile.
func (*Profile) SetRootPath ¶
SetRootPath changes the path of all the relative paths and files in the configuration
type ProfileInfo ¶ added in v0.15.0
type ProfileInfo interface { // PropertySet contains properties shared across sections PropertySet // Sections returns a list of all known section names Sections() []string // SectionInfo returns information for a named section SectionInfo(name string) SectionInfo }
ProfileInfo provides structural information on profiles and can be used for specification and validation
func NewProfileInfo ¶ added in v0.15.0
func NewProfileInfo(withDefaultOptions bool) ProfileInfo
NewProfileInfo returns structural information on the "profile" config section
func NewProfileInfoForRestic ¶ added in v0.21.0
func NewProfileInfoForRestic(resticVersion string, withDefaultOptions bool) ProfileInfo
NewProfileInfoForRestic returns versioned structural information on the "profile" config section for the specified semantic resticVersion. withDefaultOptions toggles whether to include default command options with every single section.
type ProfileTemplateData ¶ added in v0.10.0
type ProfileTemplateData struct {
Name string
}
ProfileTemplateData contains profile data
type PropertyInfo ¶ added in v0.21.0
type PropertyInfo interface { // Named provides Name and Description of the property Named // IsOption indicates whether the property is a restic command option IsOption() bool // Option provides the restic option when IsOption is true Option() restic.Option // IsRequired indicates whether the property must be present in its PropertySet IsRequired() bool // IsDeprecated indicates whether the property is discontinued IsDeprecated() bool // IsSingle indicates that the property can be defined only once. IsSingle() bool // IsMultiType indicates that more than one of CanBeString, CanBeNumeric, CanBeBool & CanBePropertySet returns true IsMultiType() bool // IsAnyType indicates that all of CanBeString, CanBeNumeric & CanBeBool return true IsAnyType() bool // CanBeString indicates that the value can a string value CanBeString() bool // CanBeNumeric indicates that the value can be numeric CanBeNumeric() bool // CanBeBool indicates that the value can be boolean true or false CanBeBool() bool // CanBeNil indicates that the value can be set to null (or undefined) CanBeNil() bool // CanBePropertySet indicates that the property can be a property set (= nested object or array of objects) CanBePropertySet() bool // PropertySet returns the property set that this property can be filled with (possibly nil) PropertySet() NamedPropertySet // Format may provide a string describing the expected input format (e.g. time, duration, base64, etc.). Format() string // ValidationPattern may provide a regular expression to validate the value ValidationPattern() string // MustBeInteger indicates that a numeric value must be integer MustBeInteger() bool // DefaultValue returns the default value(s) DefaultValue() []string // ExampleValues may provide example values ExampleValues() []string // EnumValues may provide a list of all possible values EnumValues() []string // NumericRange may provide a valid range for numbers NumericRange() NumericRange }
PropertyInfo provides details on an individual property
type PropertySet ¶ added in v0.21.0
type PropertySet interface { // TypeName returns the name of the type that declared the property set. The name may be empty. TypeName() string // IsClosed indicates that a property set supports only know properties (as opposed to a non-closed set that may hold arbitrary properties) IsClosed() bool // IsAllOptions indicates that all properties in this set return IsOption true IsAllOptions() bool // Properties provides the names of all known config properties in the set Properties() []string // PropertyInfo provides information on a named property PropertyInfo(name string) PropertyInfo // OtherPropertyInfo provides information on arbitrary properties in a set where IsClosed is false. Is nil if any arbitrary property is supported. OtherPropertyInfo() PropertyInfo }
PropertySet provides structural information on a set of properties
type RetentionSection ¶
type RetentionSection struct { ScheduleBaseSection `mapstructure:",squash" deprecated:"0.11.0"` OtherFlagsSection `mapstructure:",squash"` BeforeBackup bool `mapstructure:"before-backup" description:"Apply retention before starting the backup command"` AfterBackup bool `mapstructure:"after-backup" description:"Apply retention after the backup command succeeded"` }
RetentionSection contains the specific configuration to the 'forget' command when running as part of a backup
func (*RetentionSection) IsEmpty ¶ added in v0.17.0
func (r *RetentionSection) IsEmpty() bool
type RunShellCommands ¶ added in v0.19.0
type RunShellCommands interface {
GetRunShellCommands() *RunShellCommandsSection
}
RunShellCommands provides access to shell command hooks inside a section
type RunShellCommandsSection ¶ added in v0.19.0
type RunShellCommandsSection struct { RunBefore []string `mapstructure:"run-before" description:"Run shell command(s) before a restic command"` RunAfter []string `mapstructure:"run-after" description:"Run shell command(s) after a successful restic command"` RunAfterFail []string `mapstructure:"run-after-fail" description:"Run shell command(s) after failed restic or shell commands"` RunFinally []string `mapstructure:"run-finally" description:"Run shell command(s) always, after all other commands"` }
RunShellCommandsSection is used to define shell commands that run before or after restic commands
func (*RunShellCommandsSection) GetRunShellCommands ¶ added in v0.19.0
func (r *RunShellCommandsSection) GetRunShellCommands() *RunShellCommandsSection
type Schedule ¶ added in v0.16.1
type Schedule struct { Group string `mapstructure:"group"` Profiles []string `mapstructure:"profiles"` Command string `mapstructure:"run"` Schedule []string `mapstructure:"schedule"` Permission string `mapstructure:"permission"` Log string `mapstructure:"log"` Priority string `mapstructure:"priority"` LockMode string `mapstructure:"lock-mode"` LockWait time.Duration `mapstructure:"lock-wait"` }
type ScheduleBaseSection ¶ added in v0.18.0
type ScheduleBaseSection struct { Schedule []string `` /* 254-byte string literal not displayed */ SchedulePermission string `` /* 261-byte string literal not displayed */ ScheduleLog string `` /* 179-byte string literal not displayed */ SchedulePriority string `` /* 154-byte string literal not displayed */ ScheduleLockMode string `` /* 238-byte string literal not displayed */ ScheduleLockWait time.Duration `` /* 172-byte string literal not displayed */ }
ScheduleBaseSection contains the parameters for scheduling a command (backup, check, forget, etc.)
func (*ScheduleBaseSection) GetSchedule ¶ added in v0.19.0
func (s *ScheduleBaseSection) GetSchedule() *ScheduleBaseSection
type ScheduleConfig ¶ added in v0.9.0
type ScheduleConfig struct { Title string SubTitle string Schedules []string Permission string WorkingDirectory string Command string Arguments []string Environment map[string]string JobDescription string TimerDescription string Priority string Log string LockMode string LockWait time.Duration ConfigFile string Flags map[string]string RemoveOnly bool }
ScheduleConfig contains all information to schedule a profile command
func NewRemoveOnlyConfig ¶ added in v0.18.0
func NewRemoveOnlyConfig(profileName, commandName string) *ScheduleConfig
NewRemoveOnlyConfig creates a job config that may be used to call Job.Remove() on a scheduled job
func (*ScheduleConfig) Export ¶ added in v0.16.1
func (s *ScheduleConfig) Export() Schedule
func (*ScheduleConfig) GetFlag ¶ added in v0.11.0
func (s *ScheduleConfig) GetFlag(name string) (string, bool)
func (*ScheduleConfig) GetLockMode ¶ added in v0.18.0
func (s *ScheduleConfig) GetLockMode() ScheduleLockMode
func (*ScheduleConfig) GetLockWait ¶ added in v0.18.0
func (s *ScheduleConfig) GetLockWait() time.Duration
func (*ScheduleConfig) GetPriority ¶ added in v0.18.0
func (s *ScheduleConfig) GetPriority() string
Priority is either "background" or "standard"
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)
type ScheduleLockMode ¶ added in v0.14.0
type ScheduleLockMode int8
type ScheduleTemplateData ¶ added in v0.16.1
type ScheduleTemplateData struct {
Name string
}
ScheduleTemplateData contains schedule data
type Scheduling ¶ added in v0.19.0
type Scheduling interface {
GetSchedule() *ScheduleBaseSection
}
Scheduling provides access to schedule information inside a section
type SectionInfo ¶ added in v0.21.0
type SectionInfo interface { // Named provides Name and Description of the section Named // PropertySet contains properties for this section PropertySet // IsCommandSection indicates whether the section configures a restic command IsCommandSection() bool // Command provides the restic command for the section when this is a command section Command() restic.CommandIf }
SectionInfo provides structural information on a particular profile section
type SectionWithScheduleAndMonitoring ¶ added in v0.18.0
type SectionWithScheduleAndMonitoring struct { ScheduleBaseSection `mapstructure:",squash"` SendMonitoringSections `mapstructure:",squash"` OtherFlagsSection `mapstructure:",squash"` }
SectionWithScheduleAndMonitoring is a section containing schedule, shell command hooks and monitoring (all the other parameters being for restic)
func (*SectionWithScheduleAndMonitoring) IsEmpty ¶ added in v0.18.0
func (s *SectionWithScheduleAndMonitoring) IsEmpty() bool
type SendMonitoringHeader ¶ added in v0.18.0
type SendMonitoringHeader struct { Name string `` /* 171-byte string literal not displayed */ Value ConfidentialValue `` /* 192-byte string literal not displayed */ }
SendMonitoringHeader is used to send HTTP headers
type SendMonitoringSection ¶ added in v0.18.0
type SendMonitoringSection struct { Method string `` /* 128-byte string literal not displayed */ URL ConfidentialValue `mapstructure:"url" format:"uri" description:"URL of the target to send to"` Headers []SendMonitoringHeader `mapstructure:"headers" description:"Additional HTTP headers to send with the request"` Body string `mapstructure:"body" description:"Request body, overrides \"body-template\""` BodyTemplate string `` /* 193-byte string literal not displayed */ SkipTLS bool `` /* 131-byte string literal not displayed */ }
SendMonitoringSection is used to send monitoring information to third party software
type SendMonitoringSections ¶ added in v0.18.0
type SendMonitoringSections struct { SendBefore []SendMonitoringSection `mapstructure:"send-before" description:"Send HTTP request(s) before a restic command"` SendAfter []SendMonitoringSection `mapstructure:"send-after" description:"Send HTTP request(s) after a successful restic command"` SendAfterFail []SendMonitoringSection `mapstructure:"send-after-fail" description:"Send HTTP request(s) after failed restic or shell commands"` SendFinally []SendMonitoringSection `mapstructure:"send-finally" description:"Send HTTP request(s) always, after all other commands"` }
SendMonitoringSections is a group of target to send monitoring information
func (*SendMonitoringSections) GetSendMonitoring ¶ added in v0.19.0
func (s *SendMonitoringSections) GetSendMonitoring() *SendMonitoringSections
type StreamErrorSection ¶ added in v0.17.0
type StreamErrorSection struct { Pattern string `` /* 138-byte string literal not displayed */ MinMatches int `` /* 147-byte string literal not displayed */ MaxRuns int `mapstructure:"max-runs" range:"[0:]" description:"Maximum amount of times that \"run\" is started ; 0 for no limit"` Run string `mapstructure:"run" description:"The shell command to run when the pattern matches"` }
type TemplateData ¶ added in v0.10.0
type TemplateData struct { templates.DefaultData Profile ProfileTemplateData Schedule ScheduleTemplateData ConfigDir string }
TemplateData contain the variables fed to a config template
type TemplateInfoData ¶ added in v0.21.0
type TemplateInfoData struct { templates.DefaultData Global, Group PropertySet Profile ProfileInfo KnownResticVersions []string }
TemplateInfoData is used as data for go templates that render config references
func NewTemplateInfoData ¶ added in v0.21.0
func NewTemplateInfoData(resticVersion string) *TemplateInfoData
NewTemplateInfoData returns template data to render references for the specified resticVersion
func (*TemplateInfoData) GetFuncs ¶ added in v0.21.0
func (t *TemplateInfoData) GetFuncs() map[string]any
GetFuncs returns a map of helpers to be used as methods when rendering templates
func (*TemplateInfoData) NestedProfileSections ¶ added in v0.21.0
func (t *TemplateInfoData) NestedProfileSections() []SectionInfo
NestedProfileSections lists SectionInfo of all nested sections that may be used inside the configuration
func (*TemplateInfoData) ProfileSections ¶ added in v0.21.0
func (t *TemplateInfoData) ProfileSections() []SectionInfo
ProfileSections is a helper method for templates to list SectionInfo in ProfileInfo