Documentation ¶
Overview ¶
Package api provides types for Preflight reports and some common helpers.
Index ¶
Constants ¶
const TimeFormat = time.RFC3339
TimeFormat defines the format used for timestamps across all this API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentMetadata ¶ added in v0.1.17
type AgentMetadata struct { Version string `json:"version"` // ClusterID is the name of the cluster or host where the agent is running. // It may send data for other clusters in its datareadings. ClusterID string `json:"cluster_id"` }
AgentMetadata is metadata about the agent.
type ClusterSummary ¶
type ClusterSummary struct { Cluster string `json:"cluster"` LatestReportSet *ReportSet `json:"latestReportSet"` }
ClusterSummary contains a summary of the most recent status of a cluster.
func (*ClusterSummary) UnmarshalJSON ¶
func (c *ClusterSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a ClusterSummary.
type DataReading ¶
type DataReading struct { // ClusterID is optional as it can be infered from the agent // token when using basic authentication. ClusterID string `json:"cluster_id,omitempty"` DataGatherer string `json:"data-gatherer"` Timestamp Time `json:"timestamp"` Data interface{} `json:"data"` SchemaVersion string `json:"schema_version"` }
DataReading is the output of a DataGatherer.
type DataReadingsPost ¶ added in v0.1.17
type DataReadingsPost struct { AgentMetadata *AgentMetadata `json:"agent_metadata"` // DataGatherTime represents the time that the data readings were gathered DataGatherTime time.Time `json:"data_gather_time"` DataReadings []*DataReading `json:"data_readings"` }
DataReadingsPost is the payload in the upload request.
type GatheredResource ¶ added in v0.1.29
type GatheredResource struct { // Resource is a reference to a k8s object that was found by the informer // should be of type unstructured.Unstructured, raw Object Resource interface{} DeletedAt Time }
GatheredResource wraps the raw k8s resource that is sent to the jetstack secure backend
func (GatheredResource) MarshalJSON ¶ added in v0.1.29
func (v GatheredResource) MarshalJSON() ([]byte, error)
type PackageInformation ¶
type PackageInformation struct { // Namespace the package belongs to. Namespace string `json:"namespace"` // ID is the ID of the package. ID string `json:"id"` // Version is the version of the package. Version string `json:"version"` // SchemaVersion is the version of the Preflight package schema. SchemaVersion string `json:"schema-version"` }
PackageInformation contains all the details to identify a package.
type Report ¶
type Report struct { // Unique ID of the report. ID string `json:"id"` // PreflightVersion indicates the version of preflight this report was generated with. PreflightVersion string `json:"preflight-version"` // Timestamp indicates when the report was generated. Timestamp Time `json:"timestamp"` // Cluster indicates which was the target of the report. Cluster string `json:"cluster"` // Package indicates which package was used for the report. (deprecated) Package string `json:"package"` // PackageInformation contains all the information about the package that was used to generate the report. PackageInformation PackageInformation `json:"package-information"` // Name is the name of the package that was used for this report. Name string `json:"name"` // Description is the description of the package that was used for this report. Description string `json:"description,omitempty"` // Sections contains the sections of the package that was used for this report. Sections []ReportSection `json:"sections,omitempty"` }
Report contains the fields of a Preflight report
func (*Report) GetReportMetadata ¶
func (r *Report) GetReportMetadata() *ReportMetadata
GetReportMetadata returns the ReportMetadata for the Report.
func (*Report) Summarize ¶
func (r *Report) Summarize() ReportSummary
Summarize produces as ReportSummary from a Report
type ReportMetadata ¶
type ReportMetadata struct { // Unique ID of the report. ID string `json:"id"` // Timestamp indicates when the report was generated. Timestamp Time `json:"timestamp"` // Cluster indicates which was the target of the report. Cluster string `json:"cluster"` // Deprecated: Package indicates which package was used for the report. Package string `json:"package"` // PackageInformation contains all the information about the package that was used to generate the report. PackageInformation PackageInformation `json:"package-information"` // PreflightVersion indicates the version of preflight this report was generated with. PreflightVersion string `json:"preflight-version"` }
ReportMetadata contains metadata about a report
type ReportRule ¶
type ReportRule struct { // ID is the id of the rule. ID string `json:"id"` // Name is a shortname for the rule. Name string `json:"name"` // Description is a text describing what the rule is about. Description string `json:"description,omitempty"` // Manual indicated whether the rule can be evaluated automatically by Preflight or requires manual intervention. Manual bool `json:"manual,omitempty"` // Remediation is a text describing how to fix a failure of the rule. Remediation string `json:"remediation,omitempty"` // Links contains useful links related to the rule. Links []string `json:"links,omitempty"` // Success indicates whether the check was a success or not. Success bool `json:"success"` // Value contains the raw result of the check. Value interface{} `json:"value,omitempty"` // Violations contains the list of messages from the execution of the check Violations interface{} `json:"violations"` // Missing indicates whether the Rego rule was missing or not. Missing bool `json:"missing"` }
ReportRule contains the fields of a rule inside a Report
type ReportSection ¶
type ReportSection struct { // ID is the ID of the section. ID string `json:"id"` // Name is the name of the section. Name string `json:"name"` // Description is the description of the section. Description string `json:"description,omitempty"` // Rules contain all the rules in the section. Rules []ReportRule `json:"rules,omitempty"` }
ReportSection contains the fields of a section inside a Report
type ReportSet ¶
type ReportSet struct { Cluster string `json:"-"` Timestamp Time `json:"timestamp"` FailureCount int `json:"failureCount"` SuccessCount int `json:"successCount"` Reports []*ReportSummary `json:"reports"` }
ReportSet groups one or more reports of different packages with the same timestamp for the same cluster.
type ReportSummary ¶
type ReportSummary struct { ID string `json:"id"` Package string `json:"package"` Cluster string `json:"-"` Timestamp Time `json:"-"` FailureCount int `json:"failureCount"` SuccessCount int `json:"successCount"` }
ReportSummary constains a summary of a report.
type Time ¶
Time is a wrapper around time.Time that overrides how it is marshaled into JSON
func (Time) MarshalJSON ¶
MarshalJSON marshals the timestamp with RFC3339 format