sbom

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const NodeIdentifierPrefix = "protobom"

Variables

View Source
var (
	HashAlgorithm_name = map[int32]string{
		0:  "UNKNOWN",
		1:  "MD5",
		2:  "SHA1",
		3:  "SHA256",
		4:  "SHA384",
		5:  "SHA512",
		6:  "SHA3_256",
		7:  "SHA3_384",
		8:  "SHA3_512",
		9:  "BLAKE2B_256",
		10: "BLAKE2B_384",
		11: "BLAKE2B_512",
		12: "BLAKE3",
		13: "MD2",
		14: "ADLER32",
		15: "MD4",
		16: "MD6",
		17: "SHA224",
	}
	HashAlgorithm_value = map[string]int32{
		"UNKNOWN":     0,
		"MD5":         1,
		"SHA1":        2,
		"SHA256":      3,
		"SHA384":      4,
		"SHA512":      5,
		"SHA3_256":    6,
		"SHA3_384":    7,
		"SHA3_512":    8,
		"BLAKE2B_256": 9,
		"BLAKE2B_384": 10,
		"BLAKE2B_512": 11,
		"BLAKE3":      12,
		"MD2":         13,
		"ADLER32":     14,
		"MD4":         15,
		"MD6":         16,
		"SHA224":      17,
	}
)

Enum value maps for HashAlgorithm.

View Source
var (
	Node_NodeType_name = map[int32]string{
		0: "PACKAGE",
		1: "FILE",
	}
	Node_NodeType_value = map[string]int32{
		"PACKAGE": 0,
		"FILE":    1,
	}
)

Enum value maps for Node_NodeType.

View Source
var (
	Edge_Type_name = map[int32]string{
		0:  "UNKNOWN",
		1:  "amends",
		2:  "ancestor",
		3:  "buildDependency",
		4:  "buildTool",
		5:  "contains",
		6:  "contained_by",
		7:  "copy",
		8:  "dataFile",
		9:  "dependencyManifest",
		10: "dependsOn",
		11: "dependencyOf",
		12: "descendant",
		13: "describes",
		14: "describedBy",
		15: "devDependency",
		16: "devTool",
		17: "distributionArtifact",
		18: "documentation",
		19: "dynamicLink",
		20: "example",
		21: "expandedFromArchive",
		22: "fileAdded",
		23: "fileDeleted",
		24: "fileModified",
		25: "generates",
		26: "generatedFrom",
		27: "metafile",
		28: "optionalComponent",
		29: "optionalDependency",
		30: "other",
		31: "packages",
		32: "patch",
		33: "prerequisite",
		34: "prerequisiteFor",
		35: "providedDependency",
		36: "requirementFor",
		37: "runtimeDependency",
		38: "specificationFor",
		39: "staticLink",
		40: "test",
		41: "testCase",
		42: "testDependency",
		43: "testTool",
		44: "variant",
	}
	Edge_Type_value = map[string]int32{
		"UNKNOWN":              0,
		"amends":               1,
		"ancestor":             2,
		"buildDependency":      3,
		"buildTool":            4,
		"contains":             5,
		"contained_by":         6,
		"copy":                 7,
		"dataFile":             8,
		"dependencyManifest":   9,
		"dependsOn":            10,
		"dependencyOf":         11,
		"descendant":           12,
		"describes":            13,
		"describedBy":          14,
		"devDependency":        15,
		"devTool":              16,
		"distributionArtifact": 17,
		"documentation":        18,
		"dynamicLink":          19,
		"example":              20,
		"expandedFromArchive":  21,
		"fileAdded":            22,
		"fileDeleted":          23,
		"fileModified":         24,
		"generates":            25,
		"generatedFrom":        26,
		"metafile":             27,
		"optionalComponent":    28,
		"optionalDependency":   29,
		"other":                30,
		"packages":             31,
		"patch":                32,
		"prerequisite":         33,
		"prerequisiteFor":      34,
		"providedDependency":   35,
		"requirementFor":       36,
		"runtimeDependency":    37,
		"specificationFor":     38,
		"staticLink":           39,
		"test":                 40,
		"testCase":             41,
		"testDependency":       42,
		"testTool":             43,
		"variant":              44,
	}
)

