-
Notifications
You must be signed in to change notification settings - Fork 26
/
sbom_outputs_test.go
75 lines (65 loc) · 1.88 KB
/
sbom_outputs_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package sbom_test
import "time"
/* A set of structs that are used to unmarshal SBOM JSON output in tests */
type license struct {
License struct {
ID string `json:"id"`
} `json:"license"`
}
type component struct {
Type string `json:"type"`
Name string `json:"name"`
Version string `json:"version"`
Licenses []license `json:"licenses"`
PURL string `json:"purl"`
}
type cdxOutput struct {
BOMFormat string `json:"bomFormat"`
SpecVersion string `json:"specVersion"`
SerialNumber string `json:"serialNumber"`
Metadata struct {
Timestamp string `json:"timestamp"`
Component struct {
Type string `json:"type"`
Name string `json:"name"`
} `json:"component"`
} `json:"metadata"`
Components []component `json:"components"`
}
type artifact struct {
Name string `json:"name"`
Version string `json:"version"`
Licenses []string `json:"licenses"`
CPEs []string `json:"cpes"`
PURL string `json:"purl"`
}
type syftOutput struct {
Artifacts []artifact `json:"artifacts"`
Source struct {
Type string `json:"type"`
Target string `json:"target"`
} `json:"source"`
Schema struct {
Version string `json:"version"`
} `json:"schema"`
}
type externalRef struct {
Category string `json:"referenceCategory"`
Locator string `json:"referenceLocator"`
Type string `json:"referenceType"`
}
type pkg struct {
ExternalRefs []externalRef `json:"externalRefs"`
LicenseConcluded string `json:"licenseConcluded"`
LicenseDeclared string `json:"licenseDeclared"`
Name string `json:"name"`
Version string `json:"versionInfo"`
}
type spdxOutput struct {
Packages []pkg `json:"packages"`
SPDXVersion string `json:"spdxVersion"`
DocumentNamespace string `json:"documentNamespace"`
CreationInfo struct {
Created time.Time `json:"created"`
} `json:"creationInfo"`
}