GrypeSource Class

Summary

What Grype scans: an SBOM, a directory, a file, a container image, package URLs or CPEs. Relative paths are made absolute when the scan runs. A string converts implicitly and is passed to Grype unchanged, for example "registry:alpine:3.20".
Assembly
Cake.Grype.dll
Namespace
Cake.Grype
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["GrypeSource"] class Type type-node

Syntax

public sealed class GrypeSource

Methods

Name Value Summary
Cpe(string) GrypeSource
A single CPE, for example cpe:2.3:a:openssl:openssl:3.0.14:*:*:*:*:*:*:*.
static
CpeFile(FilePath) GrypeSource
A file with one CPE per line (cpes:).
static
Directory(DirectoryPath) GrypeSource
A directory on disk (dir:).
static
Docker(string) GrypeSource
An image from the Docker daemon (docker:).
static
DockerArchive(FilePath) GrypeSource
A tarball created by docker save (docker-archive:).
static
File(FilePath) GrypeSource
A single file on disk (file:).
static
Image(string) GrypeSource
A container image reference, resolved by Grype's default lookup (a Docker daemon first).
static
OciArchive(FilePath) GrypeSource
An OCI archive (oci-archive:).
static
OciDirectory(DirectoryPath) GrypeSource
An OCI layout directory (oci-dir:).
static
Parse(string) GrypeSource
A source exactly as Grype expects it on the command line; relative paths are not resolved.
static
Podman(string) GrypeSource
An image from the Podman daemon (podman:).
static
Purl(string) GrypeSource
A single package URL, for example pkg:apk/[email protected]?distro=alpine-3.20.3.
static
PurlFile(FilePath) GrypeSource
A file with one package URL per line (purl:).
static
Registry(string) GrypeSource
An image pulled directly from a registry, no container runtime required (registry:).
static
Sbom(FilePath) GrypeSource
An SBOM file: Syft JSON, CycloneDX or SPDX (sbom:).
static
Singularity(FilePath) GrypeSource
A Singularity Image Format container (singularity:).
static
ToArgument(DirectoryPath) string
Renders the command-line argument, making relative paths absolute.
ToString() string
Zarf(FilePath) GrypeSource
All SBOMs within a Zarf package archive (zarf:).
static

Operators

Name Value Summary
implicit operator GrypeSource(string) GrypeSource

Extension Methods

Name Value Summary
Dump<GrypeSource>() string
Get a basic string representation of specified object.
Requires the Cake.Incubator addin
IsIn<GrypeSource>(GrypeSource[]) bool
Checks if the source is contained in a list
Requires the Cake.Incubator addin
NotNull<GrypeSource>(string) void
Requires the Cake.Issues addin
NotNull<GrypeSource>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Ftp addin
ThrowIfNull<GrypeSource>(string, string) T
Throws a System.ArgumentNullException with a specific message if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ThrowIfNull<GrypeSource>(string) T
Throws a System.ArgumentNullException if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ToDictionary() IDictionary<string, object>
Requires the Cake.DeployParams addin
ToStringWithNullMarkup() string
Requires the Cake.Issues addin