Enum value maps for Edge_Type.

View Source
var File_api_sbom_proto protoreflect.FileDescriptor

Functions

func NewNodeIdentifier

func NewNodeIdentifier(prefixes ...string) string

NewNodeIdentifier returns an identifier string that can be used in a node and that is guaranteed to be compatible with CycloneDX and SPDX.

Without options, identifiers will be created using a new UUID and prefixed with a prefix like "protobom-xx-yy--". This prefix allows serializers to read characteristics of the identifier string, by looking for keywords before the double dash. For example, "auto" means that it was autogenerated and did not come from an ingested SBOM.

Without any strings seeding it, NewNodeIdentifier generates the identifier using an UUID. If a string is provided, any invalid characters will be removed and the new string will be used as the identifier.

Types

type Document

type Document struct {
	Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
	NodeList *NodeList `protobuf:"bytes,2,opt,name=node_list,json=nodeList,proto3" json:"node_list,omitempty"`
	// contains filtered or unexported fields
}

func NewDocument

func NewDocument() *Document

func (*Document) Descriptor deprecated

func (*Document) Descriptor() ([]byte, []int)

Deprecated: Use Document.ProtoReflect.Descriptor instead.

func (*Document) GetMetadata

func (x *Document) GetMetadata() *Metadata

func (*Document) GetNodeList

func (x *Document) GetNodeList() *NodeList

func (*Document) GetRootNodes

func (d *Document) GetRootNodes() []*Node

GetRootNodes returns the top level nodes of the document. It calls the underlying method in the document's NodeList.

func (*Document) ProtoMessage

func (*Document) ProtoMessage()

func (*Document) ProtoReflect

func (x *Document) ProtoReflect() protoreflect.Message

func (*Document) Reset

func (x *Document) Reset()

func (*Document) String

func (x *Document) String() string

type Edge

type Edge struct {
	Type Edge_Type `protobuf:"varint,1,opt,name=type,proto3,enum=bomsquad.protobom.Edge_Type" json:"type,omitempty"`
	From string    `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"`
	To   []string  `protobuf:"bytes,3,rep,name=to,proto3" json:"to,omitempty"`
	// contains filtered or unexported fields
}

func (*Edge) Copy

func (e *Edge) Copy() *Edge

Copy returns a new edge with copies of all edges

func (*Edge) Descriptor deprecated

func (*Edge) Descriptor() ([]byte, []int)

Deprecated: Use Edge.ProtoReflect.Descriptor instead.

func (*Edge) Equal

func (e *Edge) Equal(e2 *Edge) bool

Equal compares Edge e to e2 and returns true if they are the same

func (*Edge) GetFrom

func (x *Edge) GetFrom() string

func (*Edge) GetTo

func (x *Edge) GetTo() []string

func (*Edge) GetType

func (x *Edge) GetType() Edge_Type

func (*Edge) PointsTo

func (e *Edge) PointsTo(id string) bool

PointsTo returns true if an edge points to a node, in other words if it has id in its list of Tos

func (*Edge) ProtoMessage

func (*Edge) ProtoMessage()

func (*Edge) ProtoReflect

func (x *Edge) ProtoReflect() protoreflect.Message

func (*Edge) Reset

func (x *Edge) Reset()

func (*Edge) String

func (x *Edge) String() string

type Edge_Type

