consumers

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package consumers provides helper functions for working with Dracon compatible outputs as a Consumer. Subdirectories in this package have more complete example usages of this package.

Index

Examples

Constants

View Source
const (
	// EnvDraconStartTime Start Time of Dracon Scan in RFC3339
	EnvDraconStartTime = "DRACON_SCAN_TIME"
	// EnvDraconScanID the ID of the dracon scan
	EnvDraconScanID = "DRACON_SCAN_ID"
)

Variables

View Source
var (

	// Raw represents if the non-enriched results should be used
	Raw bool
)

Functions

func LoadEnrichedToolResponse

func LoadEnrichedToolResponse() ([]*v1.EnrichedLaunchToolResponse, error)

LoadEnrichedToolResponse loads enriched results from the enricher

Example
responses, err := LoadEnrichedToolResponse()
if err != nil {
	log.Fatal(err)
}
for _, res := range responses {
	scanStartTime, _ := ptypes.Timestamp(res.GetOriginalResults().GetScanInfo().GetScanStartTime())
	_ = scanStartTime
	for _, iss := range res.GetIssues() {
		// Do your own logic with issues here
		_ = iss
	}
}
Output:

func LoadToolResponse

func LoadToolResponse() ([]*v1.LaunchToolResponse, error)

LoadToolResponse loads raw results from producers

Example
responses, err := LoadToolResponse()
if err != nil {
	log.Fatal(err)
}
for _, res := range responses {
	scanStartTime, _ := ptypes.Timestamp(res.GetScanInfo().GetScanStartTime())
	_ = scanStartTime
	for _, iss := range res.GetIssues() {
		// Do your own logic with issues here
		_ = iss
	}
}
Output:

func ParseFlags

func ParseFlags() error

ParseFlags will parse the input flags for the consumer and perform simple validation

Example
if err := ParseFlags(); err != nil {
	log.Fatal(err)
}
Output:

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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