parser

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const BOOLEAN = 57349
View Source
const COLON = 57354
View Source
const COMMA = 57364
View Source
const CREATE = 57359
View Source
const DELETE = 57358
View Source
const EOF = 57361
View Source
const EQUALS = 57365
View Source
const IDENT = 57346
View Source
const INT = 57348
View Source
const JSONDATA = 57351
View Source
const JSONPATH = 57347
View Source
const LBRACE = 57362
View Source
const LPAREN = 57352
View Source
const MATCH = 57355
View Source
const RBRACE = 57363
View Source
const REL_BEGINPROPS_LEFT = 57370
View Source
const REL_BEGINPROPS_NONE = 57371
View Source
const REL_ENDPROPS_NONE = 57373
View Source
const REL_ENDPROPS_RIGHT = 57372
View Source
const REL_NOPROPS_BOTH = 57368
View Source
const REL_NOPROPS_LEFT = 57367
View Source
const REL_NOPROPS_NONE = 57369
View Source
const REL_NOPROPS_RIGHT = 57366
View Source
const RETURN = 57360
View Source
const RPAREN = 57353
View Source
const SET = 57357
View Source
const STRING = 57350
View Source
const WHERE = 57356

Variables

View Source
var AllNamespaces bool
View Source
var GvrCacheMutex sync.RWMutex
View Source
var LogLevel string
View Source
var Namespace string

Functions

func ClearCache added in v0.4.2

func ClearCache()

func FetchAndCacheGVRs

func FetchAndCacheGVRs(clientset *kubernetes.Clientset) error

func FindGVR

func FindGVR(clientset *kubernetes.Clientset, resourceId string) (schema.GroupVersionResource, error)

func PrintCache added in v0.4.2

func PrintCache()

Types

type ASTNode

type ASTNode struct {
	Name string
	Kind string
}

func NewASTNode

func NewASTNode(name, kind string) *ASTNode

type Clause

type Clause interface {
	// contains filtered or unexported methods
}

type ComparisonType

type ComparisonType string
const (
	ExactMatch    ComparisonType = "ExactMatch"
	OwnerRefMatch ComparisonType = "OwnerRefMatch"
	ContainsAll   ComparisonType = "ContainsAll"
)

type CreateClause

type CreateClause struct {
	Nodes         []*NodePattern
	Relationships []*Relationship
}

type DefaultProp

type DefaultProp struct {
	FieldA  string
	FieldB  string
	Default interface{}
}

type DeleteClause

type DeleteClause struct {
	NodeIds []string
}

type Direction

type Direction string
const (
	Left  Direction = "left"
	Right Direction = "right"
	Both  Direction = "both"
	None  Direction = "none"
)

type Expression

type Expression struct {
	Clauses []Clause
}

func ParseQuery

func ParseQuery(query string) (*Expression, error)

type JSONPathValue

type JSONPathValue struct {
	Value interface{}
}

type JSONPathValueList

type JSONPathValueList struct {
	JSONPathValues []*JSONPathValue
}

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value interface{}
}

type Lexer

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

func NewLexer

func NewLexer(input string) *Lexer

func (*Lexer) Error

func (l *Lexer) Error(e string)

func (*Lexer) Lex

func (l *Lexer) Lex(lval *yySymType) int

type MatchClause

type MatchClause struct {
	Nodes         []*NodePattern
	Relationships []*Relationship
	ExtraFilters  []*KeyValuePair
}

type MatchCriterion

type MatchCriterion struct {
	FieldA         string
	FieldB         string
	ComparisonType ComparisonType
	DefaultProps   []DefaultProp
}

type NodePattern

type NodePattern struct {
	ResourceProperties *ResourceProperties
}

type NodeRelationshipList

type NodeRelationshipList struct {
	Nodes         []*NodePattern
	Relationships []*Relationship
}

type Properties

type Properties struct {
	PropertyList []*Property
}

type Property

type Property struct {
	Key string
	// Value is string int or bool
	Value interface{}
}

type QueryExecutor

type QueryExecutor struct {
	Clientset     *kubernetes.Clientset
	DynamicClient dynamic.Interface
	// contains filtered or unexported fields
}

func GetQueryExecutorInstance

func GetQueryExecutorInstance() *QueryExecutor

func NewQueryExecutor

func NewQueryExecutor() (*QueryExecutor, error)

func (*QueryExecutor) Execute

func (q *QueryExecutor) Execute(ast *Expression) (interface{}, error)

type Relationship

type Relationship struct {
	ResourceProperties *ResourceProperties
	Direction          Direction
	LeftNode           *NodePattern
	RightNode          *NodePattern
}

type RelationshipRule

type RelationshipRule struct {
	KindA        string
	KindB        string
	Relationship RelationshipType
	// Currently only supports one match criterion but can be extended to support multiple
	MatchCriteria []MatchCriterion
}

type RelationshipType

type RelationshipType string
const (
	// deployments to replicasets / replicasets to pods / statefulsets to pods / daemonsets to pods etc.
	DeploymentOwnReplicaset RelationshipType = "DEPLOYMENT_OWN_REPLICASET"
	ReplicasetOwnPod        RelationshipType = "REPLICASET_OWN_POD"
	StatefulsetOwnPod       RelationshipType = "STATEFULSET_OWN_POD"
	DaemonsetOwnPod         RelationshipType = "DAEMONSET_OWN_POD"
	JobOwnPod               RelationshipType = "JOB_OWN_POD"

	// services to pods / deployments / statefulsets / daemonsets / replicasets
	ServiceExposePod         RelationshipType = "SERVICE_EXPOSE_POD"
	ServiceExposeDeployment  RelationshipType = "SERVICE_EXPOSE_DEPLOYMENT"
	ServiceExposeStatefulset RelationshipType = "SERVICE_EXPOSE_STATEFULSET"
	ServiceExposeDaemonset   RelationshipType = "SERVICE_EXPOSE_DAEMONSET"
	ServiceExposeReplicaset  RelationshipType = "SERVICE_EXPOSE_REPLICASET"

	// This is for configMaps, Volumes, Secrets in pods
	Mount RelationshipType = "MOUNT"
	// ingresses to services
	Route RelationshipType = "ROUTE"
)

type ResourceProperties

type ResourceProperties struct {
	Name       string
	Kind       string
	Properties *Properties
	JsonData   string
}

type ResourceRelationship

type ResourceRelationship struct {
	FromKind string
	ToKind   string
	Type     RelationshipType
}

type ReturnClause

type ReturnClause struct {
	JsonPaths []string
}

type SetClause

type SetClause struct {
	KeyValuePairs []*KeyValuePair
}

type Token

type Token int
const (
	ILLEGAL Token = iota
	WS
)

Jump to

Keyboard shortcuts

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