source

package
v1.8.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CopyOptions

type CopyOptions struct {
	SigstorePrivateKey string
	SigstorePassphrase []byte
	RemoveSignatures   bool

	Destination *destination.Destination
	Set         types.FilterSet
	Policy      *signaturev5.Policy
}

type Option

type Option struct {
	// Image Type.
	Type types.ImageType
	// Directory, need to provide if Type is dir / oci / docker-archive
	Directory string
	// Registry, need to provide if Type is docker, docker-daemon, docker-archive
	Registry string
	// Project (also called namespace on some public cloud providers),
	// need to provide if Type is docker / docker-daemon / docker-archive
	Project string
	// Image name, need to provide if Type is docker / docker-daemon / docker-archive
	Name string
	// Image tag, need to provide if Type is docker / docker-daemon / docker-archive
	Tag string
	// Digest is used to identify the Digest of the image to be copied,
	// only available when Type is docker.
	Digest digest.Digest

	SystemContext *typesv5.SystemContext
}

Option is used for create the Source object.

type ScanOptions

type ScanOptions struct {
	Set types.FilterSet
}

type SignOptions

type SignOptions struct {
	SigstorePrivateKey string
	SigstorePassphrase []byte
	Set                types.FilterSet
	Policy             *signaturev5.Policy
}

type Source

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

Source represents the source image to be copied or sign. The type of the source image can be: docker, docker-daemon, docker-archive, oci or dir

func NewSource

func NewSource(o *Option) (*Source, error)

NewSource is the constructor to create a Source object. Need to call Init method after creating the Source object before use.

func (*Source) Copy

func (s *Source) Copy(
	ctx context.Context,
	opts *CopyOptions,
) error

func (*Source) Directory

func (s *Source) Directory() string

func (*Source) GetCopiedImage

func (s *Source) GetCopiedImage() *archive.Image

func (*Source) ImageBySet

func (s *Source) ImageBySet(set types.FilterSet) *archive.Image

func (*Source) Init

func (s *Source) Init(ctx context.Context) error

Init initialize the source image manifest.

func (*Source) InspectRAW

func (s *Source) InspectRAW(ctx context.Context) ([]byte, string, error)

func (*Source) IsSigstoreSignature

func (s *Source) IsSigstoreSignature() bool

IsSigstoreSignature detects whether the source image is a sigstore signature

func (*Source) MIME

func (s *Source) MIME() string

func (*Source) Name

func (s *Source) Name() string

func (*Source) Project

func (s *Source) Project() string

func (*Source) Reference

func (s *Source) Reference() (typesv5.ImageReference, error)

func (*Source) ReferenceName

func (s *Source) ReferenceName() string

ReferenceName returns the reference with transport of the source image.

Example:
	docker://docker.io/library/hello-world:latest
	docker-daemon://docker.io/library/nginx:1.23
	oci:./path/to/oci-image

func (*Source) ReferenceNameWithoutTransport

func (s *Source) ReferenceNameWithoutTransport() string

func (*Source) ReferenceNameWithoutTransportAndTag

func (s *Source) ReferenceNameWithoutTransportAndTag() string

func (*Source) Registry

func (s *Source) Registry() string

func (*Source) Scan

func (s *Source) Scan(
	ctx context.Context,
	opts *ScanOptions,
) (*scan.Result, error)

func (*Source) Sign

func (s *Source) Sign(
	ctx context.Context,
	opts *SignOptions,
) error

func (*Source) SystemContext

func (s *Source) SystemContext() *typesv5.SystemContext

func (*Source) Tag

func (s *Source) Tag() string

func (*Source) Type

func (s *Source) Type() types.ImageType

Type returns the type of the image

func (*Source) ValidateSignature

func (s *Source) ValidateSignature(
	ctx context.Context,
	publicKey string,
	repository string,
	set types.FilterSet,
) error

Jump to

Keyboard shortcuts

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