Documentation
¶
Index ¶
- Constants
- func AssertRego(t *testing.T, query, cfg string, input map[string]any, expected bool, ...)
- func AssertRegoAllow(t *testing.T, cfg string, input map[string]any, allowed bool, ctx *Context)
- func ConvertAzurePathToObjectPath(prop string, ctx *Context) string
- func EvaluateFunctionCall(call *FunctionCall, c *Context) (any, error)
- func EvaluateRego(t *testing.T, query, cfg string, input map[string]any, ctx *Context) any
- func FieldNameParser(fieldNameRaw string, ctx *Context) string
- func FieldNameProcessor(fieldName string, ctx *Context) (string, error)
- func HumanFriendlyEnglishString(length int) string
- func HumanFriendlyString(length int) string
- func ResolveParameterValue[T any](input any, c *Context) (T, error)
- func ResolveParameterValueAsString(input any, c *Context) (string, error)
- func SliceConstructor(input any) string
- func WithUtilFunctions(exp string) string
- type Context
- func (c *Context) CurrentCountFieldName() string
- func (c *Context) EnqueueHelperFunction(funcDec string)
- func (c *Context) EnterCountRego(name string)
- func (c *Context) ExitCountRego()
- func (c *Context) Fork() *Context
- func (c *Context) GenerateRuleName() bool
- func (c *Context) HelperFunctionsRego() string
- func (c *Context) InHelperFunction(parameterName string, action func() error) error
- func (c *Context) IsInCountRego() bool
- func (c *Context) PackageName() string
- func (c *Context) PopVarNameForField()
- func (c *Context) PushResourceType(rt string)
- func (c *Context) PushVarNameForField(name string)
- func (c *Context) UtilLibraryPackageName() string
- func (c *Context) UtilRegoFileName() string
- func (c *Context) VarNameForField() (string, bool)
- type FunctionCall
- type Options
- type Rego
- type StringRego
Constants ¶
View Source
const AllOf = "allof"
View Source
const AnyOf = "anyof"
View Source
const Audit = "audit"
View Source
const Count = "count"
View Source
const Deny = "deny"
View Source
const DeployIfNotExists = "deployifnotexists"
View Source
const Disabled = "disabled"
View Source
const Field = "field"
View Source
const IfCondition = "if"
View Source
const KindOfResource = "kind"
View Source
const Modify = "modify"
View Source
const Not = "not"
View Source
const RegexExp = "regex.match"
View Source
const RegoTestTemplate = `package main
import rego.v1
default allow := false
allow if {
%s
}`
View Source
const ResourcePathPrefix = "r.values"
View Source
const TypeOfResource = "type"
View Source
const UtilsRego = `` /* 3036-byte string literal not displayed */
View Source
const Value = "value"
View Source
const VarInCountWhere = "[VAR_IN_COUNT_WHERE]"
View Source
const Warn = "warn"
View Source
const Where = "where"
Variables ¶
This section is empty.
Functions ¶
func AssertRego ¶
func AssertRegoAllow ¶
func EvaluateFunctionCall ¶
func EvaluateFunctionCall(call *FunctionCall, c *Context) (any, error)
EvaluateFunctionCall handles different function evaluations based on function name
func EvaluateRego ¶
func FieldNameParser ¶
func HumanFriendlyString ¶
func SliceConstructor ¶
func WithUtilFunctions ¶
Types ¶
type Context ¶
type Context struct {
context.Context
GetParameterFunc func(string) (any, bool, error)
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
func NewContextWithOptions ¶
func (*Context) CurrentCountFieldName ¶
func (*Context) EnqueueHelperFunction ¶
func (*Context) EnterCountRego ¶
func (*Context) ExitCountRego ¶
func (c *Context) ExitCountRego()
func (*Context) GenerateRuleName ¶
func (*Context) HelperFunctionsRego ¶
func (*Context) InHelperFunction ¶
func (*Context) IsInCountRego ¶
func (*Context) PackageName ¶
func (*Context) PopVarNameForField ¶
func (c *Context) PopVarNameForField()
func (*Context) PushResourceType ¶
func (*Context) PushVarNameForField ¶
func (*Context) UtilLibraryPackageName ¶
func (*Context) UtilRegoFileName ¶
func (*Context) VarNameForField ¶
type FunctionCall ¶
func ParseFunctionCall ¶
func ParseFunctionCall(str string) (*FunctionCall, bool)
ParseFunctionCall extracts function name and parameters from a string if it's a function call
type StringRego ¶
type StringRego string
Click to show internal directories.
Click to hide internal directories.