type Edge_Type int32
const (
	Edge_UNKNOWN              Edge_Type = 0
	Edge_amends               Edge_Type = 1
	Edge_ancestor             Edge_Type = 2
	Edge_buildDependency      Edge_Type = 3
	Edge_buildTool            Edge_Type = 4
	Edge_contains             Edge_Type = 5
	Edge_contained_by         Edge_Type = 6 // Not in SPDX3
	Edge_copy                 Edge_Type = 7
	Edge_dataFile             Edge_Type = 8
	Edge_dependencyManifest   Edge_Type = 9
	Edge_dependsOn            Edge_Type = 10
	Edge_dependencyOf         Edge_Type = 11 // Not in SPDX3
	Edge_descendant           Edge_Type = 12
	Edge_describes            Edge_Type = 13
	Edge_describedBy          Edge_Type = 14 // Not in SPDX3
	Edge_devDependency        Edge_Type = 15
	Edge_devTool              Edge_Type = 16
	Edge_distributionArtifact Edge_Type = 17
	Edge_documentation        Edge_Type = 18
	Edge_dynamicLink          Edge_Type = 19
	Edge_example              Edge_Type = 20
	Edge_expandedFromArchive  Edge_Type = 21
	Edge_fileAdded            Edge_Type = 22
	Edge_fileDeleted          Edge_Type = 23
	Edge_fileModified         Edge_Type = 24
	Edge_generates            Edge_Type = 25
	Edge_generatedFrom        Edge_Type = 26 // Not in SPDX3
	Edge_metafile             Edge_Type = 27
	Edge_optionalComponent    Edge_Type = 28
	Edge_optionalDependency   Edge_Type = 29
	Edge_other                Edge_Type = 30
	Edge_packages             Edge_Type = 31
	Edge_patch                Edge_Type = 32
	Edge_prerequisite         Edge_Type = 33
	Edge_prerequisiteFor      Edge_Type = 34 // Not in SPDX3
	Edge_providedDependency   Edge_Type = 35
	Edge_requirementFor       Edge_Type = 36
	Edge_runtimeDependency    Edge_Type = 37
	Edge_specificationFor     Edge_Type = 38
	Edge_staticLink           Edge_Type = 39
	Edge_test                 Edge_Type = 40
	Edge_testCase             Edge_Type = 41
	Edge_testDependency       Edge_Type = 42
	Edge_testTool             Edge_Type = 43
	Edge_variant              Edge_Type = 44
)

func EdgeTypeFromSPDX

func EdgeTypeFromSPDX(spdxName string) Edge_Type

func EdgeTypeFromSPDX2

func EdgeTypeFromSPDX2(spdx2Type string) Edge_Type

func (Edge_Type) Descriptor

func (Edge_Type) Descriptor() protoreflect.EnumDescriptor

func (Edge_Type) Enum

func (x Edge_Type) Enum() *Edge_Type

func (Edge_Type) EnumDescriptor deprecated

