hub

package
v0.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeLocation

type CodeLocation struct {
	ScanSummaries        []ScanSummary
	CreatedAt            string
	MappedProjectVersion string
	Name                 string
	CodeLocationType     string
	Url                  string
	UpdatedAt            string
}

type Fetcher

type Fetcher struct {
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher(username string, password string, baseURL string) (*Fetcher, error)

NewFetcher returns a new, logged-in Fetcher. It will instead return an error if either of the following happen:

  • unable to instantiate an API client
  • unable to sign in to the Hub

func (*Fetcher) FetchProjectByName

func (hf *Fetcher) FetchProjectByName(projectName string) (*Project, error)

FetchProjectByName searches for a project with the matching name,

returning a populated Project model

func (*Fetcher) FetchScanFromImage

func (hf *Fetcher) FetchScanFromImage(image ImageInterface) (*ImageScan, error)

FetchScanFromImage returns an ImageScan only if: - it can find a project with the matching name, with - a project version with the matching name, with - one code location, with - one scan summary, with - a completed status

type FetcherInterface

type FetcherInterface interface {
	FetchScanFromImage(image ImageInterface) (*ImageScan, error)
}

type ImageInterface added in v0.0.5

type ImageInterface interface {
	HubProjectName() string
	HubProjectVersionName() string
	HubScanName() string
}

type ImageScan

type ImageScan struct {
	RiskProfile                      RiskProfile
	PolicyStatus                     PolicyStatus
	ScanSummary                      ScanSummary
	CodeLocationCreatedAt            string
	CodeLocationMappedProjectVersion string
	CodeLocationName                 string
	CodeLocationType                 string
	CodeLocationURL                  string
	CodeLocationUpdatedAt            string
}

ImageScan models the results that we expect to get from the hub after scanning a docker image.

func (*ImageScan) IsDone

func (scan *ImageScan) IsDone() bool

IsDone returns whether the hub imagescan results indicate that the scan is complete.

func (*ImageScan) OverallStatus

func (scan *ImageScan) OverallStatus() string

func (*ImageScan) PolicyViolationCount

func (scan *ImageScan) PolicyViolationCount() int

func (*ImageScan) VulnerabilityCount

func (scan *ImageScan) VulnerabilityCount() int

type MockHub

type MockHub struct {
	// contains filtered or unexported fields
}

MockHub is a mock implementation of ScanClientInterface .

func NewMockHub

func NewMockHub() *MockHub

func (*MockHub) FetchProjectByName

func (hub *MockHub) FetchProjectByName(string) (*Project, error)

func (*MockHub) FetchScanFromImage

func (hub *MockHub) FetchScanFromImage(image ImageInterface) (*ImageScan, error)

type PolicyStatus

type PolicyStatus struct {
	OverallStatus                string
	UpdatedAt                    string
	ComponentVersionStatusCounts map[string]int
}

func (*PolicyStatus) ViolationCount

func (ps *PolicyStatus) ViolationCount() int

type Project

type Project struct {
	Name     string
	Source   string
	Versions []Version
}

type RiskProfile

type RiskProfile struct {
	Categories       map[string]map[string]int
	BomLastUpdatedAt string
}

func (*RiskProfile) HighRiskVulnerabilityCount

func (rp *RiskProfile) HighRiskVulnerabilityCount() int

type ScanSummary

type ScanSummary struct {
	CreatedAt string
	Status    string
	UpdatedAt string
}

type Version

type Version struct {
	CodeLocations   []CodeLocation
	RiskProfile     RiskProfile
	PolicyStatus    PolicyStatus
	Distribution    string
	Nickname        string
	VersionName     string
	ReleasedOn      string
	ReleaseComments string
	Phase           string
}

func (*Version) IsImageScanDone

func (version *Version) IsImageScanDone() bool

Jump to

Keyboard shortcuts

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