common

package
v4.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2017 License: Apache-2.0 Imports: 9 Imported by: 8

Documentation

Index

Constants

View Source
const ScannerProjectVersionUrl = "blackducksoftware.com/project-endpoint"
View Source
const ScannerScanId = "blackducksoftware.com/scan-id"

Variables

This section is empty.

Functions

func NewHubServer

func NewHubServer(config *HubConfig) *hubServer

func ValidateGetProjectVersion

func ValidateGetProjectVersion(projectVersionUrl string, hubConfig *HubConfig) bool

Types

type Annotator

type Annotator struct {
	ScannerVersion string
	HubServer      string
}

func NewAnnotator

func NewAnnotator(ScannerVersion string, HubServer string) *Annotator

Create a new annotator

func (*Annotator) CreateBlackduckPolicyAnnotation

func (a *Annotator) CreateBlackduckPolicyAnnotation(hasPolicyViolations bool, humanReadableURL string, policyCount string) *BlackduckAnnotation

func (*Annotator) CreateBlackduckVulnerabilityAnnotation

func (a *Annotator) CreateBlackduckVulnerabilityAnnotation(hasVulns bool, humanReadableURL string, vulnCount string) *BlackduckAnnotation

CreateOpenshiftAnnotations takes the primitive information from UpdateAnnotation and translates it to openshift.

func (*Annotator) IsScanNeeded

func (a *Annotator) IsScanNeeded(info ImageInfo, ref string, hubConfig *HubConfig) bool

Determine if a scan of the specified image is required

func (*Annotator) UpdateAnnotations

func (a *Annotator) UpdateAnnotations(inputImageInfo ImageInfo, ref string, violations int, vulnerabilitiies int, projectVersionUrl string, scanId string, projectVersionUIUrl string) ImageInfo

UpdateAnnotations creates a NEW image from an old one, and returns a new image info with annotations and labels from scan results. TODO Rename this function to express the fact that it isn't actually updating any data structure, but rather creating a new one.

type BlackduckAnnotation

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

func (*BlackduckAnnotation) AsString

func (o *BlackduckAnnotation) AsString() string

AsString makes a map corresponding to the Openshift Container Security guide (https://people.redhat.com/aweiteka/docs/preview/20170510/security/container_content.html).

type CodeLocationStruct

type CodeLocationStruct struct {
	Type                 string    `json:"type"`
	Name                 string    `json:"name"`
	URL                  string    `json:"url"`
	CreatedAt            time.Time `json:"createdAt"`
	UpdatedAt            time.Time `json:"updatedAt"`
	MappedProjectVersion string    `json:"mappedProjectVersion"`
	Meta                 struct {
		Allow []string `json:"allow"`
		Href  string   `json:"href"`
		Links []struct {
			Rel  string `json:"rel"`
			Href string `json:"href"`
		} `json:"links"`
	} `json:"_meta"`
}

type CodeLocationsStruct

type CodeLocationsStruct struct {
	TotalCount int `json:"totalCount"`
	Items      []struct {
		Type                 string    `json:"type"`
		URL                  string    `json:"url"`
		CreatedAt            time.Time `json:"createdAt"`
		UpdatedAt            time.Time `json:"updatedAt"`
		MappedProjectVersion string    `json:"mappedProjectVersion"`
		Meta                 struct {
			Allow []string `json:"allow"`
			Href  string   `json:"href"`
			Links []struct {
				Rel  string `json:"rel"`
				Href string `json:"href"`
			} `json:"links"`
		} `json:"_meta"`
	} `json:"items"`
	Meta struct {
		Allow []string      `json:"allow"`
		Href  string        `json:"href"`
		Links []interface{} `json:"links"`
	} `json:"_meta"`
	AppliedFilters []interface{} `json:"appliedFilters"`
}

type HubConfig

type HubConfig struct {
	Url      string `json:"url"`
	Host     string `json:"hubhost"`
	Port     string `json:"port"`
	Scheme   string `json:"scheme"`
	User     string `json:"user"`
	Password string `json:"password"`
	Insecure string `json:"insecuretls"`
	Wire     *http.Transport
}

type ImageInfo

type ImageInfo struct {
	Labels      map[string]string
	Annotations map[string]string
}

func ProjectVersionResults

func ProjectVersionResults(info ImageInfo, imageId string, taggedName string, sha string, scanId string, projectVersionUrl string, hub *hubServer, annotate *Annotator) (e error, results ImageInfo)

func ScanResults

func ScanResults(info ImageInfo, taggedName string, imageId string, scanId string, sha string, annotate *Annotator, hubConfig *HubConfig) (e error, results ImageInfo)

type ScanSummaryStruct

type ScanSummaryStruct struct {
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"createdAt"`
	Meta      struct {
		Allow []string `json:"allow"`
		Href  string   `json:"href"`
		Links []struct {
			Rel  string `json:"rel"`
			Href string `json:"href"`
		} `json:"links"`
	} `json:"_meta"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Jump to

Keyboard shortcuts

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