func (Edge_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Edge_Type.Descriptor instead.

func (Edge_Type) Number

func (x Edge_Type) Number() protoreflect.EnumNumber

func (Edge_Type) String

func (x Edge_Type) String() string

func (Edge_Type) ToSPDX2

func (et Edge_Type) ToSPDX2() string

ToSPDX2 converts the edge type to the corresponding SDPX2 label

func (Edge_Type) Type

type ExternalReference

type ExternalReference struct {
	Url       string            `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	Type      string            `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Comment   string            `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"`
	Authority string            `protobuf:"bytes,4,opt,name=authority,proto3" json:"authority,omitempty"`
	Hashes    map[string]string `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

ExternalReference is an entry linking an element to a resource defined outside the SBOM standard

func (*ExternalReference) Descriptor deprecated

func (*ExternalReference) Descriptor() ([]byte, []int)

Deprecated: Use ExternalReference.ProtoReflect.Descriptor instead.

func (*ExternalReference) GetAuthority

func (x *ExternalReference) GetAuthority() string

func (*ExternalReference) GetComment

func (x *ExternalReference) GetComment() string

func (*ExternalReference) GetHashes

func (x *ExternalReference) GetHashes() map[string]string

func (*ExternalReference) GetType

func (x *ExternalReference) GetType() string

func (*ExternalReference) GetUrl

func (x *ExternalReference) GetUrl() string

func (*ExternalReference) ProtoMessage

func (*ExternalReference) ProtoMessage()

func (*ExternalReference) ProtoReflect

func (x *ExternalReference) ProtoReflect() protoreflect.Message

func (*ExternalReference) Reset

func (x *ExternalReference) Reset()

func (*ExternalReference) String

func (x *ExternalReference) String() string

func (*ExternalReference) ToSPDX2Category

func (e *ExternalReference) ToSPDX2Category() string

ToSPDX2Category returns the type of the external reference in the spdx 2.x vocabulary.

func (*ExternalReference) ToSPDX2Type

func (e *ExternalReference) ToSPDX2Type() string

ToSPDX2Type converts the external reference type to the SPDX 2.x equivalent.

type HashAlgorithm

type HashAlgorithm int32
const (
	HashAlgorithm_UNKNOWN     HashAlgorithm = 0
	HashAlgorithm_MD5         HashAlgorithm = 1
	HashAlgorithm_SHA1        HashAlgorithm = 2
	HashAlgorithm_SHA256      HashAlgorithm = 3
	HashAlgorithm_SHA384      HashAlgorithm = 4
	HashAlgorithm_SHA512      HashAlgorithm = 5
	HashAlgorithm_SHA3_256    HashAlgorithm = 6
	HashAlgorithm_SHA3_384    HashAlgorithm = 7
	HashAlgorithm_SHA3_512    HashAlgorithm = 8
	HashAlgorithm_BLAKE2B_256 HashAlgorithm = 9
	HashAlgorithm_BLAKE2B_384 HashAlgorithm = 10
	HashAlgorithm_BLAKE2B_512 HashAlgorithm = 11
	HashAlgorithm_BLAKE3      HashAlgorithm = 12
	// 2DO what should we do
	HashAlgorithm_MD2     HashAlgorithm = 13 // Only supported by SPDX
	HashAlgorithm_ADLER32 HashAlgorithm = 14 // Only supported by SPDX
	HashAlgorithm_MD4     HashAlgorithm = 15 // Only supported by SPDX
	HashAlgorithm_MD6     HashAlgorithm = 16 // Only supported by SPDX
	HashAlgorithm_SHA224  HashAlgorithm = 17 // Only supported by SPDX
)

func HashAlgorithmFromCDX

func HashAlgorithmFromCDX(cdxAlgorithm cyclonedx.HashAlgorithm) HashAlgorithm

func HashAlgorithmFromCycloneDX

func HashAlgorithmFromCycloneDX(cdxAlgo cdx.HashAlgorithm) HashAlgorithm

func (HashAlgorithm) Descriptor

func (HashAlgorithm) Enum

func (x HashAlgorithm) Enum() *HashAlgorithm

func (HashAlgorithm) EnumDescriptor deprecated

func (HashAlgorithm) EnumDescriptor() ([]byte, []int)

Deprecated: Use HashAlgorithm.Descriptor instead.

func (HashAlgorithm) Number

func (HashAlgorithm) String

func (x HashAlgorithm) String() string

func (HashAlgorithm) ToCycloneDX

func (ha HashAlgorithm) ToCycloneDX() cyclonedx.HashAlgorithm

func (HashAlgorithm) ToSPDX

func (HashAlgorithm) Type

type Identifier

type Identifier struct {
	Type  string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Identifier) Descriptor deprecated

func (*Identifier) Descriptor() ([]byte, []int)

Deprecated: Use Identifier.ProtoReflect.Descriptor instead.

func (*Identifier) GetType

func (x *Identifier) GetType() string

func (*Identifier) GetValue

func (x *Identifier) GetValue() string

func (*Identifier) ProtoMessage

func (*Identifier) ProtoMessage()

func (*Identifier) ProtoReflect

func (x *Identifier) ProtoReflect() protoreflect.Message

func (*Identifier) Reset

func (x *Identifier) Reset()

func (*Identifier) String

func (x *Identifier) String() string

type Metadata

type Metadata struct {
	Id      string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`           // Serial number in cyclone, SPDXID in spdx
	Version string                 `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // Int in CDX, but lets string it to capture other possible schemes
	Name    string                 `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	Date    *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=date,proto3" json:"date,omitempty"` // created date in spdx
	Tools   []*Tool                `protobuf:"bytes,5,rep,name=tools,proto3" json:"tools,omitempty"`
	Authors []*Person              `protobuf:"bytes,6,rep,name=authors,proto3" json:"authors,omitempty"`
	Comment string                 `protobuf:"bytes,7,opt,name=comment,proto3" json:"comment,omitempty"`
	// contains filtered or unexported fields
}

func (*Metadata) Descriptor deprecated

func (*Metadata) Descriptor() ([]byte, []int)

Deprecated: Use Metadata.ProtoReflect.Descriptor instead.

func (*Metadata) GetAuthors

func (x *Metadata) GetAuthors() []*Person

func (*Metadata) GetComment

func (x *Metadata) GetComment() string

func (*Metadata) GetDate

func (x *Metadata) GetDate() *timestamppb.Timestamp

func (*Metadata) GetId

func (x *Metadata) GetId() string

func (*Metadata) GetName

func (x *Metadata) GetName() string

func (*Metadata) GetTools

func (x *Metadata) GetTools() []*Tool

func (*Metadata) GetVersion

func (x *Metadata) GetVersion() string

func (*Metadata) ProtoMessage

func (*Metadata) ProtoMessage()

func (*Metadata) ProtoReflect

func (x *Metadata) ProtoReflect() protoreflect.Message

func (*Metadata) Reset

func (x *Metadata) Reset()

func (*Metadata) String

func (x *Metadata) String() string

type Node

type Node struct {
	Id                 string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Type               Node_NodeType          `protobuf:"varint,2,opt,name=type,proto3,enum=bomsquad.protobom.Node_NodeType" json:"type,omitempty"`
	Name               string                 `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	Version            string                 `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`                                           // Version string
	FileName           string                 `protobuf:"bytes,5,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`                         // Package filename when there is one
	UrlHome            string                 `protobuf:"bytes,6,opt,name=url_home,json=urlHome,proto3" json:"url_home,omitempty"`                            // Website of the packge
	UrlDownload        string                 `protobuf:"bytes,7,opt,name=url_download,json=urlDownload,proto3" json:"url_download,omitempty"`                // Location to download the package
	Licenses           []string               `protobuf:"bytes,8,rep,name=licenses,proto3" json:"licenses,omitempty"`                                         // Multiple for CDX 1.4, files in SPDX. Ideally license expressions
	LicenseConcluded   string                 `protobuf:"bytes,9,opt,name=license_concluded,json=licenseConcluded,proto3" json:"license_concluded,omitempty"` // This is only in SPDX and it is just one
	LicenseComments    string                 `protobuf:"bytes,10,opt,name=license_comments,json=licenseComments,proto3" json:"license_comments,omitempty"`
	Copyright          string                 `protobuf:"bytes,11,opt,name=copyright,proto3" json:"copyright,omitempty"`
	Hashes             map[string]string      ``                                                                                                         /* 154-byte string literal not displayed */
	SourceInfo         string                 `protobuf:"bytes,13,opt,name=source_info,json=sourceInfo,proto3" json:"source_info,omitempty"`             // any relevant background information or additional comments about the origin
	PrimaryPurpose     string                 `protobuf:"bytes,14,opt,name=primary_purpose,json=primaryPurpose,proto3" json:"primary_purpose,omitempty"` // APPLICATION | FRAMEWORK | LIBRARY | CONTAINER | OPERATING-SYSTEM | DEVICE | FIRMWARE | SOURCE | ARCHIVE | FILE | INSTALL | OTHER |
	Comment            string                 `protobuf:"bytes,15,opt,name=comment,proto3" json:"comment,omitempty"`
	Summary            string                 `protobuf:"bytes,16,opt,name=summary,proto3" json:"summary,omitempty"`         // Short package description
	Description        string                 `protobuf:"bytes,17,opt,name=description,proto3" json:"description,omitempty"` // Package description (full)
	Attribution        []string               `protobuf:"bytes,18,rep,name=attribution,proto3" json:"attribution,omitempty"` // One or more attribution texts
	Suppliers          []*Person              `protobuf:"bytes,19,rep,name=suppliers,proto3" json:"suppliers,omitempty"`
	Originators        []*Person              `protobuf:"bytes,20,rep,name=originators,proto3" json:"originators,omitempty"`
	ReleaseDate        *timestamppb.Timestamp `protobuf:"bytes,21,opt,name=release_date,json=releaseDate,proto3" json:"release_date,omitempty"`
	BuildDate          *timestamppb.Timestamp `protobuf:"bytes,22,opt,name=build_date,json=buildDate,proto3" json:"build_date,omitempty"`
	ValidUntilDate     *timestamppb.Timestamp `protobuf:"bytes,23,opt,name=valid_until_date,json=validUntilDate,proto3" json:"valid_until_date,omitempty"`
	ExternalReferences []*ExternalReference   `protobuf:"bytes,24,rep,name=external_references,json=externalReferences,proto3" json:"external_references,omitempty"`
	Identifiers        []*Identifier          `protobuf:"bytes,25,rep,name=identifiers,proto3" json:"identifiers,omitempty"`
	FileTypes          []string               `protobuf:"bytes,27,rep,name=file_types,json=fileTypes,proto3" json:"file_types,omitempty"` // File types
	// contains filtered or unexported fields
}

func (*Node) Augment

func (n *Node) Augment(n2 *Node)

Augment takes updates fields in n with data from n2 which is not already defined (not empty string, not 0 length string, not nill pointer).

func (*Node) Copy

func (n *Node) Copy() *Node

Copy returns a new node that is a copy of the node

func (*Node) Descriptor deprecated

func (*Node) Descriptor() ([]byte, []int)

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) Equal

