archive

package
v1.9.6-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotExist = errors.New("does not exist")

Functions

func GetItemFilePath added in v1.5.0

func GetItemFilePath(rootDir, groupResource, namespace, name string) string

GetItemFilePath returns an item's file path once extracted from a Velero backup archive.

func Unmarshal added in v1.5.0

func Unmarshal(fs filesystem.Interface, filePath string) (*unstructured.Unstructured, error)

Unmarshal reads the specified file, unmarshals the JSON contained within it and returns an Unstructured object.

Types

type Extractor

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

Extractor unzips/extracts a backup tarball to a local temp directory.

func NewExtractor

func NewExtractor(log logrus.FieldLogger, fs filesystem.Interface) *Extractor

func (*Extractor) UnzipAndExtractBackup

func (e *Extractor) UnzipAndExtractBackup(src io.Reader) (string, error)

UnzipAndExtractBackup extracts a reader on a gzipped tarball to a local temp directory

type Parser

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

Parser traverses an extracted archive on disk to validate it and provide a helpful representation of it to consumers.

func NewParser

func NewParser(log logrus.FieldLogger, fs filesystem.Interface) *Parser

NewParser constructs a Parser.

func (*Parser) Parse

func (p *Parser) Parse(dir string) (map[string]*ResourceItems, error)

Parse reads an extracted backup on the file system and returns a structured catalog of the resources and items contained within it.

func (*Parser) ParseGroupVersions added in v1.6.0

func (p *Parser) ParseGroupVersions(dir string) (map[string]metav1.APIGroup, error)

ParseGroupVersions extracts the versions for each API Group from the backup directory names and stores them in a metav1 APIGroup object.

type ResourceItems

type ResourceItems struct {
	// GroupResource is API group and resource name,
	// formatted as "resource.group". For the "core"
	// API group, the ".group" suffix is omitted.
	GroupResource string

	// ItemsByNamespace is a map from namespace (or empty string
	// for cluster-scoped resources) to a list of individual item
	// names contained in the archive. Item names **do not** include
	// the file extension.
	ItemsByNamespace map[string][]string
}

ResourceItems contains the collection of items of a given resource type within a backup, grouped by namespace (or empty string for cluster-scoped resources).

Jump to

Keyboard shortcuts

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