common

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0, GPL-2.0, CC-BY-4.0 Imports: 3 Imported by: 38

Documentation

Index

Constants

View Source
const (

	// F.2 Security types
	CategorySecurity      string = "SECURITY"
	TypeSecurityCPE23Type string = "cpe23Type"
	TypeSecurityCPE22Type string = "cpe22Type"
	TypeSecurityAdvisory  string = "advisory"
	TypeSecurityFix       string = "fix"
	TypeSecurityUrl       string = "url"
	TypeSecuritySwid      string = "swid"

	// F.3 Package-Manager types
	CategoryPackageManager         string = "PACKAGE-MANAGER"
	TypePackageManagerMavenCentral string = "maven-central"
	TypePackageManagerNpm          string = "npm"
	TypePackageManagerNuGet        string = "nuget"
	TypePackageManagerBower        string = "bower"
	TypePackageManagerPURL         string = "purl"

	// F.4 Persistent-Id types
	CategoryPersistentId   string = "PERSISTENT-ID"
	TypePersistentIdSwh    string = "swh"
	TypePersistentIdGitoid string = "gitoid"

	// F.5 Other
	CategoryOther string = "OTHER"

	// 11.1 Relationship field types
	TypeRelationshipDescribe                  string = "DESCRIBES"
	TypeRelationshipDescribeBy                string = "DESCRIBED_BY"
	TypeRelationshipContains                  string = "CONTAINS"
	TypeRelationshipContainedBy               string = "CONTAINED_BY"
	TypeRelationshipDependsOn                 string = "DEPENDS_ON"
	TypeRelationshipDependencyOf              string = "DEPENDENCY_OF"
	TypeRelationshipBuildDependencyOf         string = "BUILD_DEPENDENCY_OF"
	TypeRelationshipDevDependencyOf           string = "DEV_DEPENDENCY_OF"
	TypeRelationshipOptionalDependencyOf      string = "OPTIONAL_DEPENDENCY_OF"
	TypeRelationshipProvidedDependencyOf      string = "PROVIDED_DEPENDENCY_OF"
	TypeRelationshipTestDependencyOf          string = "TEST_DEPENDENCY_OF"
	TypeRelationshipRuntimeDependencyOf       string = "RUNTIME_DEPENDENCY_OF"
	TypeRelationshipExampleOf                 string = "EXAMPLE_OF"
	TypeRelationshipGenerates                 string = "GENERATES"
	TypeRelationshipGeneratedFrom             string = "GENERATED_FROM"
	TypeRelationshipAncestorOf                string = "ANCESTOR_OF"
	TypeRelationshipDescendantOf              string = "DESCENDANT_OF"
	TypeRelationshipVariantOf                 string = "VARIANT_OF"
	TypeRelationshipDistributionArtifact      string = "DISTRIBUTION_ARTIFACT"
	TypeRelationshipPatchFor                  string = "PATCH_FOR"
	TypeRelationshipPatchApplied              string = "PATCH_APPLIED"
	TypeRelationshipCopyOf                    string = "COPY_OF"
	TypeRelationshipFileAdded                 string = "FILE_ADDED"
	TypeRelationshipFileDeleted               string = "FILE_DELETED"
	TypeRelationshipFileModified              string = "FILE_MODIFIED"
	TypeRelationshipExpandedFromArchive       string = "EXPANDED_FROM_ARCHIVE"
	TypeRelationshipDynamicLink               string = "DYNAMIC_LINK"
	TypeRelationshipStaticLink                string = "STATIC_LINK"
	TypeRelationshipDataFileOf                string = "DATA_FILE_OF"
	TypeRelationshipTestCaseOf                string = "TEST_CASE_OF"
	TypeRelationshipBuildToolOf               string = "BUILD_TOOL_OF"
	TypeRelationshipDevToolOf                 string = "DEV_TOOL_OF"
	TypeRelationshipTestOf                    string = "TEST_OF"
	TypeRelationshipTestToolOf                string = "TEST_TOOL_OF"
	TypeRelationshipDocumentationOf           string = "DOCUMENTATION_OF"
	TypeRelationshipOptionalComponentOf       string = "OPTIONAL_COMPONENT_OF"
	TypeRelationshipMetafileOf                string = "METAFILE_OF"
	TypeRelationshipPackageOf                 string = "PACKAGE_OF"
	TypeRelationshipAmends                    string = "AMENDS"
	TypeRelationshipPrerequisiteFor           string = "PREREQUISITE_FOR"
	TypeRelationshipHasPrerequisite           string = "HAS_PREREQUISITE"
	TypeRelationshipRequirementDescriptionFor string = "REQUIREMENT_DESCRIPTION_FOR"
	TypeRelationshipSpecificationFor          string = "SPECIFICATION_FOR"
	TypeRelationshipOther                     string = "OTHER"
)

