api

package
v2.2.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: Apache-2.0 Imports: 7 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// 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)

SetupHTTPServer will setup all api's to be served

Types

type AllImages added in v0.0.7

type AllImages struct {
	Images []Image
}

AllImages .....

func NewAllImages added in v0.0.7

func NewAllImages(images []Image) *AllImages

NewAllImages .....

type AllPods

type AllPods struct {
	Pods []Pod
}

AllPods .....

func NewAllPods

func NewAllPods(pods []Pod) *AllPods

NewAllPods .....

type Container added in v0.0.3

type Container struct {
	Image Image
	Name  string
}

Container .....

func NewContainer added in v0.0.3

func NewContainer(image Image, name string) *Container

NewContainer .....

type CoreModel

type CoreModel struct {
	Pods             map[string]*Pod
	Images           map[string]*ModelImageInfo
	ImageScanQueue   []map[string]interface{}
	ImageTransitions []*ModelImageTransition
}

CoreModel .....

type FinishedScanClientJob

type FinishedScanClientJob struct {
	ImageSpec *ImageSpec
	Err       string
}

FinishedScanClientJob stores the scan client job finished status

type Image

type Image struct {
	Repository              string
	Tag                     string
	Sha                     string
	Priority                *int
	BlackDuckProjectName    string
	BlackDuckProjectVersion string
}

Image .....

func NewImage added in v0.0.3

func NewImage(repository string, tag string, sha string, priority *int, blackDuckProjectName string, blackDuckProjectVersion string) *Image

NewImage .....

type ImageInfo added in v0.0.10

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

ImageInfo .....

type ImageSpec added in v0.0.5

type ImageSpec struct {
	Repository                  string
	Tag                         string
	Sha                         string
	Scheme                      string
	Domain                      string
	Port                        int
	User                        string
	Password                    string
	BlackDuckProjectName        string
	BlackDuckProjectVersionName string
	BlackDuckScanName           string
	Priority                    int
}

ImageSpec stores the Image specification

type MockResponder added in v0.0.10

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

MockResponder .....

func NewMockResponder added in v0.0.10

func NewMockResponder() *MockResponder

NewMockResponder .....

func (*MockResponder) AddImage added in v0.0.10

func (mr *MockResponder) AddImage(image Image) error

AddImage .....

func (*MockResponder) AddPod added in v0.0.10

func (mr *MockResponder) AddPod(pod Pod) error

AddPod .....

func (*MockResponder) DeletePod added in v0.0.10

func (mr *MockResponder) DeletePod(qualifiedName string)

DeletePod .....

func (*MockResponder) Error added in v0.0.10

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

Error .....

func (*MockResponder) GetModel added in v0.0.10

func (mr *MockResponder) GetModel() (*Model, error)

GetModel .....

func (*MockResponder) GetNextImage added in v0.0.10

func (mr *MockResponder) GetNextImage() NextImage

GetNextImage .....

func (*MockResponder) GetScanResults added in v0.0.10

func (mr *MockResponder) GetScanResults() ScanResults

GetScanResults .....

func (*MockResponder) NotFound added in v0.0.10

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

NotFound .....

func (*MockResponder) PostCommand

func (mr *MockResponder) PostCommand(command *PostCommand)

PostCommand ...

func (*MockResponder) PostFinishScan added in v0.0.10

func (mr *MockResponder) PostFinishScan(job FinishedScanClientJob) error

PostFinishScan .....

func (*MockResponder) UpdateAllImages added in v0.0.10

func (mr *MockResponder) UpdateAllImages(allImages AllImages) error

UpdateAllImages .....

func (*MockResponder) UpdateAllPods added in v0.0.10

func (mr *MockResponder) UpdateAllPods(allPods AllPods) error

UpdateAllPods .....

func (*MockResponder) UpdatePod added in v0.0.10

func (mr *MockResponder) UpdatePod(pod Pod) error

UpdatePod .....

type Model added in v0.0.17

type Model struct {
	BlackDucks map[string]*ModelBlackDuck
	CoreModel  *CoreModel
	Config     *ModelConfig
	Scheduler  *ModelScanScheduler
}

