helpers

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PurlTypeGuac  = "guac"
	PurlFilesGuac = "pkg:guac/files/"
	PurlPkgGuac   = "pkg:guac/pkg/"
)

Variables

This section is empty.

Functions

func AllPkgTreeToPurl added in v0.5.0

func AllPkgTreeToPurl(v *model.AllPkgTree) string

AllPkgTreeToPurl takes one package trie evaluation and converts it into a PURL it will only do this for one PURL, and will ignore other pkg tries in the fragment

func ArtifactClientKey added in v0.5.0

func ArtifactClientKey(input *generated.ArtifactInputSpec) string

func ArtifactServerKey added in v0.5.0

func ArtifactServerKey(input *model.ArtifactInputSpec) string

func CreateVulnInput added in v0.2.0

func CreateVulnInput(vulnID string) (*generated.VulnerabilityInputSpec, error)

func GetKey added in v0.5.0

func GetKey[T any, R any](item T, transformer func(T) R) R

collect is a simple helper to transform collections of a certain type to another type using the transform function func(T) R

func GuacFilePurl

func GuacFilePurl(alg string, digest string, filename *string) string

func GuacGenericPurl

func GuacGenericPurl(s string) string

func GuacPkgPurl

func GuacPkgPurl(pkgName string, pkgVersion *string) string

func GuacSrcIdToSourceInput added in v0.8.0

func GuacSrcIdToSourceInput(srcID string) (*generated.SourceInputSpec, error)

convert src ID to source input that will be used by the clearly defined parser example: "uri": "sourcearchive::org.apache.commons::commons-text::1.9::?"

func IsVcs

func IsVcs(s string) bool

func LicenseClientKey added in v0.5.0

func LicenseClientKey(l *generated.LicenseInputSpec) string

func LicenseServerKey added in v0.5.0

func LicenseServerKey(l *model.LicenseInputSpec) string

func PkgInputSpecToPurl added in v0.1.1

func PkgInputSpecToPurl(currentPkg *model.PkgInputSpec) string

func PkgToPurl

func PkgToPurl(purlType, namespace, name, version, subpath string, qualifiersList []string) string

func PurlToPkg

func PurlToPkg(purlUri string) (*model.PkgInputSpec, error)

PurlToPkg converts a purl URI string into a graphql package node

func PurlToPkgFilter added in v0.6.0

func PurlToPkgFilter(purl string) (model.PkgSpec, error)

PurlToPkgFilter converts a purl URI string into a graphql package filter spec. The result will only match the input purl, and no other packages. The filter is created with Guac's purl special casing.

func SanitizeString

func SanitizeString(s string) string

func SourceToSourceInput added in v0.8.0

func SourceToSourceInput(srcType, namespace, name string, revision *string) *generated.SourceInputSpec

func UpdatePurlForPackageNamespaces added in v0.4.0

func UpdatePurlForPackageNamespaces(packageObj *model.Package) ([]*model.PackageNamespace, error)

func VcsToSrc

func VcsToSrc(vcsUri string) (*model.SourceInputSpec, error)

Types

type PkgIds added in v0.5.0

type PkgIds struct {
	TypeId      string
	NamespaceId string
	NameId      string
	VersionId   string
}

func PkgClientKey added in v0.5.0

func PkgClientKey(pkg *generated.PkgInputSpec) PkgIds

func PkgServerKey added in v0.5.0

func PkgServerKey(pkg *model.PkgInputSpec) PkgIds

type SrcIds added in v0.5.0

type SrcIds struct {
	TypeId      string
	NamespaceId string
	NameId      string
}

func SrcClientKey added in v0.5.0

func SrcClientKey(src *generated.SourceInputSpec) SrcIds

func SrcServerKey added in v0.5.0

func SrcServerKey(src *model.SourceInputSpec) SrcIds

type VulnIds added in v0.5.0

type VulnIds struct {
	TypeId          string
	VulnerabilityID string
}

func VulnClientKey added in v0.5.0

func VulnClientKey(vuln *generated.VulnerabilityInputSpec) VulnIds

func VulnServerKey added in v0.5.0

func VulnServerKey(vuln *model.VulnerabilityInputSpec) VulnIds

Jump to

Keyboard shortcuts

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