source

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 6 Imported by: 100

Documentation

Overview

Package source provides an abstraction to allow a user to loosely define a data source to catalog and expose a common interface that catalogers and use explore and analyze data from the data source. All valid (cataloggable) data sources are defined within this package.

Index

Constants

This section is empty.

Variables

AllScopes is a slice containing all possible scope options

Functions

This section is empty.

Types

type Alias added in v0.85.0

type Alias struct {
	Name    string `json:"name" yaml:"name" mapstructure:"name"`
	Version string `json:"version" yaml:"version" mapstructure:"version"`
}

func (*Alias) IsEmpty added in v0.85.0

func (a *Alias) IsEmpty() bool

type Description added in v0.85.0

type Description struct {
	ID       string `hash:"ignore"` // the id generated from the parent source struct
	Name     string `hash:"ignore"`
	Version  string `hash:"ignore"`
	Metadata interface{}
}

Description represents any static source data that helps describe "what" was cataloged.

type DirectoryMetadata added in v1.0.0

type DirectoryMetadata struct {
	Path string `json:"path" yaml:"path"`
	Base string `json:"-" yaml:"-"` // though this is important, for display purposes it leaks too much information (abs paths)
}

type ExcludeConfig added in v0.85.0

type ExcludeConfig struct {
	Paths []string
}

type FileMetadata added in v0.15.0

type FileMetadata struct {
	Path     string        `json:"path" yaml:"path"`
	Digests  []file.Digest `json:"digests,omitempty" yaml:"digests,omitempty"`
	MIMEType string        `json:"mimeType" yaml:"mimeType"`
}

type ImageMetadata

type ImageMetadata struct {
	UserInput      string            `json:"userInput"`
	ID             string            `json:"imageID"`
	ManifestDigest string            `json:"manifestDigest"`
	MediaType      string            `json:"mediaType"`
	Tags           []string          `json:"tags"`
	Size           int64             `json:"imageSize"`
	Layers         []LayerMetadata   `json:"layers"`
	RawManifest    []byte            `json:"manifest"`
	RawConfig      []byte            `json:"config"`
	RepoDigests    []string          `json:"repoDigests"`
	Architecture   string            `json:"architecture"`
	Variant        string            `json:"architectureVariant,omitempty"`
	OS             string            `json:"os"`
	Labels         map[string]string `json:"labels,omitempty"`
}

ImageMetadata represents all static metadata that defines what a container image is. This is useful to later describe "what" was cataloged without needing the more complicated stereoscope Image objects or FileResolver objects.

type LayerMetadata

type LayerMetadata struct {
	MediaType string `json:"mediaType"`
	Digest    string `json:"digest"`
	Size      int64  `json:"size"`
}

LayerMetadata represents all static metadata that defines what a container image layer is.

type Provider added in v1.0.0

type Provider interface {
	Name() string
	Provide(ctx context.Context) (Source, error)
}

Provider is able to resolve a source request

type Scope

type Scope string

Scope indicates "how" or from "which perspectives" the source object should be cataloged from.

const (
	// UnknownScope is the default scope
	UnknownScope Scope = "unknown-scope"
	// SquashedScope indicates to only catalog content visible from the squashed filesystem representation (what can be seen only within the container at runtime)
	SquashedScope Scope = "squashed"
	// AllLayersScope indicates to catalog content on all layers, regardless if it is visible from the container at runtime.
	AllLayersScope Scope = "all-layers"
)

func ParseScope

func ParseScope(userStr string) Scope

ParseScope returns a scope as indicated from the given string.

func (Scope) String

func (o Scope) String() string

type Source

type Source interface {
	artifact.Identifiable
	FileResolver(Scope) (file.Resolver, error)
	Describe() Description
	io.Closer
}

func FromDescription added in v0.85.0

func FromDescription(d Description) Source

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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