input

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSON    = "json"
	YAML    = "yaml"
	Summary = "summary"
)

Possible formats the report can be written as.

Variables

This section is empty.

Functions

func ValidateInput

func ValidateInput(ctx context.Context, fpath string, policy policy.Policy, detailed bool) (*output.Output, error)

Types

type Input

type Input struct {
	FilePath     string             `json:"filepath"`
	Violations   []evaluator.Result `json:"violations"`
	Warnings     []evaluator.Result `json:"warnings"`
	Successes    []evaluator.Result `json:"successes"`
	Success      bool               `json:"success"`
	SuccessCount int                `json:"success-count"`
}

type Report

type Report struct {
	Success bool `json:"success"`

	FilePaths     []Input                          `json:"filepaths"`
	Policy        ecc.EnterpriseContractPolicySpec `json:"policy"`
	EcVersion     string                           `json:"ec-version"`
	Data          any                              `json:"-"`
	EffectiveTime time.Time                        `json:"effective-time"`
	PolicyInput   [][]byte                         `json:"-"`
	// contains filtered or unexported fields
}

func NewReport

func NewReport(inputs []Input, policy policy.Policy, data any, policyInput [][]byte) (Report, error)

WriteReport returns a new instance of Report representing the state of the filepaths provided.

func (Report) WriteAll

func (r Report) WriteAll(targets []string, p format.TargetParser) (allErrors error)

WriteAll writes the report to all the given targets.

type TestReport

type TestReport struct {
	Timestamp string `json:"timestamp"`
	Namespace string `json:"namespace"`
	Successes int    `json:"successes"`
	Failures  int    `json:"failures"`
	Warnings  int    `json:"warnings"`
	Result    string `json:"result"`
	Note      string `json:"note,omitempty"`
}

TestReport represents the standardized TEST_OUTPUT format. The `Namespace` attribute is required for the appstudio results API. However, it is always an empty string from the ec-cli as a way to indicate all namespaces were used.

Jump to

Keyboard shortcuts

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