Constants for various string types

Variables

This section is empty.

Functions

func RenderDocElementID

func RenderDocElementID(deID DocElementID) string

RenderDocElementID takes a DocElementID and returns the string equivalent, with the SPDXRef- prefix (and, if applicable, the DocumentRef- prefix) reinserted. If a SpecialID is present, it will be rendered verbatim and DocumentRefID and ElementRefID will be ignored.

func RenderElementID

func RenderElementID(eID ElementID) string

RenderElementID takes an ElementID and returns the string equivalent, with the SPDXRef- prefix reinserted.

Types

type Annotator

type Annotator struct {
	Annotator string
	// including AnnotatorType: one of "Person", "Organization" or "Tool"
	AnnotatorType string
}

func (Annotator) MarshalJSON

func (a Annotator) MarshalJSON() ([]byte, error)

MarshalJSON converts the receiver into a slice of bytes representing an Annotator in string form. This function is also used when marshalling to YAML

func (*Annotator) UnmarshalJSON

func (a *Annotator) UnmarshalJSON(data []byte) error

UnmarshalJSON takes an annotator in the typical one-line format and parses it into an Annotator struct. This function is also used when unmarshalling YAML

type Checksum

type Checksum struct {
	Algorithm ChecksumAlgorithm `json:"algorithm"`
	Value     string            `json:"checksumValue"`
}

Checksum provides a unique identifier to match analysis information on each specific file in a package. The Algorithm field describes the ChecksumAlgorithm used and the Value represents the file checksum

type ChecksumAlgorithm

type ChecksumAlgorithm string

ChecksumAlgorithm represents the algorithm used to generate the file checksum in the Checksum struct.

const (
	SHA224      ChecksumAlgorithm = "SHA224"
	SHA1        ChecksumAlgorithm = "SHA1"
	SHA256      ChecksumAlgorithm = "SHA256"
	SHA384      ChecksumAlgorithm = "SHA384"
	SHA512      ChecksumAlgorithm = "SHA512"
	MD2         ChecksumAlgorithm = "MD2"
	MD4         ChecksumAlgorithm = "MD4"
	MD5         ChecksumAlgorithm = "MD5"
	MD6         ChecksumAlgorithm = "MD6"
	SHA3_256    ChecksumAlgorithm = "SHA3-256"
	SHA3_384    ChecksumAlgorithm = "SHA3-384"
	SHA3_512    ChecksumAlgorithm = "SHA3-512"
	BLAKE2b_256 ChecksumAlgorithm = "BLAKE2b-256"
	BLAKE2b_384 ChecksumAlgorithm = "BLAKE2b-384"
	BLAKE2b_512 ChecksumAlgorithm = "BLAKE2b-512"
	BLAKE3      ChecksumAlgorithm = "BLAKE3"
	ADLER32     ChecksumAlgorithm = "ADLER32"
)

The checksum algorithms mentioned in the spec https://spdx.github.io/spdx-spec/4-file-information/#44-file-checksum

type Creator

type Creator struct {
	Creator string
	// CreatorType should be one of "Person", "Organization", or "Tool"
	CreatorType string
}

Creator is a wrapper around the Creator SPDX field. The SPDX field contains two values, which requires special handling in order to marshal/unmarshal it to/from Go data types.

func (Creator) MarshalJSON

func (c Creator) MarshalJSON() ([]byte, error)

MarshalJSON converts the receiver into a slice of bytes representing a Creator in string form. This function is also used with marshalling to YAML

func (*Creator) UnmarshalJSON

func (c *Creator) UnmarshalJSON(data []byte) error

UnmarshalJSON takes an annotator in the typical one-line format and parses it into a Creator struct. This function is also used when unmarshalling YAML

type DocElementID

type DocElementID struct {
	DocumentRefID string
	ElementRefID  ElementID
	SpecialID     string
}

