annotations

package
v2.2.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateImageAnnotations

func CreateImageAnnotations(obj interface{}, name string, count int) map[string]string

CreateImageAnnotations returns a map of annotations from a ImageAnnotationData object

func CreateImageLabels

func CreateImageLabels(obj interface{}, name string, count int) map[string]string

CreateImageLabels returns a map of labels from a ImageAnnotationData object

func CreatePodAnnotations

func CreatePodAnnotations(obj interface{}) map[string]string

CreatePodAnnotations returns a map of annotations from a PodAnnotationData object

func CreatePodLabels

func CreatePodLabels(obj interface{}) map[string]string

CreatePodLabels returns a map of labels from a PodAnnotationData object

func RemoveRegistryInfo

func RemoveRegistryInfo(d string) string

RemoveRegistryInfo will take a string and return a string that removes any registry name information and replaces all / with .

func ShortenLabelContent

func ShortenLabelContent(data string) string

ShortenLabelContent will ensure the data is less than the 63 character limit and doesn't contain any characters that are not allowed

func StringMapContains

func StringMapContains(bigMap map[string]string, subset map[string]string) bool

StringMapContains will return true all the key/value pairs in subset exist and are the same in bigMap

Types

type ImageAnnotationData

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

ImageAnnotationData describes the data model for image annotation

func NewImageAnnotationData

func NewImageAnnotationData(policyViolationCount int, vulnerabilityCount int, overallStatus string, url string, serverVersion string, scVersion string) *ImageAnnotationData

NewImageAnnotationData creates a new ImageAnnotationData object

func (*ImageAnnotationData) GetComponentsURL

func (iad *ImageAnnotationData) GetComponentsURL() string

GetComponentsURL returns the image components URL

func (*ImageAnnotationData) GetOverallStatus

func (iad *ImageAnnotationData) GetOverallStatus() string

GetOverallStatus returns the image overall status

func (*ImageAnnotationData) GetPolicyViolationCount

func (iad *ImageAnnotationData) GetPolicyViolationCount() int

GetPolicyViolationCount returns the number of image policy violations

func (*ImageAnnotationData) GetScanClientVersion

func (iad *ImageAnnotationData) GetScanClientVersion() string

GetScanClientVersion returns the version of the scan client used to scan the image

func (*ImageAnnotationData) GetServerVersion

func (iad *ImageAnnotationData) GetServerVersion() string

GetServerVersion returns the version of the hub that provided the information

func (*ImageAnnotationData) GetVulnerabilityCount

func (iad *ImageAnnotationData) GetVulnerabilityCount() int

GetVulnerabilityCount returns the number of image vulnerabilities

func (*ImageAnnotationData) HasPolicyViolations

func (iad *ImageAnnotationData) HasPolicyViolations() bool

HasPolicyViolations returns true if the image has any policy violations

func (*ImageAnnotationData) HasVulnerabilities

func (iad *ImageAnnotationData) HasVulnerabilities() bool

HasVulnerabilities returns true if the image has any vulnerabilities

type ImageAnnotatorHandler

type ImageAnnotatorHandler interface {
	MapCompareHandler
	CreateImageLabels(interface{}, string, int) map[string]string
	CreateImageAnnotations(interface{}, string, int) map[string]string
}

ImageAnnotatorHandler provides the functions needed to annotate images

type ImageAnnotatorHandlerFuncs

type ImageAnnotatorHandlerFuncs struct {
	MapCompareHandlerFuncs
	ImageLabelCreationFunc      func(interface{}, string, int) map[string]string
	ImageAnnotationCreationFunc func(interface{}, string, int) map[string]string
}

ImageAnnotatorHandlerFuncs is an adapter to let you easily define as many of the image annotation functions as desired while still implementing ImageAnnotatorHandler

func (ImageAnnotatorHandlerFuncs) CreateImageAnnotations

func (i ImageAnnotatorHandlerFuncs) CreateImageAnnotations(data interface{}, name string, count int) map[string]string