Model stores the perceptor model

type ModelBlackDuck

type ModelBlackDuck struct {
	// can we log in to the Black Duck?
	//	IsLoggedIn bool
	// have all the projects been sucked in?
	HasLoadedAllCodeLocations bool
	// map of project name to ... ? Black Duck URL?
	//	Projects map[string]string
	// map of code location name to mapped project version url
	CodeLocations  map[string]*ModelCodeLocation
	Errors         []string
	Status         string
	CircuitBreaker *ModelCircuitBreaker
	Host           string
}

ModelBlackDuck describes a Black Duck client model

type ModelBlackDuckConfig

type ModelBlackDuckConfig struct {
	Hosts           []*ModelHost
	ClientTimeout   ModelTime
	TLSVerification bool
}

ModelBlackDuckConfig ...

type ModelCircuitBreaker

type ModelCircuitBreaker struct {
	State               string
	NextCheckTime       *time.Time
	MaxBackoffDuration  ModelTime
	ConsecutiveFailures int
}

ModelCircuitBreaker ...

type ModelCodeLocation

type ModelCodeLocation struct {
	Stage                string
	Href                 string
	URL                  string
	MappedProjectVersion string
	UpdatedAt            string
	ComponentsHref       string
}

ModelCodeLocation ...

type ModelConfig added in v0.0.17

type ModelConfig struct {
	Timings   *ModelTimings
	BlackDuck *ModelBlackDuckConfig
	Port      int
	LogLevel  string
}

ModelConfig .....

type ModelHost

type ModelHost struct {
	Scheme              string
	Domain              string // it can be domain name or ip address
	Port                int
	User                string
	ConcurrentScanLimit int
}

ModelHost ...

type ModelImageInfo added in v0.0.17

type ModelImageInfo struct {
	ScanStatus             string
	TimeOfLastStatusChange string
	ScanResults            interface{}
	ImageSha               string
	RepoTags               []*ModelRepoTag
	Priority               int
}

ModelImageInfo .....

type ModelImageTransition

type ModelImageTransition struct {
	Sha  string
	From string
	To   string
	Err  string
	Time string
}

ModelImageTransition .....

type ModelRepoTag

type ModelRepoTag struct {
	Repository string
	Tag        string
}

ModelRepoTag ...

type ModelScanScheduler

type ModelScanScheduler struct {
}

ModelScanScheduler ...

type ModelTime

type ModelTime struct {
	Minutes      float64
	Seconds      float64
	Milliseconds float64
	// contains filtered or unexported fields
}

ModelTime ...

func NewModelTime

func NewModelTime(duration time.Duration) *ModelTime

NewModelTime consumes a time.Duration and calculates the minutes, seconds, and milliseconds

type ModelTimings

type ModelTimings struct {
	CheckForStalledScansPause ModelTime
	StalledScanClientTimeout  ModelTime
	ModelMetricsPause         ModelTime
	UnknownImagePause         ModelTime
}

ModelTimings ...

type NextImage

type NextImage struct {
	ImageSpec *ImageSpec
}

NextImage .....

func NewNextImage

func NewNextImage(imageSpec *ImageSpec) *NextImage

NewNextImage .....

type Pod

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

Pod .....

func NewPod added in v0.0.3

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

NewPod .....

type PostCommand

type PostCommand struct {
	ResetCircuitBreaker *bool
}

PostCommand handles commands. The values aren't important; only the presence or absence of a key matters.

type Responder

type Responder interface {
	GetModel() (*Model, error)

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

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

	// internal use
	PostCommand(commands *PostCommand)

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

Responder interface stores all the methods corresponding to Perceptor api

type ScanResults

type ScanResults struct {
	Pods   []ScannedPod
	Images []ScannedImage
}

ScanResults .....

func NewScanResults

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

NewScanResults .....

type ScannedImage added in v0.0.3

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

ScannedImage .....

type ScannedPod added in v0.0.3

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

ScannedPod .....

Jump to

Keyboard shortcuts

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