hub

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: 8 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 any of the following happen:

  • unable to instantiate an API client
  • unable to sign in to the Hub
  • unable to get hub version from the Hub

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

func (*Fetcher) HubVersion added in v0.0.10

func (hf *Fetcher) HubVersion() string

func (*Fetcher) Login added in v0.0.14

func (hf *Fetcher) Login() error

type FetcherInterface

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

type ImageInterface added in v0.0.5

type ImageInterface interface {
	HubProjectNameSearchString() string
	HubProjectVersionNameSearchString() string
	HubScanNameSearchString() string
}

type ImageScan

type ImageScan struct {
	RiskProfile                      RiskProfile
	PolicyStatus                     PolicyStatus
	ScanSummary                      ScanSummary
	ComponentsHref                   string
	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() PolicyStatusType

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(hubVersion string) *MockHub

func (*MockHub) FetchProjectByName

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

func (*MockHub) FetchScanFromImage

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

func (*MockHub) HubVersion added in v0.0.10

func (hub *MockHub) HubVersion() string

func (*MockHub) Login added in v0.0.14

func (hub *MockHub) Login() error

type PolicyStatus

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

func (*PolicyStatus) ViolationCount

func (ps *PolicyStatus) ViolationCount() int

type PolicyStatusType added in v0.0.8

type PolicyStatusType int
const (
	PolicyStatusTypeNotInViolation        PolicyStatusType = iota
	PolicyStatusTypeInViolation           PolicyStatusType = iota
	PolicyStatusTypeInViolationOverridden PolicyStatusType = iota
)

func (PolicyStatusType) MarshalJSON added in v0.0.8

func (p PolicyStatusType) MarshalJSON() ([]byte, error)

func (PolicyStatusType) MarshalText added in v0.0.8

func (p PolicyStatusType) MarshalText() (text []byte, err error)

func (PolicyStatusType) String added in v0.0.8

func (p PolicyStatusType) String() string

type Project

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

type RiskProfile

type RiskProfile struct {
	Categories       map[RiskProfileCategory]RiskProfileStatusCounts
	BomLastUpdatedAt string
}

func (*RiskProfile) HighRiskVulnerabilityCount

func (rp *RiskProfile) HighRiskVulnerabilityCount() int

type RiskProfileCategory added in v0.0.8

type RiskProfileCategory int
const (
	RiskProfileCategoryActivity      RiskProfileCategory = iota
	RiskProfileCategoryLicense       RiskProfileCategory = iota
	RiskProfileCategoryOperational   RiskProfileCategory = iota
	RiskProfileCategoryVersion       RiskProfileCategory = iota
	RiskProfileCategoryVulnerability RiskProfileCategory = iota
)

func (RiskProfileCategory) MarshalText added in v0.0.8

func (r RiskProfileCategory) MarshalText() (text []byte, err error)

func (RiskProfileCategory) String added in v0.0.8

func (r RiskProfileCategory) String() string

type RiskProfileStatus added in v0.0.8

type RiskProfileStatus int
const (
	RiskProfileStatusHigh    RiskProfileStatus = iota
	RiskProfileStatusMedium  RiskProfileStatus = iota
	RiskProfileStatusLow     RiskProfileStatus = iota
	RiskProfileStatusOK      RiskProfileStatus = iota
	RiskProfileStatusUnknown RiskProfileStatus = iota
)

func (RiskProfileStatus) MarshalJSON added in v0.0.8

func (r RiskProfileStatus) MarshalJSON() ([]byte, error)

func (RiskProfileStatus) MarshalText added in v0.0.8

func (r RiskProfileStatus) MarshalText() (text []byte, err error)

func (RiskProfileStatus) String added in v0.0.8

func (r RiskProfileStatus) String() string

type RiskProfileStatusCounts added in v0.0.8

type RiskProfileStatusCounts struct {
	StatusCounts map[RiskProfileStatus]int
}

func (*RiskProfileStatusCounts) HighRiskVulnerabilityCount added in v0.0.8

func (r *RiskProfileStatusCounts) 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