api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: Apache-2.0 Imports: 6 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"
)

Three 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 curl -X GET http://perceptor:3001/metrics

Variables

This section is empty.

Functions

func SetupHTTPServer

func SetupHTTPServer(responder Responder)

Types

type AllPods

type AllPods struct {
	Pods []Pod
}

func NewAllPods

func NewAllPods(pods []Pod) *AllPods

type Container added in v0.0.3

type Container struct {
	Image Image
	Name  string
}

func NewContainer added in v0.0.3

func NewContainer(image Image, name string) *Container

type FinishedScanClientJob

type FinishedScanClientJob struct {
	Sha string
	Err string
}

type Image

type Image struct {
	Name        string
	Sha         string
	DockerImage string
}

func NewImage added in v0.0.3

func NewImage(name string, sha string, dockerImage string) *Image

type ImageSpec added in v0.0.5

type ImageSpec struct {
	PullSpec              string
	Sha                   string
	HubProjectName        string
	HubProjectVersionName string
	HubScanName           string
}

func NewImageSpec added in v0.0.5

func NewImageSpec(pullSpec string, sha string, hubProjectName string, hubProjectVersionName string, hubScanName string) *ImageSpec

type NextImage

type NextImage struct {
	ImageSpec *ImageSpec
}

func NewNextImage

func NewNextImage(imageSpec *ImageSpec) *NextImage

type Pod

type Pod struct {
	Name       string
	UID        string
	Namespace  string
	Containers []Container
}

func NewPod added in v0.0.3

func NewPod(name string, uid string, namespace string, containers []Container) *Pod

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 Pod)
	UpdatePod(pod Pod)
	DeletePod(qualifiedName string)
	GetScanResults() ScanResults
	AddImage(image 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 {
	Pods   []ScannedPod
	Images []ScannedImage
}

func NewScanResults

func NewScanResults(pods []ScannedPod, images []ScannedImage) *ScanResults

type ScannedImage added in v0.0.3

type ScannedImage struct {
	Name             string
	Sha              string
	PolicyViolations int
	Vulnerabilities  int
	OverallStatus    string
	ComponentsURL    string
}

type ScannedPod added in v0.0.3

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

Jump to

Keyboard shortcuts

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