rulesv1beta2

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ComparisonOperator_name = map[int32]string{
		0:  "COMPARISON_OPERATOR_UNSPECIFIED",
		1:  "COMPARISON_OPERATOR_EQUALS",
		2:  "COMPARISON_OPERATOR_LESS_THAN",
		3:  "COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS",
		4:  "COMPARISON_OPERATOR_GREATER_THAN",
		5:  "COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS",
		6:  "COMPARISON_OPERATOR_CONTAINED_WITHIN",
		7:  "COMPARISON_OPERATOR_STARTS_WITH",
		8:  "COMPARISON_OPERATOR_ENDS_WITH",
		9:  "COMPARISON_OPERATOR_CONTAINS",
		10: "COMPARISON_OPERATOR_PRESENT",
	}
	ComparisonOperator_value = map[string]int32{
		"COMPARISON_OPERATOR_UNSPECIFIED":            0,
		"COMPARISON_OPERATOR_EQUALS":                 1,
		"COMPARISON_OPERATOR_LESS_THAN":              2,
		"COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS":    3,
		"COMPARISON_OPERATOR_GREATER_THAN":           4,
		"COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS": 5,
		"COMPARISON_OPERATOR_CONTAINED_WITHIN":       6,
		"COMPARISON_OPERATOR_STARTS_WITH":            7,
		"COMPARISON_OPERATOR_ENDS_WITH":              8,
		"COMPARISON_OPERATOR_CONTAINS":               9,
		"COMPARISON_OPERATOR_PRESENT":                10,
	}
)

Enum value maps for ComparisonOperator.

View Source
var (
	LogicalOperator_name = map[int32]string{
		0: "LOGICAL_OPERATOR_UNSPECIFIED",
		1: "LOGICAL_OPERATOR_AND",
		2: "LOGICAL_OPERATOR_OR",
	}
	LogicalOperator_value = map[string]int32{
		"LOGICAL_OPERATOR_UNSPECIFIED": 0,
		"LOGICAL_OPERATOR_AND":         1,
		"LOGICAL_OPERATOR_OR":          2,
	}
)

Enum value maps for LogicalOperator.

View Source
var File_lekko_rules_v1beta2_rules_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Atom

type Atom struct {
	ContextKey string `protobuf:"bytes,1,opt,name=context_key,json=contextKey,proto3" json:"context_key,omitempty"`
	// For the "PRESENT" operator, the comparison value should be null.
	ComparisonValue *structpb.Value `protobuf:"bytes,2,opt,name=comparison_value,json=comparisonValue,proto3" json:"comparison_value,omitempty"`
	// For operators, context is on the left, comparison value on the right.
	ComparisonOperator ComparisonOperator `` /* 160-byte string literal not displayed */
	// contains filtered or unexported fields
}

An atom is a fragment of ruleslang that can result in a true or false. An atom always has a comparison operator and a context key, and can optionally have a comparison value.

func (*Atom) Descriptor deprecated

func (*Atom) Descriptor() ([]byte, []int)

Deprecated: Use Atom.ProtoReflect.Descriptor instead.

func (*Atom) GetComparisonOperator

func (x *Atom) GetComparisonOperator() ComparisonOperator

func (*Atom) GetComparisonValue

func (x *Atom) GetComparisonValue() *structpb.Value

func (*Atom) GetContextKey

func (x *Atom) GetContextKey() string

func (*Atom) ProtoMessage

func (*Atom) ProtoMessage()

func (*Atom) ProtoReflect

func (x *Atom) ProtoReflect() protoreflect.Message

func (*Atom) Reset

func (x *Atom) Reset()

func (*Atom) String

func (x *Atom) String() string

type ComparisonOperator

type ComparisonOperator int32
const (
	ComparisonOperator_COMPARISON_OPERATOR_UNSPECIFIED ComparisonOperator = 0
	// == only applies to number, string and bool values.
	ComparisonOperator_COMPARISON_OPERATOR_EQUALS ComparisonOperator = 1
	// > < >= <= only applies to number values.
	ComparisonOperator_COMPARISON_OPERATOR_LESS_THAN              ComparisonOperator = 2
	ComparisonOperator_COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS    ComparisonOperator = 3
	ComparisonOperator_COMPARISON_OPERATOR_GREATER_THAN           ComparisonOperator = 4
	ComparisonOperator_COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS ComparisonOperator = 5
	// Contained within only applies to list values. Elements
	// of the list must be primitive (i.e. number, string or bool)
	ComparisonOperator_COMPARISON_OPERATOR_CONTAINED_WITHIN ComparisonOperator = 6
	// Starts with and ends with only apply to string values.
	ComparisonOperator_COMPARISON_OPERATOR_STARTS_WITH ComparisonOperator = 7
	ComparisonOperator_COMPARISON_OPERATOR_ENDS_WITH   ComparisonOperator = 8
	// Contains only applies to string values, and for now is strict equality.
	// If we support things like regex or case insensitive matches, they will
	// be separate operators.
	ComparisonOperator_COMPARISON_OPERATOR_CONTAINS ComparisonOperator = 9
	// Present is the only operator that doesn't require a comparison value.
	ComparisonOperator_COMPARISON_OPERATOR_PRESENT ComparisonOperator = 10
)

func (ComparisonOperator) Descriptor

