extract

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(name string, streams genericclioptions.IOStreams) *cobra.Command

New creates a new command

Types

type LayerFilter

type LayerFilter interface {
	Filter(layers []distribution.Descriptor) ([]distribution.Descriptor, error)
}

func NewPositionLayerFilter

func NewPositionLayerFilter(at int32) LayerFilter

type LayerInfo

type LayerInfo struct {
	Index      int
	Descriptor distribution.Descriptor
	Mapping    *Mapping
}

type Mapping

type Mapping struct {
	// Name is provided for caller convenience for associating image callback metadata with a mapping
	Name string
	// Image is the raw input image to extract
	Image string
	// ImageRef is the parsed version of the raw input image
	ImageRef imagereference.DockerImageReference
	// LayerFilter can select which images to load
	LayerFilter LayerFilter
	// From is the directory or file in the image to extract
	From string
	// To is the directory to extract the contents of the directory or the named file into.
	To string
	// ConditionFn is invoked before extracting the content and allows the set of images to be filtered.
	ConditionFn func(m *Mapping, dgst digest.Digest, imageConfig *docker10.DockerImageConfig) (bool, error)
}

type Options

type Options struct {
	Mappings []Mapping

	Files []string
	Paths []string

	OnlyFiles           bool
	PreservePermissions bool

	SecurityOptions imagemanifest.SecurityOptions
	FilterOptions   imagemanifest.FilterOptions
	ParallelOptions imagemanifest.ParallelOptions

	Confirm bool
	DryRun  bool

	genericclioptions.IOStreams

	// ImageMetadataCallback is invoked once per image retrieved, and may be called in parallel if
	// MaxPerRegistry is set higher than 1.
	ImageMetadataCallback func(m *Mapping, dgst, contentDigest digest.Digest, imageConfig *docker10.DockerImageConfig)
	// TarEntryCallback, if set, is passed each entry in the viewed layers. Entries will be filtered
	// by name and only the entry in the highest layer will be passed to the callback. Returning false
	// will halt processing of the image.
	TarEntryCallback TarEntryFunc
	// AllLayers ensures the TarEntryCallback is invoked for all files, and will cause the callback
	// order to start at the lowest layer and work outwards.
	AllLayers bool
}

func NewOptions

func NewOptions(streams genericclioptions.IOStreams) *Options

func (*Options) Complete

func (o *Options) Complete(cmd *cobra.Command, args []string) error

func (*Options) Run

func (o *Options) Run() error

func (*Options) Validate

func (o *Options) Validate() error

type TarEntryFunc

type TarEntryFunc func(*tar.Header, LayerInfo, io.Reader) (cont bool, err error)

TarEntryFunc is called once per entry in the tar file. It may return an error, or false to stop processing.

Jump to

Keyboard shortcuts

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