func (n *Node) Equal(n2 *Node) bool

Equal compares Node n to n2 and returns true if they are the same

func (*Node) GetAttribution

func (x *Node) GetAttribution() []string

func (*Node) GetBuildDate

func (x *Node) GetBuildDate() *timestamppb.Timestamp

func (*Node) GetComment

func (x *Node) GetComment() string

func (*Node) GetCopyright

func (x *Node) GetCopyright() string

func (*Node) GetDescription

func (x *Node) GetDescription() string

func (*Node) GetExternalReferences

func (x *Node) GetExternalReferences() []*ExternalReference

func (*Node) GetFileName

func (x *Node) GetFileName() string

func (*Node) GetFileTypes

func (x *Node) GetFileTypes() []string

func (*Node) GetHashes

func (x *Node) GetHashes() map[string]string

func (*Node) GetId

func (x *Node) GetId() string

func (*Node) GetIdentifiers

func (x *Node) GetIdentifiers() []*Identifier

func (*Node) GetLicenseComments

func (x *Node) GetLicenseComments() string

func (*Node) GetLicenseConcluded

func (x *Node) GetLicenseConcluded() string

func (*Node) GetLicenses

func (x *Node) GetLicenses() []string

func (*Node) GetName

func (x *Node) GetName() string

func (*Node) GetOriginators

