Documentation ¶
Overview ¶
Package report build a text with all actions performed by the tool. As the tool can work in background, it is useful to periodically retrieve a report with all actions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build generates the report in the specify format. Every time this function is called the internal cache of reports is cleared. On error it will return an Error type encapsulated in a traceable error. To retrieve the desired error you can do:
type causer interface { Cause() error } if causeErr, ok := err.(causer); ok { switch specificErr := causeErr.Cause().(type) { case *report.Error: // handle specifically default: // unknown error } }
func Clear ¶
func Clear()
Clear removes all reports from the internal cache. Useful for testing environments.
func ErrorEqual ¶
ErrorEqual compares two Error objects. This is useful to compare down to the low level errors.
Types ¶
type Error ¶
Error stores error details from a problem occurred while reading a report file or parsing the environment variables.
type ErrorCode ¶
type ErrorCode string
ErrorCode stores the error type that occurred while reading report parameters.
const ( // ErrorCodeTemplate error parsing template. ErrorCodeTemplate ErrorCode = "template" )
type ListBackups ¶
type ListBackups struct { Durations struct { List time.Duration } // contains filtered or unexported fields }
ListBackups stores statistics and errors when the remote backups information are retrieved.
func NewListBackups ¶
func NewListBackups() ListBackups
NewListBackups initialize a new report item to retrieve the remote backups.
func (ListBackups) Build ¶
func (l ListBackups) Build(f Format) (string, error)
Build creates a report with details of a remote backups listing. On error it will return an Error type encapsulated in a traceable error. To retrieve the desired error you can do:
type causer interface { Cause() error } if causeErr, ok := err.(causer); ok { switch specificErr := causeErr.Cause().(type) { case *report.Error: // handle specifically default: // unknown error } }
type RemoveOldBackups ¶
type RemoveOldBackups struct { Backups []cloud.Backup Durations struct { List time.Duration Remove time.Duration } // contains filtered or unexported fields }
RemoveOldBackups stores useful information about the removed backups, including performance issues.
func NewRemoveOldBackups ¶
func NewRemoveOldBackups() RemoveOldBackups
NewRemoveOldBackups initialize a new report item for removing the old backups.
func (RemoveOldBackups) Build ¶
func (r RemoveOldBackups) Build(f Format) (string, error)
Build creates a report with details of old backups removal procedure. On error it will return an Error type encapsulated in a traceable error. To retrieve the desired error you can do:
type causer interface { Cause() error } if causeErr, ok := err.(causer); ok { switch specificErr := causeErr.Cause().(type) { case *report.Error: // handle specifically default: // unknown error } }
type Report ¶
Report is the contract that every report must respect so it can be included in the notification engine.
type SendBackup ¶
type SendBackup struct { Backup cloud.Backup Paths []string Durations struct { Build time.Duration Encrypt time.Duration Send time.Duration } // contains filtered or unexported fields }
SendBackup stores all useful information of an uploaded backup. It includes performance data for system improvements.
func NewSendBackup ¶
func NewSendBackup() SendBackup
NewSendBackup initialize a new report item for the backup upload action.
func (SendBackup) Build ¶
func (s SendBackup) Build(f Format) (string, error)
Build creates a report with details of an uploaded backup to the cloud. On error it will return an Error type encapsulated in a traceable error. To retrieve the desired error you can do:
type causer interface { Cause() error } if causeErr, ok := err.(causer); ok { switch specificErr := causeErr.Cause().(type) { case *report.Error: // handle specifically default: // unknown error } }
type Test ¶
type Test struct {
// contains filtered or unexported fields
}
Test is a simple test report only to check if everything is working well.
func NewTest ¶
func NewTest() Test
NewTest initialize a new test report to verify the notification mechanisms.
func (Test) Build ¶
Build creates a report for testing purpose. On error it will return an Error type encapsulated in a traceable error. To retrieve the desired error you can do:
type causer interface { Cause() error } if causeErr, ok := err.(causer); ok { switch specificErr := causeErr.Cause().(type) { case *report.Error: // handle specifically default: // unknown error } }