Help us shape the future of Go! Take the 2026 Go Developer Survey

applicationbackup

package
v0.4.17 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatMagic   = "BASEHARBOR-APP-BACKUP"
	SchemaVersion = 1

	MaxEntries            = 128
	MaxEntryBytes   int64 = 512 << 20
	MaxPayloadBytes int64 = 2 << 30
)
View Source
const (
	RecoveryManifestVersion = 1
)

Variables

This section is empty.

Functions

func ApplicationManifestFromPayload

func ApplicationManifestFromPayload(payload Payload) (application.Manifest, error)

func Build

func Build(application, environment string, createdAt time.Time, entries []PayloadEntry, password []byte) ([]byte, error)

func LogsHistoryFromPayload added in v0.4.16

func LogsHistoryFromPayload(payload Payload) (logsprovider.HistoryBackup, bool, error)

func ObjectStorageBackupsFromPayload added in v0.4.16

func ObjectStorageBackupsFromPayload(payload Payload) ([]objectstorage.BucketBackup, error)

func OpenBaoBackupFromPayload

func OpenBaoBackupFromPayload(application, environment string, payload Payload) (openbao.ApplicationSecretBackup, error)

func PostgresBackupsFromPayload

func PostgresBackupsFromPayload(m application.Manifest, payload Payload) ([]application.PostgresBackup, error)

func WorkloadStorageFromPayload added in v0.4.16

func WorkloadStorageFromPayload(payload Payload) (map[string][]byte, error)

Types

type Entry

type Entry struct {
	Name   string `json:"name"`
	Kind   string `json:"kind"`
	Size   int64  `json:"size"`
	SHA256 string `json:"sha256"`
}

func (Entry) Validate

func (e Entry) Validate() error

type Envelope

type Envelope struct {
	Magic      string    `json:"magic"`
	Version    int       `json:"version"`
	KDF        KDFParams `json:"kdf"`
	Nonce      string    `json:"nonce"`
	Ciphertext string    `json:"ciphertext"`
}

type KDFParams

type KDFParams struct {
	Algorithm string `json:"algorithm"`
	Time      uint32 `json:"time"`
	MemoryKiB uint32 `json:"memory_kib"`
	Threads   uint8  `json:"threads"`
	KeyLength uint32 `json:"key_length"`
	Salt      string `json:"salt"`
}

type Manifest

type Manifest struct {
	SchemaVersion int       `json:"schema_version"`
	Application   string    `json:"application"`
	Environment   string    `json:"environment"`
	CreatedAt     time.Time `json:"created_at"`
	Entries       []Entry   `json:"entries"`
}

func (Manifest) Validate

func (m Manifest) Validate() error

type Payload

type Payload struct {
	Manifest Manifest       `json:"manifest"`
	Entries  []PayloadEntry `json:"entries"`
}

func Open

func Open(archive, password []byte) (Payload, error)

func (Payload) Validate

func (p Payload) Validate() error

type PayloadEntry

type PayloadEntry struct {
	Name string `json:"name"`
	Data []byte `json:"data"`
}

func ApplicationManifestPayloadEntry

func ApplicationManifestPayloadEntry(m application.Manifest) (PayloadEntry, error)

func LogsHistoryPayloadEntry added in v0.4.16

func LogsHistoryPayloadEntry(backup logsprovider.HistoryBackup) (PayloadEntry, error)

func ObjectStoragePayloadEntry added in v0.4.16

func ObjectStoragePayloadEntry(backup objectstorage.BucketBackup) (PayloadEntry, error)

func OpenBaoPayloadEntry

func OpenBaoPayloadEntry(backup openbao.ApplicationSecretBackup) (PayloadEntry, error)

func PostgresPayloadEntries

func PostgresPayloadEntries(backups []application.PostgresBackup) ([]PayloadEntry, error)

func RecoveryManifestPayloadEntry added in v0.4.16

func RecoveryManifestPayloadEntry(selection RecoverySelection) (PayloadEntry, error)

func WorkloadStoragePayloadEntry added in v0.4.16

func WorkloadStoragePayloadEntry(volume string, archive []byte) (PayloadEntry, error)

type RecoveryContributor added in v0.4.16

type RecoveryContributor struct {
	StateClass         RecoveryStateClass `json:"state_class"`
	LogicalResource    string             `json:"logical_resource,omitempty"`
	Ownership          string             `json:"ownership"`
	Support            RecoverySupport    `json:"support"`
	DefaultSelected    bool               `json:"default_selected"`
	Selected           bool               `json:"selected"`
	Durable            bool               `json:"durable,omitempty"`
	ExplicitlyExcluded bool               `json:"explicitly_excluded,omitempty"`
	Reason             string             `json:"reason,omitempty"`
}

func (RecoveryContributor) Validate added in v0.4.16

func (c RecoveryContributor) Validate() error

type RecoveryManifest added in v0.4.16

type RecoveryManifest struct {
	Version      int                   `json:"version"`
	Contributors []RecoveryContributor `json:"contributors"`
}

func RecoveryManifestFromPayload added in v0.4.16

func RecoveryManifestFromPayload(payload Payload) (RecoveryManifest, bool, error)

func (RecoveryManifest) Validate added in v0.4.16

func (m RecoveryManifest) Validate() error

type RecoverySelection added in v0.4.16

type RecoverySelection struct {
	Contributors []RecoveryContributor `json:"contributors"`
}

func DiscoverManifestRecovery added in v0.4.16

func DiscoverManifestRecovery(m application.Manifest) (RecoverySelection, error)

func NewRecoverySelection added in v0.4.16

func NewRecoverySelection(contributors []RecoveryContributor) (RecoverySelection, error)

func (RecoverySelection) Apply added in v0.4.16

func (s RecoverySelection) Apply(include, exclude []RecoveryStateClass) (RecoverySelection, error)

func (RecoverySelection) HasSelected added in v0.4.16

func (s RecoverySelection) HasSelected(class RecoveryStateClass) bool

func (RecoverySelection) Selected added in v0.4.16

func (s RecoverySelection) Selected() []RecoveryContributor

func (RecoverySelection) ValidateForCapture added in v0.4.16

func (s RecoverySelection) ValidateForCapture() error

type RecoveryStateClass added in v0.4.16

type RecoveryStateClass string
const (
	StateApplicationMetadata RecoveryStateClass = "application.metadata"
	StateSecrets             RecoveryStateClass = "secrets"
	StateSQL                 RecoveryStateClass = "database.sql"
	StateObjectStorage       RecoveryStateClass = "object-storage.s3"
	StateWorkloadStorage     RecoveryStateClass = "workload.storage"
	StateLogs                RecoveryStateClass = "observability.logs"
	StateMetrics             RecoveryStateClass = "observability.metrics"
	StateTraces              RecoveryStateClass = "observability.traces"
	StatePKI                 RecoveryStateClass = "security.pki"
	StateIdentity            RecoveryStateClass = "identity.oidc"
)

func ParseRecoveryStateClass added in v0.4.16

func ParseRecoveryStateClass(value string) (RecoveryStateClass, error)

type RecoverySupport added in v0.4.16

type RecoverySupport string
const (
	RecoverySupported   RecoverySupport = "supported"
	RecoveryUnsupported RecoverySupport = "unsupported"
	RecoveryExternal    RecoverySupport = "external"
)

Jump to

Keyboard shortcuts

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