sheaf

package
v0.0.0-...-4e386bd Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BundleConfigFilename is the filename for a fs config.
	BundleConfigFilename = "bundle.json"

	// BundleConfigDefaultVersion is the default version a bundle.
	BundleConfigDefaultVersion = "0.1.0"
)

Variables

View Source
var UserDefinedImageTypes = []string{string(MultiResult), string(SingleResult)}

UserDefinedImageTypes is a list of user defined image types as a string.

View Source
var (
	// Version is the sheaf's version.
	Version string
)

Functions

func ArchiveListImages

func ArchiveListImages(optionList ...Option) error

ArchiveListImages lists images in an archive.

func ArchivePack

func ArchivePack(optionList ...Option) error

ArchivePack packs a bundle.

func ArchivePush

func ArchivePush(optionList ...Option) error

ArchivePush push an archive's bundle to a registry.

func ArchiveRelocate

func ArchiveRelocate(optionList ...Option) error

ArchiveRelocate relocates images to an archive to a registry.

func ArchiveShowManifests

func ArchiveShowManifests(optionList ...Option) error

ArchiveShowManifests shows manifests in an archive.

func ConfigDeleteUDI

func ConfigDeleteUDI(optionList ...Option) error

ConfigDeleteUDI deletes a user defined image from a bundle configuration.

func ConfigGet

func ConfigGet(options ...Option) error

ConfigGet shows the bundle configuration.

func ConfigPull

func ConfigPull(optionList ...Option) error

ConfigPull pulls a bundle from a registry.

func ConfigPush

func ConfigPush(optionList ...Option) error

ConfigPush pushes a bundle to a registry.

func ConfigSetUDI

func ConfigSetUDI(optionList ...Option) error

ConfigSetUDI sets a user defined image in the bundle config.

func Init

func Init(optionList ...Option) error

Init creates a bundle.

func ManifestAdd

func ManifestAdd(optionList ...Option) error

ManifestAdd adds manifests to a bundle.

func ManifestShow

func ManifestShow(optionList ...Option) error

ManifestShow shows manifests in a bundle.

Types

type Archiver

type Archiver interface {
	// Archive archives a source to a writer.
	Archive(src string, w io.Writer) error
	// Unarchive unarchives a reader to a destination.
	Unarchive(r io.Reader, dest string) error
	// UnarchivePath unarchives a source to a destination.
	UnarchivePath(src string, dest string) error
}

Archiver manages archives.

type ArtifactsService

type ArtifactsService interface {
	Index() ([]byte, error)
	Image() ImageService
}

ArtifactsService interacts with fs artifacts.

type Bundle

type Bundle interface {
	Codec() Codec
	Path() string
	Config() BundleConfig
	Artifacts() ArtifactsService
	Manifests() (ManifestService, error)
	Images() (images.Set, error)
	Copy(dest string) (Bundle, error)
}

Bundle manages bundles.

type BundleConfig

type BundleConfig interface {
	GetSchemaVersion() string
	SetSchemaVersion(string)
	GetName() string
	SetName(string)
	GetVersion() string
	SetVersion(string)
	GetUserDefinedImages() []UserDefinedImage
	SetUserDefinedImages([]UserDefinedImage)
}

BundleConfig is a bundle configuration interface.

type BundleConfigCodec

type BundleConfigCodec interface {
	// Encode encodes a bundle config to a writer.
	Encode(w io.Writer, bc BundleConfig) error
	// Decode decodes a bundle config from a reader.
	Decode(r io.Reader) (BundleConfig, error)
}

BundleConfigCodec is a codec for bundle config.

type BundleConfigFactory

type BundleConfigFactory func() BundleConfig

BundleConfigFactory is a function that creates a bundle config.

type BundleConfigWriter

type BundleConfigWriter interface {
	Write(Bundle, BundleConfig) error
}

BundleConfigWriter writes a bundle config.

type BundleCreatorFunc

type BundleCreatorFunc func(bc BundleConfig) error

BundleCreatorFunc is a function a function that creates a bundle.

type BundleFactory

type BundleFactory func(uri string) (Bundle, error)

BundleFactory is a factory for creating bundles given a URI.

type BundleFactoryFunc

type BundleFactoryFunc func(rootPath string) (Bundle, error)

BundleFactoryFunc is a factory that creates bundle instances.

type BundleImage

type BundleImage struct {
	Name      string `json:"name"`
	Digest    string `json:"digest"`
	MediaType string `json:"mediaType"`
}

BundleImage is an image in a fs.

type BundleImager

type BundleImager interface {
	// CreateImage creates an image from a bundle.
	CreateImage(b Bundle) (v1.Image, error)
}

BundleImager is an interface that wraps the create image from bundle functionality.

type BundleManifest

type BundleManifest struct {
	ID   string
	Data []byte
}

BundleManifest describes a manifest in a fs.

type BundlePacker

type BundlePacker interface {
	// Pack packs a bundle to a destination.
	Pack(b Bundle, dest string, force bool) error
}

BundlePacker is an interface wrapping the bundle pack command.

type Codec

type Codec interface {
	Decoder
	Encoder
}

Codec combines Decoder and Encoder

type Decoder

type Decoder interface {
	Decode([]byte, interface{}) error
}

Decoder decodes bytes into a value.

type Encoder

type Encoder interface {
	Encode(interface{}) ([]byte, error)
}

Encoder encodes a value into bytes.

type ImageReader

