Skip to content

Commit 5592b8d

Browse files
authored
Merge pull request #21 from j-fuentes/add-package-information-to-report-metadata
Add some more doc and add PackageInformation to ReportMetadata struct
2 parents 1557256 + 8ceaabe commit 5592b8d

File tree

1 file changed

+38
-17
lines changed

1 file changed

+38
-17
lines changed

api/report.go

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,50 @@ type PackageInformation struct {
3434

3535
// ReportSection contains the fields of a section inside a Report
3636
type ReportSection struct {
37-
ID string `json:"id"`
38-
Name string `json:"name"`
39-
Description string `json:"description,omitempty"`
40-
Rules []ReportRule `json:"rules,omitempty"`
37+
// ID is the ID of the section.
38+
ID string `json:"id"`
39+
// Name is the name of the section.
40+
Name string `json:"name"`
41+
// Description is the description of the section.
42+
Description string `json:"description,omitempty"`
43+
// Rules contain all the rules in the section.
44+
Rules []ReportRule `json:"rules,omitempty"`
4145
}
4246

4347
// ReportRule contains the fields of a rule inside a Report
4448
type ReportRule struct {
45-
ID string `json:"id"`
46-
Name string `json:"name"`
47-
Description string `json:"description,omitempty"`
48-
Manual bool `json:"manual,omitempty"`
49-
Remediation string `json:"remediation,omitempty"`
50-
Links []string `json:"links,omitempty"`
51-
Success bool `json:"success"`
52-
Value interface{} `json:"value,omitempty"`
53-
Missing bool `json:"missing"`
49+
// ID is the id of the rule.
50+
ID string `json:"id"`
51+
// Name is a shortname for the rule.
52+
Name string `json:"name"`
53+
// Description is a text describing what the rule is about.
54+
Description string `json:"description,omitempty"`
55+
// Manual indicated whether the rule can be evaluated automatically by Preflight or requires manual intervention.
56+
Manual bool `json:"manual,omitempty"`
57+
// Remediation is a text describing how to fix a failure of the rule.
58+
Remediation string `json:"remediation,omitempty"`
59+
// Links contains useful links related to the rule.
60+
Links []string `json:"links,omitempty"`
61+
// Success indicates whether the check was a success or not.
62+
Success bool `json:"success"`
63+
// Value contains the raw result of the check.
64+
Value interface{} `json:"value,omitempty"`
65+
// Missing indicated wherer the REGO rule was missing or not.
66+
Missing bool `json:"missing"`
5467
}
5568

5669
// ReportMetadata contains metadata about a report
5770
type ReportMetadata struct {
58-
Cluster string `json:"cluster"`
59-
Timestamp Time `json:"timestamp"`
60-
Package string `json:"package"`
61-
ID string `json:"id"`
71+
// Unique ID of the report.
72+
ID string `json:"id"`
73+
// Timestamp indicates when the report was generated.
74+
Timestamp Time `json:"timestamp"`
75+
// Cluster indicates which was the target of the report.
76+
Cluster string `json:"cluster"`
77+
// Package indicates which package was used for the report. (deprecated)
78+
Package string `json:"package"`
79+
// PackageInformation contains all the information about the package that was used to generate the report.
80+
PackageInformation PackageInformation `json:"package-information"`
81+
// PreflightVersion indicates the version of preflight this report was generated with.
82+
PreflightVersion string `json:"preflight-version"`
6283
}

0 commit comments

Comments
 (0)