api

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 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"
	AllImagesPath   = "allimages"
	AllPodsPath     = "allpods"
	// Internal
	ConcurrentScanLimitPath = "concurrentscanlimit"
)

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 AllImages added in v0.0.7

type AllImages struct {
	Images []Image
}

func NewAllImages added in v0.0.7

func NewAllImages(images []Image) *AllImages

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 {
	ImageSpec ImageSpec
	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 ImageInfo added in v0.0.10

type ImageInfo struct {
	Image            Image
	PolicyViolations int
	Vulnerabilities  int
	OverallStatus    string
	ComponentsURL    string
}

type ImageSpec added in v0.0.5

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

func NewImageSpec added in v0.0.5

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

type MockResponder added in v0.0.10

type MockResponder struct {
	Pods             map[string]Pod
	Images           map[string]ImageInfo
	NextImageCounter int
}

func NewMockResponder added in v0.0.10

func NewMockResponder() *MockResponder

func (*MockResponder) AddImage added in v0.0.10

func (mr *MockResponder) AddImage(image Image)

func (*MockResponder) AddPod added in v0.0.10

func (mr *MockResponder) AddPod(pod Pod)

func (*MockResponder) DeletePod added in v0.0.10

func (mr *MockResponder) DeletePod(qualifiedName string)

func (*MockResponder) Error added in v0.0.10

func (mr *MockResponder) Error(w http.ResponseWriter, r *http.Request, err error, statusCode int)

func (*MockResponder) GetMetrics added in v0.0.10

func (mr *MockResponder) GetMetrics(w http.ResponseWriter, r *http.Request)

func (*MockResponder) GetModel added in v0.0.10

func (mr *MockResponder) GetModel() string

func (*MockResponder) GetNextImage added in v0.0.10

func (mr *MockResponder) GetNextImage() NextImage

func (*MockResponder) GetScanResults added in v0.0.10

func (mr *MockResponder) GetScanResults() ScanResults

func (*MockResponder) NotFound added in v0.0.10

func (mr *MockResponder) NotFound(w http.ResponseWriter, r *http.Request)

func (*MockResponder) PostFinishScan added in v0.0.10

func (mr *MockResponder) PostFinishScan(job FinishedScanClientJob)

func (*MockResponder) SetConcurrentScanLimit added in v0.0.10

func (mr *MockResponder) SetConcurrentScanLimit(limit SetConcurrentScanLimit)

func (*MockResponder) UpdateAllImages added in v0.0.10

func (mr *MockResponder) UpdateAllImages(allImages AllImages)

func (*MockResponder) UpdateAllPods added in v0.0.10

func (mr *MockResponder) UpdateAllPods(allPods AllPods)

func (*MockResponder) UpdatePod added in v0.0.10

func (mr *MockResponder) UpdatePod(pod Pod)

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 {
	GetModel() string

	// perceiver
	AddPod(pod Pod)
	UpdatePod(pod Pod)
	DeletePod(qualifiedName string)
	GetScanResults() ScanResults
	AddImage(image Image)
	UpdateAllPods(allPods AllPods)
	UpdateAllImages(allImages AllImages)

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

	// internal use
	SetConcurrentScanLimit(limit SetConcurrentScanLimit)

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

type ScanResults

type ScanResults struct {
	HubScanClientVersion string
	HubVersion           string
	Pods                 []ScannedPod
	Images               []ScannedImage
}

func NewScanResults

func NewScanResults(hubScanClientVersion string, hubVersion string, 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
}

type SetConcurrentScanLimit added in v0.0.7

type SetConcurrentScanLimit struct {
	Limit int
}

Jump to

Keyboard shortcuts

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