outputs

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package outputs implements data output produced by the application

Index

Constants

View Source
const (
	IconMagnifier = "\U0001f50e"
	IconInfo      = "\u2139"
	IconHyperlink = "\U0001F517"
)

Variables

This section is empty.

Functions

func NewColorize

func NewColorize() *colorstring.Colorize

Types

type ClusterDumpCollector added in v1.1.0

type ClusterDumpCollector interface {
	RegisterCluster(cluster *inputs.Cluster)
	Close() error
}

func NewFileClusterDumpCollector added in v1.1.0

func NewFileClusterDumpCollector(filename string) ClusterDumpCollector

func NewOutputClusterDumpCollector added in v1.1.0

func NewOutputClusterDumpCollector(output *Output) ClusterDumpCollector

type DocumentationBuilder added in v1.2.0

type DocumentationBuilder func(policies []*policy.Policy) PolicyDocumentation

type FileWriter

type FileWriter interface {
	WriteFile(filename string, data []byte, perm os.FileMode) error
}

type JSONResultCollector

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

func (*JSONResultCollector) Close

func (p *JSONResultCollector) Close() error

func (*JSONResultCollector) Name added in v1.2.0

func (p *JSONResultCollector) Name() string

func (*JSONResultCollector) RegisterResult

func (p *JSONResultCollector) RegisterResult(results []*policy.PolicyEvaluationResult) error

type MarkdownPolicyDocumentation added in v1.2.0

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

func (*MarkdownPolicyDocumentation) GenerateDocumentation added in v1.2.0

func (m *MarkdownPolicyDocumentation) GenerateDocumentation() string

type OSFileWriter

type OSFileWriter struct {
}

func (OSFileWriter) WriteFile

func (w OSFileWriter) WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFile implements the Writer interface that's been created so that ioutil.WriteFile can be mocked

type Output

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

func NewSilentOutput

func NewSilentOutput() *Output

func NewStdOutOutput

func NewStdOutOutput() *Output

func (*Output) Color

func (o *Output) Color(v string) string

func (*Output) ColorPrintf

func (o *Output) ColorPrintf(format string, a ...interface{}) (n int, err error)

func (*Output) ErrorPrint

func (o *Output) ErrorPrint(message string, cause error) (n int, err error)

func (*Output) InitTabs added in v1.2.0

func (o *Output) InitTabs(minColWidth int)

func (*Output) Printf

func (o *Output) Printf(format string, a ...interface{}) (n int, err error)

func (*Output) TabFlush added in v1.2.0

func (o *Output) TabFlush() (err error)

func (*Output) TabPrintf added in v1.2.0

func (o *Output) TabPrintf(format string, a ...interface{}) (n int, err error)

type PolicyDocumentation added in v1.2.0

type PolicyDocumentation interface {
	GenerateDocumentation() string
}

func NewMarkdownPolicyDocumentation added in v1.2.0

func NewMarkdownPolicyDocumentation(policies []*policy.Policy) PolicyDocumentation

type PubSubClient

type PubSubClient interface {
	Publish(topicName string, message []byte) (string, error)
	Close() error
}

type StorageClient

type StorageClient interface {
	BucketExists(bucketName string) bool
	Write(bucketName, objectName string, content []byte) error
	Close() error
}

type ValidationReport added in v1.2.0

type ValidationReport struct {
	ValidationTime time.Time                       `json:"validationDate"`
	Policies       []*ValidationReportPolicy       `json:"policies"`
	ClusterStats   []*ValidationReportClusterStats `json:"statistics"`
}

type ValidationReportClusterEvaluation added in v1.2.0

type ValidationReportClusterEvaluation struct {
	ClusterID        string   `json:"cluster"`
	Valid            bool     `json:"isValid"`
	Errored          bool     `json:"isErrored"`
	Violations       []string `json:"violations,omitempty"`
	ProcessingErrors []string `json:"errors,omitempty"`
}

type ValidationReportClusterStats added in v1.2.0

type ValidationReportClusterStats struct {
	ClusterID             string `json:"cluster"`
	ValidPoliciesCount    int    `json:"validPoliciesCount"`
	ViolatedPoliciesCount int    `json:"violatedPoliciesCount"`
	ErroredPoliciesCount  int    `json:"erroredPoliciesCount"`
}

type ValidationReportMapper added in v1.2.0

type ValidationReportMapper interface {
	AddResult(result *policy.PolicyEvaluationResult)
	AddResults(results []*policy.PolicyEvaluationResult)
	GetReport() *ValidationReport
	GetJSONReport() ([]byte, error)
}

func NewValidationReportMapper added in v1.2.0

func NewValidationReportMapper() ValidationReportMapper

type ValidationReportPolicy added in v1.2.0

type ValidationReportPolicy struct {
	PolicyName         string                               `json:"name"`
	PolicyGroup        string                               `json:"group"`
	PolicyTitle        string                               `json:"title"`
	PolicyDescription  string                               `json:"description"`
	Recommendation     string                               `json:"recommendation,omitempty"`
	ExternalURI        string                               `json:"externalURI,omitempty"`
	ClusterEvaluations []*ValidationReportClusterEvaluation `json:"clusters"`
}

type ValidationResultCollector

type ValidationResultCollector interface {
	RegisterResult(results []*policy.PolicyEvaluationResult) error
	Close() error
	Name() string
}

func NewCloudStorageResultCollector

func NewCloudStorageResultCollector(client StorageClient, bucketName string, objectName string) (ValidationResultCollector, error)

func NewConsoleJSONResultCollector added in v1.3.0

func NewConsoleJSONResultCollector(output *Output) ValidationResultCollector

func NewConsoleResultCollector

func NewConsoleResultCollector(output *Output) ValidationResultCollector

func NewJSONResultToCustomWriterCollector

func NewJSONResultToCustomWriterCollector(filename string, writer FileWriter) ValidationResultCollector

func NewJSONResultToFileCollector

func NewJSONResultToFileCollector(filename string) ValidationResultCollector

func NewPubSubResultCollector

func NewPubSubResultCollector(client PubSubClient, project string, topic string) ValidationResultCollector

func NewSccCollector added in v1.2.0

func NewSccCollector(ctx context.Context, orgNumber string, createSource bool, credsFile string) (ValidationResultCollector, error)

Directories

Path Synopsis
Package pubsub implements Google Cloud Pub Sub client
Package pubsub implements Google Cloud Pub Sub client
Package scc implements Security Command Center client
Package scc implements Security Command Center client
Package storage implements Google Cloud Storage client
Package storage implements Google Cloud Storage client

Jump to

Keyboard shortcuts

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