selectors

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Companion package for github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1 containing conversions of proto-generated struct into golang ones and other helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromSelectors added in v1.6.0

func FromSelectors(selectorsProto []*policylangv1.Selector, agentGroup string) ([]selector, error)

FromSelectors creates a Selector from a "raw" proto-based Selector.

func MMExprFromLabelMatcher

func MMExprFromLabelMatcher(lm *policylangv1.LabelMatcher) (mm.Expr, error)

MMExprFromLabelMatcher translates proto definition of label matcher into a // single multimatcher expression

LabelMatcher can be nil or a validated LabelMatcher.

func MMExprFromProto

func MMExprFromProto(expr *policylangv1.MatchExpression) (mm.Expr, error)

MMExprFromProto converts proto definition of expression into multimatcher Expression

The expr is assumed to be validated and nonnil.

func UniqueAgentGroups added in v1.6.0

func UniqueAgentGroups(selectorProto []*policylangv1.Selector) []string

UniqueAgentGroups returns the unique agent groups of selectors.

Types

type ControlPointID

type ControlPointID struct {
	ControlPoint string
	Service      string
}

ControlPointID is the struct that represents a ControlPoint.

Agent group is implied. Type is ignored.

func NewControlPointID

func NewControlPointID(controlPoint, service string) ControlPointID

NewControlPointID returns a controlPointID.

func (ControlPointID) String added in v1.6.0

func (cp ControlPointID) String() string

String returns the string representation of the control point.

func (ControlPointID) WithType added in v1.3.0

func (cp ControlPointID) WithType(controlPointType string) TypedControlPointID

WithType returns the controlpoint as TypedControlPointID.

type GlobalControlPointID added in v0.25.0

type GlobalControlPointID struct {
	ControlPointID
	AgentGroup string
}

GlobalControlPointID is just like TypedGlobalControlPointID but embedding the ControlPointID instead of TypedControlPointID.

Useful for defining a control point to find, without having to specify the source.

type TypedControlPointID added in v1.3.0

type TypedControlPointID struct {
	ControlPointID
	Type string
}

TypedControlPointID is the struct that represents a FlowControlPoint.

Agent group is implied.

Note: We need to mirror flowcontrolpointsv1.FlowControlPoint, because protobuf-generated struct cannot be used as map keys.

func NewTypedControlPointID added in v1.3.0

func NewTypedControlPointID(controlPoint, controlPointType, service string) TypedControlPointID

NewTypedControlPointID returns a typedControlPointID.

func TypedControlPointIDFromProto added in v1.3.0

func TypedControlPointIDFromProto(protoCP *flowcontrolpointsv1.FlowControlPoint) TypedControlPointID

TypedControlPointIDFromProto creates TypedControlPointID from protobuf representation.

func (TypedControlPointID) InAgentGroup added in v1.3.0

func (cp TypedControlPointID) InAgentGroup(agentGroup string) TypedGlobalControlPointID

InAgentGroup returns the controlpoint as TypedGlobalControlPointID with given agent group.

func (*TypedControlPointID) ToProto added in v1.3.0

ToProto returns protobuf representation of control point.

type TypedGlobalControlPointID added in v1.3.0

type TypedGlobalControlPointID struct {
	TypedControlPointID
	AgentGroup string
}

TypedGlobalControlPointID is ControlPointID with explicit agent group.

Note: We need to mirror cmdv1.GlobalFlowControlPoint, because protobuf-generated struct cannot be used as map keys.

func TypedGlobalControlPointIDFromProto added in v1.3.0

func TypedGlobalControlPointIDFromProto(protoCP *cmdv1.GlobalFlowControlPoint) TypedGlobalControlPointID

TypedGlobalControlPointIDFromProto creates ControlPointID from protobuf representation.

func (*TypedGlobalControlPointID) ToProto added in v1.3.0

ToProto returns protobuf representation of control point.

Jump to

Keyboard shortcuts

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