pkg

package
v0.0.0-...-476792b Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AzurePolicyToRego

func AzurePolicyToRego(policyPath string, dir string, ctx *shared.Context) error

Types

type EffectBody

type EffectBody struct {
	DefaultValue string `json:"defaultValue"`
}

func (*EffectBody) GetDefaultValue

func (e *EffectBody) GetDefaultValue() string

type If

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

func NewIf

func NewIf(body IfBody, ctx *shared.Context) (*If, error)

func (*If) ConditionName

func (i *If) ConditionName() string

func (*If) Rego

func (i *If) Rego(ctx *shared.Context) (string, error)

type IfBody

type IfBody map[string]any

type PolicyRuleBody

type PolicyRuleBody struct {
	Then *ThenBody
	If   IfBody `json:"if,omitempty"`
}

func NewPolicyRuleBody

func NewPolicyRuleBody(input map[string]any) *PolicyRuleBody

func (*PolicyRuleBody) GetIf

func (p *PolicyRuleBody) GetIf(ctx *shared.Context) (*If, error)

func (*PolicyRuleBody) GetThen

func (p *PolicyRuleBody) GetThen() *ThenBody

type PolicyRuleMetaData

type PolicyRuleMetaData struct {
	Version  string
	Category string
}

type PolicyRuleModel

type PolicyRuleModel struct {
	PolicyRule  *PolicyRuleBody
	Parameters  *PolicyRuleParameters
	DisplayName string
	PolicyType  string
	Mode        string
	Description string
	Version     string
	Metadata    *PolicyRuleMetaData
}

type PolicyRuleParameter

type PolicyRuleParameter struct {
	Name         string
	Type         PolicyRuleParameterType
	DefaultValue any
	MetaData     *PolicyRuleParameterMetaData
}

type PolicyRuleParameterMetaData

type PolicyRuleParameterMetaData struct {
	Description string
	DisplayName string
	Deprecated  bool
}

type PolicyRuleParameterType

type PolicyRuleParameterType string

type PolicyRuleParameters

type PolicyRuleParameters struct {
	Effect     *EffectBody
	Parameters map[string]*PolicyRuleParameter
}

func (*PolicyRuleParameters) GetEffect

func (p *PolicyRuleParameters) GetEffect() *EffectBody

func (*PolicyRuleParameters) GetParameter

func (p *PolicyRuleParameters) GetParameter(name string) (any, bool, error)

type Rule

type Rule struct {
	Properties *PolicyRuleModel
	Id         string
	// have to ignore this field, because all built-in policy rules' names are uuids
	Name string `json:"-"`
	// contains filtered or unexported fields
}

func (*Rule) Parse

func (r *Rule) Parse(ctx *shared.Context) error

func (*Rule) ParseParameters

func (r *Rule) ParseParameters(m map[string]any)

func (*Rule) Rego

func (r *Rule) Rego(ctx *shared.Context) (string, error)

func (*Rule) SaveToDisk

func (r *Rule) SaveToDisk() error

type ThenBody

type ThenBody struct {
	Effect string `json:"effect,omitempty"`
}

func (*ThenBody) Action

func (t *ThenBody) Action(ruleName, result, helperFunctionName string, rule *Rule) (string, error)

func (*ThenBody) GetEffect

func (t *ThenBody) GetEffect() string

func (*ThenBody) MapEffectToAction

func (t *ThenBody) MapEffectToAction(defaultEffect string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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