json

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Descriptor added in v0.8.0

type Descriptor struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

Descriptor describes what created the document as well as surrounding metadata

type Distribution added in v0.6.0

type Distribution struct {
	Name    string `json:"name"`    // Name of the Linux distribution
	Version string `json:"version"` // Version of the Linux distribution (major or major.minor version)
	IDLike  string `json:"idLike"`  // the ID_LIKE field found within the /etc/os-release file
}

Distribution provides information about a detected Linux Distribution.

func NewDistribution added in v0.8.0

func NewDistribution(d *distro.Distro) Distribution

NewDistribution creates a struct with the Linux distribution to be represented in JSON.

type Document

type Document struct {
	Artifacts  []Package    `json:"artifacts"`  // Artifacts is the list of packages discovered and placed into the catalog
	Source     Source       `json:"source"`     // Source represents the original object that was cataloged
	Distro     Distribution `json:"distro"`     // Distro represents the Linux distribution that was detected from the source
	Descriptor Descriptor   `json:"descriptor"` // Descriptor is a block containing self-describing information about syft
	Schema     Schema       `json:"schema"`     // Schema is a block reserved for defining the version for the shape of this JSON document and where to find the schema document to validate the shape
}

Document represents the syft cataloging findings as a JSON document

func NewDocument

func NewDocument(catalog *pkg.Catalog, srcMetadata source.Metadata, d *distro.Distro) (Document, error)

NewDocument creates and populates a new JSON document struct from the given cataloging results.

type Package added in v0.8.0

type Package struct {
	// contains filtered or unexported fields
}

Package represents a pkg.Package object specialized for JSON marshaling and unmarshaling.

func NewPackage added in v0.8.0

func NewPackage(p *pkg.Package) (Package, error)

NewPackage crates a new Package from the given pkg.Package.

func (Package) ToPackage added in v0.8.0

func (a Package) ToPackage() (pkg.Package, error)

ToPackage generates a pkg.Package from the current Package.

func (*Package) UnmarshalJSON added in v0.8.0

func (a *Package) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom unmarshaller for handling basic values and values with ambiguous types. nolint:funlen

type Presenter

type Presenter struct {
	// contains filtered or unexported fields
}

Presenter is a JSON presentation object for the syft results

func NewPresenter

func NewPresenter(catalog *pkg.Catalog, s source.Metadata, d *distro.Distro) *Presenter

NewPresenter creates a new JSON presenter object for the given cataloging results.

func (*Presenter) Present

func (pres *Presenter) Present(output io.Writer) error

Present the catalog results to the given writer.

type Schema added in v0.10.0

type Schema struct {
	Version string `json:"version"`
	URL     string `json:"url"`
}

type Source

type Source struct {
	Type   string      `json:"type"`
	Target interface{} `json:"target"`
}

Source object represents the thing that was cataloged

func NewSource

func NewSource(src source.Metadata) (Source, error)

NewSource creates a new source object to be represented into JSON.

func (*Source) ToSourceMetadata added in v0.8.0

func (s *Source) ToSourceMetadata() source.Metadata

ToSourceMetadata takes a source object represented from JSON and creates a source.Metadata object.

func (*Source) UnmarshalJSON added in v0.8.0

func (s *Source) UnmarshalJSON(b []byte) error

UnmarshalJSON populates a source object from JSON bytes.

Jump to

Keyboard shortcuts

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