ccl

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

Cloud Compliance Language (CCL)

It is a simple domain specific language to model rules that should apply to discovered resources. It has the following syntax:

<resourceType> has <expression>

The <resourceType> refers to an existing resource type in the vocabulary. See package voc. The <expression> must evaluate to a boolean expression, which decide whether the resource is compliant or not

Expressions

Several different expression exists.

Comparison

For example, a simple comparison of two values can be achieved using

<field> <operatorType> <literalValue>

In this case, refers to a field in the resource type, defined the vocabulary. See package voc. can either be ==, !=, <=, <, >, >=, or the special contains keyword. refers to a literal in either a string, integer, float or boolean format.

Documentation

Overview

Package ccl contains the the Cloud Compliance Language (CCL). It is a simple domain specific language to model rules that should apply to discovered resources.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedContext   = errors.New("unsupported context")
	ErrFieldNameNotFound    = errors.New("invalid field name")
	ErrFieldNoMap           = errors.New("field is not a map")
	ErrFieldNoTime          = errors.New("field has no time value")
	ErrFieldNoArray         = errors.New("field is not an array")
	ErrInvalidScope         = errors.New("invalid scope in in-expression")
	ErrUnexpectedExpression = errors.New("unexpected expression")
)
View Source
var (
	ErrOperationNotSupported = errors.New("the specified operation is not supported between the two value types")
)

Functions

func RunRule

func RunRule(data string, object map[string]interface{}) (bool, error)

func RunRuleFromFile

func RunRuleFromFile(file string, object map[string]interface{}) (bool, error)

Types

type Operator

type Operator interface {
	CompareString(lhs string, rhs string) (bool, error)
	CompareInt(lhs int64, rhs int64) (bool, error)
	CompareFloat(lhs float64, rhs float64) (bool, error)
	CompareBool(lhs bool, rhs bool) (bool, error)
}

Directories

Path Synopsis
Package parser contains the files for the CCL Parser
Package parser contains the files for the CCL Parser

Jump to

Keyboard shortcuts

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