oci

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 17 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// Artifact types
	CycloneDXArtifactType = "application/vnd.cyclonedx+json"
	SPDXArtifactType      = "application/spdx+json"

	// Media types
	OCIImageManifest = "application/vnd.oci.image.manifest.v1+json"
)

Variables

View Source
var SupportedSBOMArtifactTypes = []string{
	CycloneDXArtifactType,
	SPDXArtifactType,
}

Functions

This section is empty.

Types

type Artifact

type Artifact struct {

	// For OCI registries
	types.RegistryOptions
	// contains filtered or unexported fields
}

Artifact is used to download artifacts such as vulnerability database and policies from OCI registries.

func NewArtifact

func NewArtifact(repo string, registryOpt types.RegistryOptions, opts ...Option) *Artifact

NewArtifact returns a new artifact

func (*Artifact) Digest

func (a *Artifact) Digest(ctx context.Context) (string, error)

func (*Artifact) Download

func (a *Artifact) Download(ctx context.Context, dir string, opt DownloadOption) error

type Artifacts added in v0.56.0

type Artifacts []*Artifact

func NewArtifacts added in v0.56.0

func NewArtifacts(repos []name.Reference, opt types.RegistryOptions, opts ...Option) Artifacts

NewArtifacts returns a slice of artifacts.

func (Artifacts) Download added in v0.56.0

func (a Artifacts) Download(ctx context.Context, dst string, opt DownloadOption) error

Download downloads artifacts until one of them succeeds. Attempts to download next artifact if the first one fails due to a temporary error.

type DownloadOption added in v0.39.0

type DownloadOption struct {
	MediaType string // Accept any media type if not specified
	Filename  string // Use the annotation if not specified
	Quiet     bool
}

type Option

type Option func(*Artifact)

Option is a functional option

func WithImage

func WithImage(img v1.Image) Option

WithImage takes an OCI v1 Image

Jump to

Keyboard shortcuts

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