func (x *Node) GetOriginators() []*Person

func (*Node) GetPrimaryPurpose

func (x *Node) GetPrimaryPurpose() string

func (*Node) GetReleaseDate

func (x *Node) GetReleaseDate() *timestamppb.Timestamp

func (*Node) GetSourceInfo

func (x *Node) GetSourceInfo() string

func (*Node) GetSummary

func (x *Node) GetSummary() string

func (*Node) GetSuppliers

func (x *Node) GetSuppliers() []*Person

func (*Node) GetType

func (x *Node) GetType() Node_NodeType

func (*Node) GetUrlDownload

func (x *Node) GetUrlDownload() string

func (*Node) GetUrlHome

func (x *Node) GetUrlHome() string

func (*Node) GetValidUntilDate

func (x *Node) GetValidUntilDate() *timestamppb.Timestamp

func (*Node) GetVersion

func (x *Node) GetVersion() string

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

func (x *Node) ProtoReflect() protoreflect.Message

func (*Node) Purl

func (n *Node) Purl() PackageURL

Purl returns the node purl as a string

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

func (*Node) Update

func (n *Node) Update(n2 *Node)

Update updates a node's fields with information from the second node Any fields in n2 which are not null (empty string, lists longer than 0 or not nill pointers will overwrite fields in Node n.

