api

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterPolicyReportHandler

func ClusterPolicyReportHandler(s *report.PolicyReportStore) http.HandlerFunc

ClusterPolicyReportHandler for the ClusterPolicyReport REST API

func Gzip

func Gzip(next http.HandlerFunc) http.HandlerFunc

Gzip middleware for HTTP Handler

func HealthzHandler

func HealthzHandler(found map[string]string) http.HandlerFunc

HealthzHandler for the Halthz REST API

func PolicyReportHandler

func PolicyReportHandler(s *report.PolicyReportStore) http.HandlerFunc

PolicyReportHandler for the PolicyReport REST API

func ReadyHandler

func ReadyHandler() http.HandlerFunc

ReadyHandler for the Halthz REST API

func TargetsHandler

func TargetsHandler(targets []Target) http.HandlerFunc

TargetsHandler for the Targets REST API

Types

type PolicyReport

type PolicyReport struct {
	Name              string    `json:"name"`
	Namespace         string    `json:"namespace,omitempty"`
	Results           []Result  `json:"results"`
	Summary           Summary   `json:"summary"`
	CreationTimestamp time.Time `json:"creationTimestamp"`
}

PolicyReport API Model

type Resource

type Resource struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	Name       string `json:"name"`
	Namespace  string `json:"namespace,omitempty"`
	UID        string `json:"uid"`
}

Resource API Model

type Result

type Result struct {
	Message    string            `json:"message"`
	Policy     string            `json:"policy"`
	Rule       string            `json:"rule"`
	Priority   string            `json:"priority"`
	Status     string            `json:"status"`
	Severity   string            `json:"severity,omitempty"`
	Category   string            `json:"category,omitempty"`
	Scored     bool              `json:"scored"`
	Properties map[string]string `json:"properties,omitempty"`
	Source     string            `json:"source,omitempty"`
	Resource   *Resource         `json:"resource,omitempty"`
}

Result API Model

type Server

type Server interface {
	// Start the HTTP REST API
	Start() error
}

Server for the optional HTTP REST API

func NewServer

func NewServer(store *report.PolicyReportStore, targets []target.Client, port int, foundResources map[string]string) Server

NewServer constructor for a new API Server

type Summary

type Summary struct {
	Pass  int `json:"pass"`
	Skip  int `json:"skip"`
	Warn  int `json:"warn"`
	Error int `json:"error"`
	Fail  int `json:"fail"`
}

Summary API Model

type Target

type Target struct {
	Name                  string `json:"name"`
	MinimumPriority       string `json:"minimumPriority"`
	SkipExistingOnStartup bool   `json:"skipExistingOnStartup"`
}

Target API Model

Jump to

Keyboard shortcuts

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