backup

package
v0.0.0-...-43b0d33 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstanceIdentifierTag = "lambda-ebs-backup/instance-id"
	VolumeIdentifierTag   = "lambda-ebs-backup/volume-id"
)

Identifier tags so we know how to match up backups to their resource

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonTemplateContext

type CommonTemplateContext struct {
	Date     string
	FullDate string
	Name     string
}

CommonTemplateContext that can be shared across more specific contexts

type ImageNameTemplateContext

type ImageNameTemplateContext struct {
	CommonTemplateContext
}

ImageNameTemplateContext is what gets passed in as the context to the go template when attempting to create the name of the image for backup.

type Manager

type Manager struct {
	*ManagerOpts
	// contains filtered or unexported fields
}

Manager manages backups/images of ec2 resources(volumes, instances, etc.)

func NewManager

func NewManager(opts *ManagerOpts) (*Manager, error)

NewManager creates a new backup manager from the provided options

func (*Manager) Backup

func (m *Manager) Backup() error

Backup performs the necessary backups

func (*Manager) Cleanup

func (m *Manager) Cleanup() error

Cleanup cleans up old volume snapshots and images

func (*Manager) Search

func (m *Manager) Search() error

Search searches for a volumes and instances to backup

type ManagerOpts

type ManagerOpts struct {
	BackupTagKey        string
	BackupTagValue      string
	ImageTagKey         string
	ImageTagValue       string
	ImageNameTag        string
	ManagedTagKey       string
	ManagedTagValue     string
	MaxKeepImagesTag    string
	MaxKeepSnapshotsTag string
	RebootOnImageTag    string
	SnapshotNameTag     string

	DefaultImageNameTemplate    *template.Template
	DefaultMaxKeepImages        int
	DefaultMaxKeepSnapshots     int
	DefaultRebootOnImage        bool
	DefaultSnapshotNameTemplate *template.Template

	Verbose bool
	// contains filtered or unexported fields
}

ManagerOpts are options to configure the backup manager

func NewManagerOptsFromConfig

func NewManagerOptsFromConfig(client *ec2.EC2) (*ManagerOpts, error)

NewManagerOptsFromConfig creates and initializes a new set of options from the config.

type SnapshotNameTemplateContext

type SnapshotNameTemplateContext struct {
	CommonTemplateContext
}

SnapshotNameTemplateContext is what gets passed in as the context to the go template when attempting ot create the name of the snapshot for backup.

Jump to

Keyboard shortcuts

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