CreateImageAnnotations calls AnnotationCreationFunc if it is not null

func (ImageAnnotatorHandlerFuncs) CreateImageLabels

func (i ImageAnnotatorHandlerFuncs) CreateImageLabels(data interface{}, name string, count int) map[string]string

CreateImageLabels calls LabelCreationFunc if it is not null

type MapCompareHandler

type MapCompareHandler interface {
	CompareMaps(map[string]string, map[string]string) bool
}

MapCompareHandler handles comparing 2 maps

type MapCompareHandlerFuncs

type MapCompareHandlerFuncs struct {
	MapCompareFunc func(map[string]string, map[string]string) bool
}

MapCompareHandlerFuncs is an adapter to let you easily define a function to use to compare 2 maps if desired while still implementing MapCompareHandler

func (MapCompareHandlerFuncs) CompareMaps

func (m MapCompareHandlerFuncs) CompareMaps(bigMap map[string]string, subset map[string]string) bool

CompareMaps calls MapCompareFunc if it is not null

type PodAnnotationData

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

PodAnnotationData describes the data model for pod annotation

func NewPodAnnotationData

func NewPodAnnotationData(policyViolationCount int, vulnerabilityCount int, overallStatus string, hubVersion string, scVersion string) *PodAnnotationData

NewPodAnnotationData creates a new PodAnnotationData object

func (*PodAnnotationData) GetHubVersion

func (pad *PodAnnotationData) GetHubVersion() string

GetHubVersion returns the version of the hub that provided the information

func (*PodAnnotationData) GetOverallStatus

func (pad *PodAnnotationData) GetOverallStatus() string

GetOverallStatus returns the pod overall status

func (*PodAnnotationData) GetPolicyViolationCount

func (pad *PodAnnotationData) GetPolicyViolationCount() int

GetPolicyViolationCount returns the number of pod policy violations

func (*PodAnnotationData) GetScanClientVersion

func (pad *PodAnnotationData) GetScanClientVersion() string

GetScanClientVersion returns the version of the scan client used to scan the images

func (*PodAnnotationData) GetVulnerabilityCount

func (pad *PodAnnotationData) GetVulnerabilityCount() int

GetVulnerabilityCount returns the number of pod vulnerabilities

func (*PodAnnotationData) HasPolicyViolations

func (pad *PodAnnotationData) HasPolicyViolations() bool

HasPolicyViolations returns true if the pod has any policy violations

func (*PodAnnotationData) HasVulnerabilities

func (pad *PodAnnotationData) HasVulnerabilities() bool

HasVulnerabilities returns true if the pod has any vulnerabilities

type PodAnnotatorHandler

type PodAnnotatorHandler interface {
	ImageAnnotatorHandler
	CreatePodLabels(interface{}) map[string]string
	CreatePodAnnotations(interface{}) map[string]string
}

PodAnnotatorHandler provides the functions needed to annotate pods

type PodAnnotatorHandlerFuncs

type PodAnnotatorHandlerFuncs struct {
	ImageAnnotatorHandlerFuncs
	PodLabelCreationFunc      func(interface{}) map[string]string
	PodAnnotationCreationFunc func(interface{}) map[string]string
}

PodAnnotatorHandlerFuncs is an adapter to let you easily define as many of the pod annotation functions as desired while still implementing PodAnnotatorHandler

func (PodAnnotatorHandlerFuncs) CreatePodAnnotations

func (p PodAnnotatorHandlerFuncs) CreatePodAnnotations(data interface{}) map[string]string

CreatePodAnnotations calls AnnotationCreationFunc if it is not null

func (PodAnnotatorHandlerFuncs) CreatePodLabels

func (p PodAnnotatorHandlerFuncs) CreatePodLabels(data interface{}) map[string]string

CreatePodLabels calls LabelCreationFunc if it is not null

Jump to

Keyboard shortcuts

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