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 ¶
- Variables
- func NewCoordinateSet(coordinates ...file.Coordinates) file.CoordinateSetdeprecated
- func NewLocation(realPath string) file.Locationdeprecated
- func NewLocationFromCoordinates(coordinates file.Coordinates) file.Locationdeprecated
- func NewLocationFromDirectory(responsePath string, ref stereoscopeFile.Reference) file.Locationdeprecated
- func NewLocationFromImage(virtualPath string, ref stereoscopeFile.Reference, img *image.Image) file.Locationdeprecated
- func NewLocationReadCloser(location file.Location, reader io.ReadCloser) file.LocationReadCloserdeprecated
- func NewLocationSet(locations ...file.Location) file.LocationSetdeprecated
- func NewMockResolverForPaths(paths ...string) *file.MockResolverdeprecated
- func NewMockResolverForPathsWithMetadata(metadata map[file.Coordinates]file.Metadata) *file.MockResolverdeprecated
- func NewVirtualLocation(realPath, virtualPath string) file.Locationdeprecated
- func NewVirtualLocationFromCoordinates(coordinates file.Coordinates, virtualPath string) file.Locationdeprecated
- func NewVirtualLocationFromDirectory(responsePath, virtualResponsePath string, ref stereoscopeFile.Reference) file.Locationdeprecated
- type CoordinateSetdeprecated
- type Coordinatesdeprecated
- type FileContentResolverdeprecated
- type FileLocationResolverdeprecated
- type FileMetadatadeprecated
- type FileMetadataResolverdeprecated
- type FilePathResolverdeprecated
- type FileResolverdeprecated
- type ImageMetadata
- type Input
- type LayerMetadata
- type Locationdeprecated
- type LocationDatadeprecated
- type LocationMetadatadeprecated
- type LocationReadCloserdeprecated
- type LocationSetdeprecated
- type Locationsdeprecated
- type Metadata
- type MockResolverdeprecated
- type Scheme
- type Scope
- type Source
- func New(in Input, registryOptions *image.RegistryOptions, exclusions []string) (*Source, func(), error)
- func NewFromDirectory(path string) (Source, error)
- func NewFromDirectoryRoot(path string) (Source, error)
- func NewFromDirectoryRootWithName(path string, name string) (Source, error)
- func NewFromDirectoryRootWithNameVersion(path string, name string, version string) (Source, error)
- func NewFromDirectoryWithName(path string, name string) (Source, error)
- func NewFromDirectoryWithNameVersion(path string, name string, version string) (Source, error)
- func NewFromFile(path string) (Source, func())
- func NewFromFileWithName(path string, name string) (Source, func())
- func NewFromFileWithNameVersion(path string, name string, version string) (Source, func())
- func NewFromImage(img *image.Image, userImageStr string) (Source, error)
- func NewFromImageWithName(img *image.Image, userImageStr string, name string) (Source, error)
- func NewFromImageWithNameVersion(img *image.Image, userImageStr string, name string, version string) (Source, error)
- func NewFromRegistry(in Input, registryOptions *image.RegistryOptions, exclusions []string) (*Source, func(), error)
- type WritableFileResolverdeprecated
Constants ¶
This section is empty.
Variables ¶
var AllSchemes = []Scheme{ DirectoryScheme, ImageScheme, FileScheme, }
var AllScopes = []Scope{ SquashedScope, AllLayersScope, }
AllScopes is a slice containing all possible scope options
Functions ¶
func NewCoordinateSet
deprecated
added in
v0.31.0
func NewCoordinateSet(coordinates ...file.Coordinates) file.CoordinateSet
Deprecated: use file.NewCoordinateSet instead
func NewLocation
deprecated
func NewLocationFromCoordinates
deprecated
added in
v0.31.0
func NewLocationFromCoordinates(coordinates file.Coordinates) file.Location
Deprecated: use file.NewLocationFromCoordinates instead
func NewLocationFromDirectory
deprecated
added in
v0.23.0
func NewLocationFromDirectory(responsePath string, ref stereoscopeFile.Reference) file.Location
Deprecated: use file.NewLocationFromDirectory instead
func NewLocationFromImage
deprecated
func NewLocationReadCloser
deprecated
added in
v0.60.0
func NewLocationReadCloser(location file.Location, reader io.ReadCloser) file.LocationReadCloser
Deprecated: use file.NewLocationReadCloser instead
func NewLocationSet
deprecated
added in
v0.43.0
func NewLocationSet(locations ...file.Location) file.LocationSet
Deprecated: use file.NewLocationSet instead
func NewMockResolverForPaths
deprecated
added in
v0.11.1
func NewMockResolverForPaths(paths ...string) *file.MockResolver
Deprecated: use file.NewMockResolverForPaths instead
func NewMockResolverForPathsWithMetadata
deprecated
added in
v0.15.0
func NewMockResolverForPathsWithMetadata(metadata map[file.Coordinates]file.Metadata) *file.MockResolver
Deprecated: use file.NewMockResolverForPathsWithMetadata instead
func NewVirtualLocation
deprecated
added in
v0.31.0
func NewVirtualLocationFromCoordinates
deprecated
added in
v0.78.0
func NewVirtualLocationFromCoordinates(coordinates file.Coordinates, virtualPath string) file.Location
Deprecated: use file.NewVirtualLocationFromCoordinates instead
func NewVirtualLocationFromDirectory
deprecated
added in
v0.39.0
func NewVirtualLocationFromDirectory(responsePath, virtualResponsePath string, ref stereoscopeFile.Reference) file.Location
Deprecated: use file.NewVirtualLocationFromDirectory instead
Types ¶
type CoordinateSet
deprecated
added in
v0.31.0
type CoordinateSet = file.CoordinateSet
Deprecated: use file.CoordinateSet instead
type Coordinates
deprecated
added in
v0.31.0
type Coordinates = file.Coordinates
Deprecated: use file.Coordinates instead
type FileContentResolver
deprecated
added in
v0.15.0
type FileContentResolver = file.ContentResolver
Deprecated: use file.ContentResolver instead
type FileLocationResolver
deprecated
added in
v0.15.0
type FileLocationResolver = file.LocationResolver
Deprecated: use file.LocationResolver instead
type FileMetadata
deprecated
added in
v0.15.0
type FileMetadataResolver
deprecated
added in
v0.15.0
type FileMetadataResolver = file.MetadataResolver
Deprecated: use file.MetadataResolver instead
type FilePathResolver
deprecated
added in
v0.15.0
type FilePathResolver = file.PathResolver
Deprecated: use file.PathResolver instead
type FileResolver
deprecated
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"` }
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.
func NewImageMetadata ¶
func NewImageMetadata(img *image.Image, userInput string) ImageMetadata
NewImageMetadata creates a new ImageMetadata object populated from the given stereoscope Image object and user configuration.
type Input ¶ added in v0.40.0
type Input struct { UserInput string Scheme Scheme ImageSource image.Source Location string Platform string Name string Version string }
Input is an object that captures the detected user input regarding source location, scheme, and provider type. It acts as a struct input for some source constructors.
func ParseInput ¶ added in v0.40.0
ParseInput generates a source Input that can be used as an argument to generate a new source from specific providers including a registry.
func ParseInputWithName ¶ added in v0.61.0
func ParseInputWithName(userInput string, platform, name, defaultImageSource string) (*Input, error)
ParseInputWithName generates a source Input that can be used as an argument to generate a new source from specific providers including a registry, with an explicit name.
func ParseInputWithNameVersion ¶ added in v0.83.0
func ParseInputWithNameVersion(userInput, platform, name, version, defaultImageSource string) (*Input, error)
ParseInputWithNameVersion generates a source Input that can be used as an argument to generate a new source from specific providers including a registry, with an explicit name and version.
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 LocationData
deprecated
added in
v0.78.0
type LocationData = file.LocationData
Deprecated: use file.LocationData instead
type LocationMetadata
deprecated
added in
v0.78.0
type LocationMetadata = file.LocationMetadata
Deprecated: use file.LocationMetadata instead
type LocationReadCloser
deprecated
added in
v0.60.0
type LocationReadCloser = file.LocationReadCloser
Deprecated: use file.LocationReadCloser instead
type LocationSet
deprecated
added in
v0.43.0
type LocationSet = file.LocationSet
Deprecated: use file.LocationSet instead
type Metadata ¶
type Metadata struct { ID string `hash:"ignore"` // the id generated from the parent source struct Scheme Scheme // the source data scheme type (directory or image) ImageMetadata ImageMetadata // all image info (image only) Path string // the root path to be cataloged (directory only) Base string // the base path to be cataloged (directory only) Name string Version string }
Metadata represents any static source data that helps describe "what" was cataloged.
type MockResolver
deprecated
added in
v0.11.1
type MockResolver = file.MockResolver
Deprecated: use file.MockResolver instead
type Scheme ¶
type Scheme string
Scheme represents the optional prefixed string at the beginning of a user request (e.g. "docker:").
const ( // UnknownScheme is the default scheme UnknownScheme Scheme = "UnknownScheme" // DirectoryScheme indicates the source being cataloged is a directory on the root filesystem DirectoryScheme Scheme = "DirectoryScheme" // ImageScheme indicates the source being cataloged is a container image ImageScheme Scheme = "ImageScheme" // FileScheme indicates the source being cataloged is a single file FileScheme Scheme = "FileScheme" )
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 = "UnknownScope" // 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, irregardless if it is visible from the container at runtime. AllLayersScope Scope = "AllLayers" )
func ParseScope ¶
ParseScope returns a scope as indicated from the given string.
type Source ¶
type Source struct { Image *image.Image `hash:"ignore"` // the image object to be cataloged (image only) Metadata Metadata Exclusions []string `hash:"ignore"` // contains filtered or unexported fields }
Source is an object that captures the data source to be cataloged, configuration, and a specific resolver used in cataloging (based on the data source and configuration)
func New ¶
func New(in Input, registryOptions *image.RegistryOptions, exclusions []string) (*Source, func(), error)
New produces a Source based on userInput like dir: or image:tag
func NewFromDirectory ¶
NewFromDirectory creates a new source object tailored to catalog a given filesystem directory recursively.
func NewFromDirectoryRoot ¶ added in v0.69.0
NewFromDirectoryRoot creates a new source object tailored to catalog a given filesystem directory recursively.
func NewFromDirectoryRootWithName ¶ added in v0.69.0
NewFromDirectoryRootWithName creates a new source object tailored to catalog a given filesystem directory recursively, with an explicitly provided name.
func NewFromDirectoryRootWithNameVersion ¶ added in v0.83.0
NewFromDirectoryRootWithNameVersion creates a new source object tailored to catalog a given filesystem directory recursively, with an explicitly provided name.
func NewFromDirectoryWithName ¶ added in v0.61.0
NewFromDirectoryWithName creates a new source object tailored to catalog a given filesystem directory recursively, with an explicitly provided name.
func NewFromDirectoryWithNameVersion ¶ added in v0.83.0
NewFromDirectoryWithNameVersion creates a new source object tailored to catalog a given filesystem directory recursively, with an explicitly provided name.
func NewFromFile ¶ added in v0.30.0
NewFromFile creates a new source object tailored to catalog a file.
func NewFromFileWithName ¶ added in v0.61.0
NewFromFileWithName creates a new source object tailored to catalog a file, with an explicitly provided name.
func NewFromFileWithNameVersion ¶ added in v0.83.0
NewFromFileWithNameVersion creates a new source object tailored to catalog a file, with an explicitly provided name and version.
func NewFromImage ¶
NewFromImage creates a new source object tailored to catalog a given container image, relative to the option given (e.g. all-layers, squashed, etc)
func NewFromImageWithName ¶ added in v0.61.0
NewFromImageWithName creates a new source object tailored to catalog a given container image, relative to the option given (e.g. all-layers, squashed, etc), with an explicit name.
func NewFromImageWithNameVersion ¶ added in v0.83.0
func NewFromImageWithNameVersion(img *image.Image, userImageStr string, name string, version string) (Source, error)
NewFromImageWithNameVersion creates a new source object tailored to catalog a given container image, relative to the option given (e.g. all-layers, squashed, etc), with an explicit name and version.
func NewFromRegistry ¶ added in v0.40.0
func (*Source) FileResolver ¶ added in v0.15.0
type WritableFileResolver
deprecated
added in
v0.78.0
type WritableFileResolver = file.WritableResolver
Deprecated: use file.WritableResolver instead