format

package
v0.96.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 14 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode added in v0.95.0

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 added in v0.95.0

func Decoders() []sbom.FormatDecoder

func Encode added in v0.95.0

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 added in v0.95.0

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 added in v0.95.0

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

Types

type DecoderCollection added in v0.95.0

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

func (*DecoderCollection) Decode added in v0.95.0

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 added in v0.95.0

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 added in v0.95.0

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

func NewEncoderCollection added in v0.95.0

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

func (EncoderCollection) Aliases added in v0.95.0

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 added in v0.95.0

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 added in v0.95.0

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 added in v0.95.0

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

IDs returns all format IDs represented in the collection.

func (EncoderCollection) NameVersions added in v0.95.0

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