format

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const AllVersions = "all-versions"

Variables

This section is empty.

Functions

func Decode

func Decode(reader io.Reader) (*sbom.SBOM, sbom.FormatID, string, error)

Decode takes a set of bytes and attempts to decode it into an SBOM.

func Decoders

func Decoders() []sbom.FormatDecoder

func Encode

func Encode(s sbom.SBOM, f sbom.FormatEncoder) ([]byte, error)

Encode takes all SBOM elements and a format option and encodes an SBOM document.

func Encoders

func Encoders() []sbom.FormatEncoder

func Identify

func Identify(reader io.Reader) (sbom.FormatID, string)

Identify takes a set of bytes and attempts to identify the format of the SBOM.

func NewDecoderCollection

func NewDecoderCollection(decoders ...sbom.FormatDecoder) sbom.FormatDecoder

Types

type DecoderCollection

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

func (*DecoderCollection) Decode

func (c *DecoderCollection) Decode(reader io.Reader) (*sbom.SBOM, sbom.FormatID, string, error)

Decode takes a set of bytes and attempts to decode it into an SBOM relative to the decoders in the collection.

func (*DecoderCollection) Identify

func (c *DecoderCollection) Identify(reader io.Reader) (sbom.FormatID, string)

Identify takes a set of bytes and attempts to identify the format of the SBOM relative to the decoders in the collection.

type EncoderCollection

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

func NewEncoderCollection

func NewEncoderCollection(encoders ...sbom.FormatEncoder) *EncoderCollection

func (EncoderCollection) Aliases

func (e EncoderCollection) Aliases() []string

Aliases returns all format aliases represented in the collection (where an ID would be "spdx-tag-value" the alias would be "spdx").

func (EncoderCollection) Get

func (e EncoderCollection) Get(name string, version string) sbom.FormatEncoder

Get returns the contained encoder for a given format name and version.

func (EncoderCollection) GetByString

func (e EncoderCollection) GetByString(s string) sbom.FormatEncoder

GetByString accepts a name@version string, such as:

  • json
  • spdx-json@2.1
  • cdx@1.5

func (EncoderCollection) IDs

func (e EncoderCollection) IDs() []sbom.FormatID

IDs returns all format IDs represented in the collection.

func (EncoderCollection) NameVersions

func (e EncoderCollection) NameVersions() []string

NameVersions returns all formats that are supported by the collection as a list of "name@version" strings.

type EncodersConfig

type EncodersConfig struct {
	Template      template.EncoderConfig
	SyftJSON      syftjson.EncoderConfig
	SPDXJSON      spdxjson.EncoderConfig
	SPDXTagValue  spdxtagvalue.EncoderConfig
	CyclonedxJSON cyclonedxjson.EncoderConfig
	CyclonedxXML  cyclonedxxml.EncoderConfig
}

func DefaultEncodersConfig

func DefaultEncodersConfig() EncodersConfig

func (EncodersConfig) Encoders

func (o EncodersConfig) Encoders() ([]sbom.FormatEncoder, error)

Jump to

Keyboard shortcuts

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