common

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(collection []string, toFind string) bool

Contains returns true if collections contains at least one matching element.

func ErrToStatus

func ErrToStatus(err error) int

ErrToStatus tries to extract status code from error. If the error is not ErrWithStatus returns status 500.

func ErrWrap

func ErrWrap(status int, err error, message string) error

ErrWrap wraps an error inside ErrWithStatus with additional message.

func ErrWrapf

func ErrWrapf(status int, err error, format string, args ...interface{}) error

ErrWrapf wraps an error inside ErrWithStatus with additional formatted message.

func NewErr

func NewErr(status int, err error) error

NewErr creates ErrWithStatus as error interface.

func TriggerInstallationBackup

func TriggerInstallationBackup(store installationBackupStore, installation *model.Installation, env string, logger log.FieldLogger) (*model.InstallationBackup, error)

TriggerInstallationBackup verifies that backup can be started for an Installation and triggers it.

func TriggerInstallationDBRestoration

func TriggerInstallationDBRestoration(store installationRestorationStore, installation *model.Installation, backup *model.InstallationBackup, eventsProducer eventProducer, env string, logger log.FieldLogger) (*model.InstallationDBRestorationOperation, error)

TriggerInstallationDBRestoration validates, triggers and reports installation database restoration.

func ValidateDBMigrationDestination

func ValidateDBMigrationDestination(store dbMigrationValidationStore, destinationDB *model.MultitenantDatabase, installationID string, maxWeight float64) error

ValidateDBMigrationDestination validates if installation can be migrated to destinationDB.

Types

type ErrWithStatus

type ErrWithStatus struct {
	// contains filtered or unexported fields
}

ErrWithStatus represents error with status code. It can be hidden behind standard error interface and wrapped with errors.Wrap.

func (*ErrWithStatus) Error

func (e *ErrWithStatus) Error() string

Error returns error string.

Jump to

Keyboard shortcuts

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