func (ComparisonOperator) Enum

func (ComparisonOperator) EnumDescriptor deprecated

func (ComparisonOperator) EnumDescriptor() ([]byte, []int)

Deprecated: Use ComparisonOperator.Descriptor instead.

func (ComparisonOperator) Number

func (ComparisonOperator) String

func (x ComparisonOperator) String() string

func (ComparisonOperator) Type

type LogicalExpression

type LogicalExpression struct {
	FirstRule       *Rule           `protobuf:"bytes,1,opt,name=first_rule,json=firstRule,proto3" json:"first_rule,omitempty"`
	SecondRule      *Rule           `protobuf:"bytes,2,opt,name=second_rule,json=secondRule,proto3" json:"second_rule,omitempty"`
	LogicalOperator LogicalOperator `` /* 148-byte string literal not displayed */
	// contains filtered or unexported fields
}

LogicalExpression operator applies a logical operator like "and" or "or" to two rules. They are evaluated in the order expressed by the field numbers and field names, with "first_rule" first.

func (*LogicalExpression) Descriptor deprecated

func (*LogicalExpression) Descriptor() ([]byte, []int)

Deprecated: Use LogicalExpression.ProtoReflect.Descriptor instead.

func (*LogicalExpression) GetFirstRule

func (x *LogicalExpression) GetFirstRule() *Rule

func (*LogicalExpression) GetLogicalOperator

func (x *LogicalExpression) GetLogicalOperator() LogicalOperator

func (*LogicalExpression) GetSecondRule

func (x *LogicalExpression) GetSecondRule() *Rule

func (*LogicalExpression) ProtoMessage

func (*LogicalExpression) ProtoMessage()

func (*LogicalExpression) ProtoReflect

func (x *LogicalExpression) ProtoReflect() protoreflect.Message

func (*LogicalExpression) Reset

func (x *LogicalExpression) Reset()

func (*LogicalExpression) String

func (x *LogicalExpression) String() string

type LogicalOperator

type LogicalOperator int32
const (
	LogicalOperator_LOGICAL_OPERATOR_UNSPECIFIED LogicalOperator = 0
	LogicalOperator_LOGICAL_OPERATOR_AND         LogicalOperator = 1
	LogicalOperator_LOGICAL_OPERATOR_OR          LogicalOperator = 2
)

func (LogicalOperator) Descriptor

func (LogicalOperator) Enum

func (x LogicalOperator) Enum() *LogicalOperator

func (LogicalOperator) EnumDescriptor deprecated

func (LogicalOperator) EnumDescriptor() ([]byte, []int)

Deprecated: Use LogicalOperator.Descriptor instead.

func (LogicalOperator) Number

func (LogicalOperator) String

func (x LogicalOperator) String() string

func (LogicalOperator) Type

type Rule

type Rule struct {

	// Types that are assignable to Rule:
	//	*Rule_Atom
	//	*Rule_Not
	//	*Rule_LogicalExpression
	//	*Rule_BoolConst
	Rule isRule_Rule `protobuf_oneof:"rule"`
	// contains filtered or unexported fields
}

A Rule is a top level object that recursively defines an AST represented by ruleslang. A rule is always one of 4 things: 1. Atom -> This is a leaf node in the tree that returns true or false 2. Not -> This negates the result of the underlying Rule. 3. LogicalExpression -> This rule links two rules through an "and" or an "or". 4. BoolConst -> true or false. This will be used for higher level short-circuits. Parenthases and other logical constructs can all be represented by the correct construction of this rule tree.

!(A && B && C) || D can be represented by LogExp ( Not ( LogExp ( LogExp ( Atom(A) && Atom(B) ) && Atom (C))) || Atom(D))

func (*Rule) Descriptor deprecated

func (*Rule) Descriptor() ([]byte, []int)

Deprecated: Use Rule.ProtoReflect.Descriptor instead.

func (*Rule) GetAtom

func (x *Rule) GetAtom() *Atom

func (*Rule) GetBoolConst

func (x *Rule) GetBoolConst() bool

func (*Rule) GetLogicalExpression

func (x *Rule) GetLogicalExpression() *LogicalExpression

func (*Rule) GetNot

func (x *Rule) GetNot() *Rule

func (*Rule) GetRule

func (m *Rule) GetRule() isRule_Rule

func (*Rule) ProtoMessage

func (*Rule) ProtoMessage()

func (*Rule) ProtoReflect

func (x *Rule) ProtoReflect() protoreflect.Message

func (*Rule) Reset

func (x *Rule) Reset()

func (*Rule) String

func (x *Rule) String() string

type Rule_Atom

type Rule_Atom struct {
	Atom *Atom `protobuf:"bytes,1,opt,name=atom,proto3,oneof"`
}

type Rule_BoolConst

type Rule_BoolConst struct {
	BoolConst bool `protobuf:"varint,4,opt,name=bool_const,json=boolConst,proto3,oneof"`
}

type Rule_LogicalExpression

type Rule_LogicalExpression struct {
	LogicalExpression *LogicalExpression `protobuf:"bytes,3,opt,name=logical_expression,json=logicalExpression,proto3,oneof"`
}

type Rule_Not

type Rule_Not struct {
	Not *Rule `protobuf:"bytes,2,opt,name=not,proto3,oneof"`
}

Jump to

Keyboard shortcuts

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