type NodeList

type NodeList struct {
	Nodes        []*Node  `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
	Edges        []*Edge  `protobuf:"bytes,2,rep,name=edges,proto3" json:"edges,omitempty"`
	RootElements []string `protobuf:"bytes,3,rep,name=root_elements,json=rootElements,proto3" json:"root_elements,omitempty"`
	// contains filtered or unexported fields
}

func (*NodeList) Add

func (nl *NodeList) Add(nl2 *NodeList)

Add combines NodeList nl2 into nl. It is the equivalent to Union but instead of returning a new NodeList it modifies nl.

func (*NodeList) AddEdge

func (nl *NodeList) AddEdge(e *Edge)

func (*NodeList) AddNode

func (nl *NodeList) AddNode(n *Node)

func (*NodeList) Descriptor deprecated

func (*NodeList) Descriptor() ([]byte, []int)

Deprecated: Use NodeList.ProtoReflect.Descriptor instead.

func (*NodeList) Equal

func (nl *NodeList) Equal(nl2 *NodeList) bool

Equal returns true if the NodeList nl is equal to nl2

func (*NodeList) GetEdgeByType

func (nl *NodeList) GetEdgeByType(fromElement string, t Edge_Type) *Edge

GetEdgeByType returns a pointer to the first edge found from fromElement of type t.

func (*NodeList) GetEdges

func (x *NodeList) GetEdges() []*Edge

func (*NodeList) GetNodeByID

func (nl *NodeList) GetNodeByID(id string) *Node

GetNodeByID returns a node with the specified ID

func (*NodeList) GetNodes

func (x *NodeList) GetNodes() []*Node

func (*NodeList) GetNodesByIdentifier

func (nl *NodeList) GetNodesByIdentifier(t, v string) []*Node

GetNodesByIdentifier returns nodes that match an identifier of type t and value v, for example t = "purl" v = "pkg:deb/debian/libpam-modules@1.4.0-9+deb11u1?arch=i386" Not that this only does "dumb" string matching no assumptions are made on the identifier type.

func (*NodeList) GetNodesByName

func (nl *NodeList) GetNodesByName(name string) []*Node

GetNodesByName returns a list of node pointers whose name equals name

func (*NodeList) GetNodesByPurlType

func (nl *NodeList) GetNodesByPurlType(purlType string) *NodeList

GetNodesByPurlType returns a nodelist containing all nodes that match a purl (package url) type. An empty purlType returns a blank nodelist

func (*NodeList) GetRootElements

func (x *NodeList) GetRootElements() []string

func (*NodeList) GetRootNodes

func (nl *NodeList) GetRootNodes() []*Node

GetRootNodes returns a list of pointers of the root nodes of the document

func (*NodeList) Intersect

func (nl *NodeList) Intersect(nl2 *NodeList) *NodeList

Intersect returns a new NodeList with nodes which are common in nl and nl2. All common nodes will be copied from nl and then `Update`d with data from nl2

func (*NodeList) ProtoMessage

func (*NodeList) ProtoMessage()

func (*NodeList) ProtoReflect

func (x *NodeList) ProtoReflect() protoreflect.Message

func (*NodeList) RelateNodeListAtID

func (nl *NodeList) RelateNodeListAtID(nl2 *NodeList, nodeID string, edgeType Edge_Type) error

RelateNodeListAtID relates the top level nodes in nl2 to the node with ID nodeID using a relationship of type edgeType. Returns an error if nodeID cannot be found in the graph. This function assumes that nodes in nl and nl2 having the same ID are equivalent and will be deduped.

func (*NodeList) RemoveNodes

func (nl *NodeList) RemoveNodes(ids []string)

RemoveNodes removes a list of nodes and its edges from the nodelist

func (*NodeList) Reset

func (x *NodeList) Reset()

func (*NodeList) String

func (x *NodeList) String() string

func (*NodeList) Union

func (nl *NodeList) Union(nl2 *NodeList) *NodeList

Union returns a new NodeList with all nodes from nl and nl2 joined together any nodes common in nl also found in nl2 will be `Update`d from data from the former.

type Node_NodeType

type Node_NodeType int32
const (
	Node_PACKAGE Node_NodeType = 0
	Node_FILE    Node_NodeType = 1
)

func (Node_NodeType) Descriptor

func (Node_NodeType) Enum

func (x Node_NodeType) Enum() *Node_NodeType

func (Node_NodeType) EnumDescriptor deprecated

func (Node_NodeType) EnumDescriptor() ([]byte, []int)

Deprecated: Use Node_NodeType.Descriptor instead.

func (Node_NodeType) Number

func (Node_NodeType) String

func (x Node_NodeType) String() string

func (Node_NodeType) Type

type PackageURL

type PackageURL string

type Person

type Person struct {
	Name     string    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	IsOrg    bool      `protobuf:"varint,2,opt,name=is_org,json=isOrg,proto3" json:"is_org,omitempty"`
	Email    string    `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	Url      string    `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"`
	Phone    string    `protobuf:"bytes,5,opt,name=phone,proto3" json:"phone,omitempty"`       // CDX
	Contacts []*Person `protobuf:"bytes,6,rep,name=contacts,proto3" json:"contacts,omitempty"` // CDX // Support?
	// contains filtered or unexported fields
}