type ImageReader interface {
	// Read fetches an image given a reference.
	Read(refStr string) (v1.Image, error)
}

ImageReader is an interface that wraps reading an image from a registry.

type ImageRelocator

type ImageRelocator interface {
	Relocate(rootPath, prefix string, images []image.Name, iw ImageWriter) error
}

ImageRelocator relocates an images to another registry.

type ImageReplacer

type ImageReplacer interface {
	// Replace replaces images in a bundle manifest with prefixed options.
	Replace(manifest BundleManifest, config BundleConfig, prefix string) ([]byte, error)
}

ImageReplacer is an interface that wraps images replacing.

type ImageService

type ImageService interface {
	List() ([]BundleImage, error)
}

ImageService returns a list of fs artifact images.

type ImageWriter

type ImageWriter interface {
	// Write writes an image to a reference location.
	Write(ref string, image v1.Image) error
	// WriteIndex writes an image index to a reference location.
	WriteIndex(ref string, imageIndex v1.ImageIndex) error
}

ImageWriter is an interface that wraps a Write method.

type ManifestGenerator

type ManifestGenerator interface {
	Show(w io.Writer) error
}

ManifestGenerator generates manifests.

type ManifestService

type ManifestService interface {
	List() ([]BundleManifest, error)
	Add(overwrite bool, manifestURIs ...string) error
}

ManifestService is a service for interacting with manifests.

type Option

type Option func(o *options)

Option is a functional option for configuring a sheaf command.

func WithArchive

func WithArchive(archive string) Option

WithArchive set archive.

func WithArchiver

func WithArchiver(archiver Archiver) Option

WithArchiver sets archiver.

func WithBundleConfigCodec

func WithBundleConfigCodec(bcc BundleConfigCodec) Option

WithBundleConfigCodec sets bundle config codec.

func WithBundleConfigFactory

func WithBundleConfigFactory(fn BundleConfigFactory) Option

WithBundleConfigFactory sets the bundle config factory.

func WithBundleConfigWriter

func WithBundleConfigWriter(bcw BundleConfigWriter) Option

WithBundleConfigWriter sets the bundle config writer..

func WithBundleCreator

func WithBundleCreator(fn BundleCreatorFunc) Option

WithBundleCreator sets bundle creator.

func WithBundleFactory

func WithBundleFactory(fn BundleFactoryFunc) Option

WithBundleFactory sets the bundle factory.

func WithBundleImager

func WithBundleImager(bi BundleImager) Option

WithBundleImager sets the bundle imager.

func WithBundleName

func WithBundleName(name string) Option

WithBundleName sets bundle name.

func WithBundlePacker

func WithBundlePacker(bp BundlePacker) Option

WithBundlePacker sets the bundle packer.

func WithBundlePath

func WithBundlePath(s string) Option

WithBundlePath set the bundle path.

func WithBundleVersion

func WithBundleVersion(version string) Option

WithBundleVersion sets bundle version.

func WithCodec

func WithCodec(c Codec) Option

WithCodec sets the codec.

func WithDestination

func WithDestination(dest string) Option

WithDestination sets the destination.

func WithDryRun

func WithDryRun(dryRun bool) Option

WithDryRun sets dry run.

func WithFilePaths

func WithFilePaths(filePaths []string) Option

WithFilePaths sets file paths.

func WithForce

func WithForce(force bool) Option

WithForce sets force.

func WithImageReader

func WithImageReader(ir ImageReader) Option

WithImageReader sets image reader.

func WithImageRelocator

func WithImageRelocator(ir ImageRelocator) Option

WithImageRelocator sets image relocator.

func WithImageReplacer

func WithImageReplacer(ir ImageReplacer) Option

WithImageReplacer sets the image replacer.

func WithImageWriter

func WithImageWriter(iw ImageWriter) Option

WithImageWriter sets image writer.

func WithImages

func WithImages(imageList []string) Option

WithImages sets images.

func WithReference

func WithReference(ref string) Option

WithReference sets a registry reference.

func WithReporter

func WithReporter(r reporter.Reporter) Option

WithReporter sets the reporter.

func WithRepositoryPrefix

func WithRepositoryPrefix(prefix string) Option

WithRepositoryPrefix sets the repository prefix.

func WithUserDefinedImage

func WithUserDefinedImage(udi UserDefinedImage) Option

WithUserDefinedImage sets user defined image.

func WithUserDefinedImageKey

func WithUserDefinedImageKey(udiKey UserDefinedImageKey) Option

WithUserDefinedImageKey sets user defined image key.

func WithWriter

func WithWriter(w io.Writer) Option

WithWriter sets writer.

type UserDefinedImage

type UserDefinedImage struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	JSONPath   string `json:"jsonPath"`
}

UserDefinedImage is a user defined image. These allow sheaf to find more images.

func (UserDefinedImage) Validate

func (udi UserDefinedImage) Validate() error

Validate validates a user defined image.

type UserDefinedImageKey

type UserDefinedImageKey struct {
	APIVersion string
	Kind       string
}

UserDefinedImageKey is a key describing a UserDefinedImage.

type UserDefinedImageType

type UserDefinedImageType string

UserDefinedImageType is the type of user defined image.

const (
	// MultiResult states the JSON path will return multiple values.
	MultiResult UserDefinedImageType = "multiple"
	// SingleResult states the JSON path will return a single value.
	SingleResult UserDefinedImageType = "single"
)

Jump to

Keyboard shortcuts

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