Help us shape the future of Go! Take the 2026 Go Developer Survey

celcontent

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BundleToFile

func BundleToFile(rulesDir, profilesDir, outputPath string) error

BundleToFile is a convenience that calls BundleFromDirs and writes the resulting YAML to outputPath.

func BundleToYAML

func BundleToYAML(bundle *CELBundleContent) ([]byte, error)

BundleToYAML serializes a CELBundleContent to YAML bytes.

Types

type CELBundleContent

type CELBundleContent struct {
	Rules    []CELRuleContent    `json:"rules"`
	Profiles []CELProfileContent `json:"profiles"`
}

CELBundleContent is the combined output: all rules and profiles in a single structure ready to be serialized as a bundle YAML.

func BundleFromDirs

func BundleFromDirs(rulesDir, profilesDir string) (*CELBundleContent, error)

BundleFromDirs reads individual CEL rule files from rulesDir and profile files from profilesDir, validates references, and returns a CELBundleContent. Files must have .yaml or .yml extension.

type CELProfileContent

type CELProfileContent struct {
	Name        string   `json:"name"`
	ID          string   `json:"id"`
	Title       string   `json:"title"`
	Description string   `json:"description,omitempty"`
	ProductType string   `json:"productType,omitempty"`
	ProductName string   `json:"productName,omitempty"`
	Rules       []string `json:"rules"`
	Values      []string `json:"values,omitempty"`
	Version     string   `json:"version,omitempty"`
}

CELProfileContent represents a single CEL profile definition in source form. Each profile lives in its own YAML file inside a profiles directory.

type CELRuleContent

type CELRuleContent struct {
	Name          string              `json:"name"`
	ID            string              `json:"id"`
	Title         string              `json:"title"`
	Description   string              `json:"description,omitempty"`
	Rationale     string              `json:"rationale,omitempty"`
	Severity      string              `json:"severity"`
	CheckType     string              `json:"checkType"`
	Expression    string              `json:"expression"`
	Inputs        []InputPayload      `json:"inputs"`
	FailureReason string              `json:"failureReason,omitempty"`
	Instructions  string              `json:"instructions,omitempty"`
	Variables     []string            `json:"variables,omitempty"`
	Controls      map[string][]string `json:"controls,omitempty"`
}

CELRuleContent represents a single CEL rule definition in source form. Each rule lives in its own YAML file inside a rules directory.

type InputPayload

type InputPayload struct {
	Name                string              `json:"name"`
	KubernetesInputSpec KubernetesInputSpec `json:"kubernetesInputSpec"`
}

InputPayload mirrors cmpv1alpha1.InputPayload without importing the full API package, keeping this utility free of operator dependencies.

type KubernetesInputSpec

type KubernetesInputSpec struct {
	Group             string `json:"group,omitempty"`
	APIVersion        string `json:"apiVersion"`
	Resource          string `json:"resource"`
	ResourceName      string `json:"resourceName,omitempty"`
	ResourceNamespace string `json:"resourceNamespace,omitempty"`
}

KubernetesInputSpec mirrors cmpv1alpha1.KubernetesInputSpec.

Jump to

Keyboard shortcuts

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