func (*Person) Descriptor deprecated

func (*Person) Descriptor() ([]byte, []int)

Deprecated: Use Person.ProtoReflect.Descriptor instead.

func (*Person) GetContacts

func (x *Person) GetContacts() []*Person

func (*Person) GetEmail

func (x *Person) GetEmail() string

func (*Person) GetIsOrg

func (x *Person) GetIsOrg() bool

func (*Person) GetName

func (x *Person) GetName() string

func (*Person) GetPhone

func (x *Person) GetPhone() string

func (*Person) GetUrl

func (x *Person) GetUrl() string

func (*Person) ProtoMessage

func (*Person) ProtoMessage()

func (*Person) ProtoReflect

func (x *Person) ProtoReflect() protoreflect.Message

func (*Person) Reset

func (x *Person) Reset()

func (*Person) String

func (x *Person) String() string

func (*Person) ToSPDX2ClientOrg

func (p *Person) ToSPDX2ClientOrg() string

ToSPDX2ClientOrg returns a string representing the type of actor to use in the SPDX go-tools, basically it will returns "Organization" or "Person"

func (*Person) ToSPDX2ClientString

func (p *Person) ToSPDX2ClientString() string

ToSPDX2ClientString converts the person to an SPDX actor string (not valid for an SBOM but to feed into the SPDX go-tools).

type Tool

type Tool struct {
	Name    string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	Vendor  string `protobuf:"bytes,3,opt,name=vendor,proto3" json:"vendor,omitempty"`
	// contains filtered or unexported fields
}

func (*Tool) Descriptor deprecated

func (*Tool) Descriptor() ([]byte, []int)

Deprecated: Use Tool.ProtoReflect.Descriptor instead.

func (*Tool) GetName

func (x *Tool) GetName() string

func (*Tool) GetVendor

func (x *Tool) GetVendor() string

func (*Tool) GetVersion

func (x *Tool) GetVersion() string

func (*Tool) ProtoMessage

func (*Tool) ProtoMessage()

func (*Tool) ProtoReflect

func (x *Tool) ProtoReflect() protoreflect.Message

func (*Tool) Reset

func (x *Tool) Reset()

func (*Tool) String

func (x *Tool) String() string

Jump to

Keyboard shortcuts

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