api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: Apache-2.0 Imports: 7 Imported by: 8

Documentation

Index

Constants

View Source
const (
	PerceptorBaseURL = "http://perceptor"
	// perceptor-scanner paths
	NextImagePath    = "nextimage"
	FinishedScanPath = "finishedscan"
	// perceiver paths
	PodPath         = "pod"
	ImagePath       = "image"
	ScanResultsPath = "scanresults"
	AllPodsPath     = "allpods"
	// ports (basically so that you can run these locally without them stomping on each other -- for testing)
	PerceptorPort        = "3001"
	PerceiverPort        = "3002"
	PerceptorScannerPort = "3003"
)

Two things that should work: curl -X GET http://perceptor.bds-perceptor.svc.cluster.local:3001/metrics curl -X GET http://perceptor.bds-perceptor:3001/metrics

Variables

This section is empty.

Functions

func SetupHTTPServer

func SetupHTTPServer(responder Responder)

Types

type AllPods

type AllPods struct {
	Pods []common.Pod
}

func NewAllPods

func NewAllPods(pods []common.Pod) *AllPods

type FinishedScanClientJob

type FinishedScanClientJob struct {
	Image common.Image
	Err   string
}

type Image

type Image struct {
	Name              string
	Sha               string
	PolicyViolations  int
	Vulnerabilities   int
	ProjectVersionURL string
	ScanID            string
}

type NextImage

type NextImage struct {
	Image *common.Image
}

func NewNextImage

func NewNextImage(image *common.Image) *NextImage

type Pod

type Pod struct {
	Namespace        string
	Name             string
	PolicyViolations int
	Vulnerabilities  int
	OverallStatus    string
}

type Responder

type Responder interface {
	// state of the program
	// this is a funky return type because it's so tightly coupled to prometheus
	GetMetrics(w http.ResponseWriter, r *http.Request)
	GetModel() string

	// perceiver
	AddPod(pod common.Pod)
	UpdatePod(pod common.Pod)
	DeletePod(qualifiedName string)
	GetScanResults() ScanResults
	AddImage(image common.Image)
	UpdateAllPods(allPods AllPods)

	// scanner
	GetNextImage(func(nextImage NextImage))
	PostFinishScan(job FinishedScanClientJob)

	// errors
	NotFound(w http.ResponseWriter, r *http.Request)
	Error(w http.ResponseWriter, r *http.Request, err error, statusCode int)
}

type ScanResults

type ScanResults struct {
	// TODO should ScannerVersion and HubServer be handled by perceiver, or supplied by perceptor?
	ScannerVersion string
	HubServer      string
	Pods           []Pod
	Images         []Image
}

func NewScanResults

func NewScanResults(scannerVersion string, hubServer string, pods []Pod, images []Image) *ScanResults

Jump to

Keyboard shortcuts

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