Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PurlToReferenceString ¶
func PurlToReferenceString(purlString string, fopts ...RefConverterOptions) (string, error)
PurlToReferenceString reads a Package URL of type OCI and returns an image reference string. If the purl does not parse or is not of type oci: an error will be returned. The function takes a few options:
WithDefaultRepository(string) Adds a default repository that will be used if none is defined in the purl qualifiers. WithOverrideRepository(string) Overrides repository used in the reference regardless one is set in the purl or not.
Types ¶
type IdentifiersBundle ¶
type IdentifiersBundle struct { Identifiers map[vex.IdentifierType][]string Hashes map[vex.Algorithm][]vex.Hash }
IdentifiersBundle is a struct that collects different software identifiers and hashes in a structured way
func GenerateReferenceIdentifiers ¶
func GenerateReferenceIdentifiers(refString, os, arch string) (IdentifiersBundle, error)
GenerateReferenceIdentifiers reads an image reference string and generates a list of identifiers that can be used to match an entry in VEX a document.
This function returns the hashes and package urls to match the container image specified by the reference string. If the image is an index and os and arch are specified, the bundle will include purls and hashes for both the arch image and the index fronting it.
For each image, the returned bundle will include a SHA256 hash with the image digest and two purls, with and without qualifiers. The variant with qualifiers will contain all the data known from the registry to match VEX documents with more specific purls.
This function performs calls to the registry to retrieve data such as the image digests when needed.
func (*IdentifiersBundle) ToStringSlice ¶
func (bundle *IdentifiersBundle) ToStringSlice() []string
ToStringSlice returns all the identifiers and hashes contained in the bundle in a flat string slice
type RefConverterOptions ¶
type RefConverterOptions func(*purlRefConverterOptions)
func WithDefaultRepository ¶
func WithDefaultRepository(reg string) RefConverterOptions
func WithOverrideRepository ¶
func WithOverrideRepository(reg string) RefConverterOptions