format

package
v0.98.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(reader io.ReadSeeker) (*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 Identify

func Identify(reader io.ReadSeeker) (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.ReadSeeker) (*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.ReadSeeker) (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.

Jump to

Keyboard shortcuts

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