opa

package
v0.0.0-test Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ContentTypeJson = "application/json; charset=utf-8"
	ContentTypeText = "text/plain; charset=utf-8"
)

Functions

func AddDocument

func AddDocument(key string, jsonData string) bool

func AddPolicy

func AddPolicy(key string, regoStr string) bool

func AnalyzeResult

func AnalyzeResult(response string) (bool, error)

this function should return matched or not needs to return same information as we need in NeuVector controller webhook..

func ConvertToRegoRule

func ConvertToRegoRule(rule *share.CLUSAdmissionRule) string

func DeleteDocument

func DeleteDocument(key string)

func DeletePolicy

func DeletePolicy(ruleId uint32)

func InitOpaServer

func InitOpaServer()

func IsOpaRestarted

func IsOpaRestarted() bool

func OpaEval

func OpaEval(policyPath string, inputFile string) (int, string, error)

func OpaEvalByString

func OpaEvalByString(policyPath string, inputData string) (int, string, error)

func RestoreOpaData

func RestoreOpaData()

func StartOpaServer

func StartOpaServer() *exec.Cmd

Types

type EvaluationResultSpec

type EvaluationResultSpec struct {
	Spec RegoSpecification `json:"specification"`
}

type EvaluationResultV1

type EvaluationResultV1 struct {
	Violations    []RegoResultEntryV1 `json:"violation"`
	ViolationMsgs []string            `json:"violationmsgs"`
	Spec          RegoSpecification   `json:"specification"`
}

for spec.Version=="v1"

type OpaEvalResultSpec

type OpaEvalResultSpec struct {
	Result EvaluationResultSpec `json:"result"`
}

type OpaEvalResultV1

type OpaEvalResultV1 struct {
	Result EvaluationResultV1 `json:"result"`
}

type RegoResultEntryV1

type RegoResultEntryV1 struct {
	Message     string `json:"message"`
	CustomField string `json:"additional_message,omitempty"`
}

type RegoSpecification

type RegoSpecification struct {
	Version     string `json:"version"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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