Documentation
¶
Index ¶
- Variables
- func CompareBlackDuckAnnotationJSON(old string, new string) bool
- func CreateImageAnnotations(obj interface{}, name string, count int) map[string]string
- func CreateImageLabels(obj interface{}, name string, count int) map[string]string
- func CreatePodAnnotations(obj interface{}) map[string]string
- func CreatePodLabels(obj interface{}) map[string]string
- func MapContainsBlackDuckEntries(origMap map[string]string, newMap map[string]string) bool
- func RemoveRegistryInfo(d string) string
- func ShortenLabelContent(data string) string
- type BlackDuckAnnotation
- func CreateBlackDuckPolicyAnnotation(hasPolicyViolations bool, url string, policyCount int, version string) *BlackDuckAnnotation
- func CreateBlackDuckVulnerabilityAnnotation(hasVulns bool, url string, vulnCount int, version string) *BlackDuckAnnotation
- func NewBlackDuckAnnotationFromJSON(data string) (*BlackDuckAnnotation, error)
Constants ¶
This section is empty.
Variables ¶
var ImageAnnotationPrefix = "quality.image.openshift.io"
ImageAnnotationPrefix is the prefix used for BlackDuckAnnotations in image annotations
var PodAnnotationPrefix = "quality.pod.openshift.io"
PodAnnotationPrefix is the prefix used for BlackDuckAnnotations in pod annotations
Functions ¶
func CompareBlackDuckAnnotationJSON ¶
CompareBlackDuckAnnotationJSON takes 2 strings that are marshaled BlackDuckAnnotations and compares them. Returns true if the unmarshaling is successful and the values are the same.
func CreateImageAnnotations ¶
CreateImageAnnotations returns a map of annotations from a ImageAnnotationData object
func CreateImageLabels ¶
CreateImageLabels returns a map of labels from a ImageAnnotationData object
func CreatePodAnnotations ¶
CreatePodAnnotations returns a map of annotations from a PodAnnotationData object
func CreatePodLabels ¶
CreatePodLabels returns a map of labels from a PodAnnotationData object func CreatePodLabels(podData *annotations.PodAnnotationData) map[string]string {
func MapContainsBlackDuckEntries ¶
MapContainsBlackDuckEntries returns true if the origMap contains all the important blackduck entries from the newMap
func RemoveRegistryInfo ¶
RemoveRegistryInfo will take a string and return a string that removes any registry name information and replaces all / with .
func ShortenLabelContent ¶
ShortenLabelContent will ensure the data is less than the 63 character limit and doesn't contain any characters that are not allowed
Types ¶
type BlackDuckAnnotation ¶
type BlackDuckAnnotation struct { Name string `json:"name"` Description string `json:"description"` Timestamp string `json:"timestamp"` Reference string `json:"reference"` ScannerVersion string `json:"scannerVersion"` Compliant bool `json:"compliant"` Summary []summaryEntry `json:"summary"` }
BlackDuckAnnotation create annotations that correspond to the Openshift Container Security guide (https://docs.openshift.com/container-platform/3.9/security/container_content.html)
func CreateBlackDuckPolicyAnnotation ¶
func CreateBlackDuckPolicyAnnotation(hasPolicyViolations bool, url string, policyCount int, version string) *BlackDuckAnnotation
CreateBlackDuckPolicyAnnotation returns an annotation containing policy violations
func CreateBlackDuckVulnerabilityAnnotation ¶
func CreateBlackDuckVulnerabilityAnnotation(hasVulns bool, url string, vulnCount int, version string) *BlackDuckAnnotation
CreateBlackDuckVulnerabilityAnnotation returns an annotation containing vulnerabilities
func NewBlackDuckAnnotationFromJSON ¶
func NewBlackDuckAnnotationFromJSON(data string) (*BlackDuckAnnotation, error)
NewBlackDuckAnnotationFromJSON takes a string that is a marshaled BlackDuckAnnotation struct and returns a BlackDuckAnnotation
func (*BlackDuckAnnotation) AsString ¶
func (bda *BlackDuckAnnotation) AsString() string
AsString makes a map corresponding to the Openshift Container Security guide (https://docs.openshift.com/container-platform/3.9/security/container_content.html)
func (*BlackDuckAnnotation) Compare ¶
func (bda *BlackDuckAnnotation) Compare(newBda *BlackDuckAnnotation) bool
Compare checks if the passed in BlackDuckAnnotation contains the same values while ignoring fields that will be different (like timestamp). Returns true if the values are the same, false otherwise