DocElementID represents an SPDX element identifier that could be defined in a different SPDX document, and therefore could have a "DocumentRef-" portion, such as Relationships and Annotations. ElementID is used for attributes in which a "DocumentRef-" portion cannot appear, such as a Package or File definition (since it is necessarily being defined in the present document). DocumentRefID will be the empty string for elements defined in the present document. DocElementIDs should NOT contain the mandatory 'DocumentRef-' or 'SPDXRef-' portions. SpecialID is used ONLY if the DocElementID matches a defined set of permitted special values for a particular field, e.g. "NONE" or "NOASSERTION" for the right-hand side of Relationships. If SpecialID is set, DocumentRefID and ElementRefID should be empty (and vice versa).

func MakeDocElementID

func MakeDocElementID(docRef string, eltRef string) DocElementID

MakeDocElementID takes strings (without prefixes) for the DocumentRef- and SPDXRef- identifiers, and returns a DocElementID. An empty string should be used for the DocumentRef- portion if it is referring to the present document.

func MakeDocElementSpecial

func MakeDocElementSpecial(specialID string) DocElementID

MakeDocElementSpecial takes a "special" string (e.g. "NONE" or "NOASSERTION" for the right side of a Relationship), nd returns a DocElementID with it in the SpecialID field. Other fields will be empty.

func (DocElementID) MarshalJSON

func (d DocElementID) MarshalJSON() ([]byte, error)

MarshalJSON converts the receiver into a slice of bytes representing a DocElementID in string form. This function is also used when marshalling to YAML

func (*DocElementID) UnmarshalJSON

func (d *DocElementID) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON takes a SPDX Identifier string parses it into a DocElementID struct. This function is also used when unmarshalling YAML

type ElementID

type ElementID string

ElementID represents the identifier string portion of an SPDX element identifier. DocElementID should be used for any attributes which can contain identifiers defined in a different SPDX document. ElementIDs should NOT contain the mandatory 'SPDXRef-' portion.

func (ElementID) MarshalJSON

func (d ElementID) MarshalJSON() ([]byte, error)

MarshalJSON returns an SPDXRef- prefixed JSON string

func (*ElementID) UnmarshalJSON

func (d *ElementID) UnmarshalJSON(data []byte) error

UnmarshalJSON validates SPDXRef- prefixes and removes them when processing ElementIDs

type Originator

type Originator struct {
	// can be "NOASSERTION"
	Originator string
	// OriginatorType can be one of "Person", "Organization", or empty if Originator is "NOASSERTION"
	OriginatorType string
}

func (Originator) MarshalJSON

func (o Originator) MarshalJSON() ([]byte, error)

MarshalJSON converts the receiver into a slice of bytes representing an Originator in string form. This function is also used when marshalling to YAML

func (*Originator) UnmarshalJSON

func (o *Originator) UnmarshalJSON(data []byte) error

UnmarshalJSON takes an originator in the typical one-line format and parses it into an Originator struct. This function is also used when unmarshalling YAML

type PackageVerificationCode

type PackageVerificationCode struct {
	// Cardinality: mandatory, one if filesAnalyzed is true / omitted;
	//              zero (must be omitted) if filesAnalyzed is false
	Value string `json:"packageVerificationCodeValue"`
	// Spec also allows specifying files to exclude from the
	// verification code algorithm; intended to enable exclusion of
	// the SPDX document file itself.
	ExcludedFiles []string `json:"packageVerificationCodeExcludedFiles,omitempty"`
}

type SnippetRange

type SnippetRange struct {
	StartPointer SnippetRangePointer `json:"startPointer"`
	EndPointer   SnippetRangePointer `json:"endPointer"`
}

type SnippetRangePointer

type SnippetRangePointer struct {
	// 5.3: Snippet Byte Range: [start byte]:[end byte]
	// Cardinality: mandatory, one
	Offset int `json:"offset,omitempty"`

	// 5.4: Snippet Line Range: [start line]:[end line]
	// Cardinality: optional, one
	LineNumber int `json:"lineNumber,omitempty"`

	FileSPDXIdentifier ElementID `json:"reference"`
}

type Supplier

type Supplier struct {
	// can be "NOASSERTION"
	Supplier string
	// SupplierType can be one of "Person", "Organization", or empty if Supplier is "NOASSERTION"
	SupplierType string
}

func (Supplier) MarshalJSON

func (s Supplier) MarshalJSON() ([]byte, error)

MarshalJSON converts the receiver into a slice of bytes representing a Supplier in string form. This function is also used when marshalling to YAML

func (*Supplier) UnmarshalJSON

func (s *Supplier) UnmarshalJSON(data []byte) error

UnmarshalJSON takes a supplier in the typical one-line format and parses it into a Supplier struct. This function is also used when unmarshalling YAML

Jump to

Keyboard shortcuts

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