util

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetRego = "rego"
	TargetWasm = "wasm"
)
View Source
const (
	JSON           = "json"
	HCL2           = "hcl2"
	YAML           = "yaml"
	TERRAFORM_PLAN = "tf-plan"
)
View Source
const (
	LOW      = "low"
	MEDIUM   = "medium"
	HIGH     = "high"
	CRITICAL = "critical"
)
View Source
const (
	ExplainModeFull  = "full"
	ExplainModeNotes = "notes"
	ExplainModeFails = "fails"
)

Variables

View Source
var ValidSeverityLevels = []string{LOW, MEDIUM, HIGH, CRITICAL}

Functions

func CreateDirectory

func CreateDirectory(workingDirectory string, name string, strict bool) (string, error)

func CreateFile

func CreateFile(workingDirectory string, name string) (string, error)

func IsPointingAtTemplatedRules added in v0.7.0

func IsPointingAtTemplatedRules(paths []string) error

func TemplateFile

func TemplateFile(workingDirectory string, fileName string, template string, templating Templating) error

func Term

func Term() (*ast.Term, error)

func ValidateFilePath added in v0.4.0

func ValidateFilePath(path string) (fs.FileInfo, error)

Types

type CapabilitiesFlag added in v0.5.0

type CapabilitiesFlag struct {
	C *ast.Capabilities
	// contains filtered or unexported fields
}

func NewCapabilitiesFlag added in v0.5.0

func NewCapabilitiesFlag() CapabilitiesFlag

func (*CapabilitiesFlag) Set added in v0.5.0

func (f *CapabilitiesFlag) Set(s string) error

func (*CapabilitiesFlag) String added in v0.5.0

func (f *CapabilitiesFlag) String() string

func (*CapabilitiesFlag) Type added in v0.5.0

func (f *CapabilitiesFlag) Type() string

type EnumFlag

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

func NewEnumFlag

func NewEnumFlag(defaultValue string, vs []string) EnumFlag

func (*EnumFlag) IsSet

func (f *EnumFlag) IsSet() bool

IsSet will return true if the EnumFlag has been set.

func (*EnumFlag) Set

func (f *EnumFlag) Set(s string) error

Set sets the enum value. If s is not a valid enum value, an error is returned.

func (*EnumFlag) String

func (f *EnumFlag) String() string

String returns the EnumValue's value as string.

func (*EnumFlag) Type

func (f *EnumFlag) Type() string

Type returns the valid enumeration values.

type LoaderFilter

type LoaderFilter struct {
	Ignore []string
}

LoaderFilter was taken from https://github.com/open-policy-agent/opa/blob/v0.31.0/cmd/filters.go#L13

func (LoaderFilter) Apply

func (f LoaderFilter) Apply(abspath string, info os.FileInfo, depth int) bool

type RepeatedStringFlag

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

func NewRepeatedStringFlag

func NewRepeatedStringFlag(defaultValue string) RepeatedStringFlag

func (*RepeatedStringFlag) IsSet

func (f *RepeatedStringFlag) IsSet() bool

func (*RepeatedStringFlag) Set

func (f *RepeatedStringFlag) Set(s string) error

func (*RepeatedStringFlag) String

func (f *RepeatedStringFlag) String() string

func (*RepeatedStringFlag) Strings

func (f *RepeatedStringFlag) Strings() []string

func (*RepeatedStringFlag) Type

func (f *RepeatedStringFlag) Type() string

type Rule added in v1.2.1

type Rule struct {
	PublicId      string
	SeverityLevel string
	Path          string
}

func RetrieveRules added in v1.1.1

func RetrieveRules(paths []string) ([]Rule, error)

type Templating

type Templating struct {
	RuleID       string
	RuleTitle    string
	RuleSeverity string
	Replace      func(string, string, string) string
}

Jump to

Keyboard shortcuts

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