api

package
v0.1.8-rc Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package api provides types for Preflight reports and some common helpers.

Index

Constants

View Source
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 ClusterSummary

type ClusterSummary struct {
	Cluster         string     `json:"cluster"`
	LatestReportSet *ReportSet `json:"latestReportSet"`
}

ClusterSummary contains a summary of the most recent status of a cluster.

type Report

type Report 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"`
	// Package indicates which package was used for the report
	Package     string          `json:"package"`
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	Sections    []ReportSection `json:"sections,omitempty"`
}

Report contains the fields of a Preflight report

type ReportMetadata

type ReportMetadata struct {
	Cluster   string `json:"cluster"`
	Timestamp Time   `json:"timestamp"`
	Package   string `json:"package"`
	ID        string `json:"id"`
}

ReportMetadata contains metadata about a report

type ReportRule

type ReportRule struct {
	ID          string      `json:"id"`
	Name        string      `json:"name"`
	Description string      `json:"description,omitempty"`
	Manual      bool        `json:"manual,omitempty"`
	Remediation string      `json:"remediation,omitempty"`
	Links       []string    `json:"links,omitempty"`
	Success     bool        `json:"success"`
	Value       interface{} `json:"value,omitempty"`
	Missing     bool        `json:"missing"`
}

ReportRule contains the fields of a rule inside a Report

type ReportSection

type ReportSection struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Description string       `json:"description,omitempty"`
	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

type Time struct {
	time.Time
}

Time is a wrapper around time.Time that overrides how it is marshaled into JSON

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON marshals the timestamp with RFC3339 format

func (Time) String

func (t Time) String() string

String returns a string representation of the timestamp

Jump to

Keyboard shortcuts

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