envoy

package
v0.0.0-...-1fccfa7 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApigwFilterToEnvoyNode

func ApigwFilterToEnvoyNode(r *types.ApigwFilter) (node *envoyx.Node, err error)

func ApigwRouteToEnvoyNode

func ApigwRouteToEnvoyNode(r *types.ApigwRoute) (node *envoyx.Node, err error)

func ApplicationToEnvoyNode

func ApplicationToEnvoyNode(r *types.Application) (node *envoyx.Node, err error)

func AuthClientToEnvoyNode

func AuthClientToEnvoyNode(r *types.AuthClient) (node *envoyx.Node, err error)

func DalConnectionToEnvoyNode

func DalConnectionToEnvoyNode(r *types.DalConnection) (node *envoyx.Node, err error)

func DalSensitivityLevelToEnvoyNode

func DalSensitivityLevelToEnvoyNode(r *types.DalSensitivityLevel) (node *envoyx.Node, err error)

func QueueToEnvoyNode

func QueueToEnvoyNode(r *types.Queue) (node *envoyx.Node, err error)

func ReportToEnvoyNode

func ReportToEnvoyNode(r *types.Report) (node *envoyx.Node, err error)

func RoleToEnvoyNode

func RoleToEnvoyNode(r *types.Role) (node *envoyx.Node, err error)

func SettingValueToEnvoyNode

func SettingValueToEnvoyNode(r *types.SettingValue) (node *envoyx.Node, err error)

func TemplateToEnvoyNode

func TemplateToEnvoyNode(r *types.Template) (node *envoyx.Node, err error)

func UserToEnvoyNode

func UserToEnvoyNode(r *types.User) (node *envoyx.Node, err error)

Types

type StoreDecoder

type StoreDecoder struct{}

StoreDecoder is responsible for generating Envoy nodes from already stored resources which can then be managed by Envoy and imported via an encoder.

func (StoreDecoder) Decode

func (d StoreDecoder) Decode(ctx context.Context, p envoyx.DecodeParams) (out envoyx.NodeSet, err error)

Decode returns a set of envoy nodes based on the provided params

StoreDecoder expects the DecodeParam of `storer` and `dal` which conform to the store.Storer and dal.FullService interfaces.

type StoreEncoder

type StoreEncoder struct{}

StoreEncoder is responsible for encoding Corteza resources into the database via the Storer or the DAL interface

@todo consider having a different encoder for the DAL resources

func (StoreEncoder) Encode

func (e StoreEncoder) Encode(ctx context.Context, p envoyx.EncodeParams, rt string, nodes envoyx.NodeSet, tree envoyx.Traverser) (err error)

Encode encodes the given Corteza resources into the primary store

Encoding should not do any additional processing apart from matching with dependencies and runtime validation

The Encode function is called for every resource type where the resource appears at the root of the dependency tree. All of the root-level resources for that resource type are passed into the function. The encoding function must traverse the branches to encode all of the dependencies.

This flow is used to simplify the flow of how resources are encoded into YAML (and other documents) as well as to simplify batching.

Encode does not receive any placeholder nodes which are used solely for dependency resolution.

func (StoreEncoder) Prepare

func (e StoreEncoder) Prepare(ctx context.Context, p envoyx.EncodeParams, rt string, nn envoyx.NodeSet) (err error)

Prepare performs some initial processing on the resource before it can be encoded

Preparation runs validation, default value initialization, matching with already existing instances, ...

The prepare function receives a set of nodes grouped by the resource type. This enables some batching optimization and simplifications when it comes to matching with existing resources.

Prepare does not receive any placeholder nodes which are used solely for dependency resolution.

type UserGetter

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

UserGetter is a utility struct to resolve user references from different parts of the system such as the dep graph and the database

func MakeUserGetter

func MakeUserGetter(s store.Storer, tt envoyx.Traverser) (g *UserGetter)

func (*UserGetter) Resolve

func (g *UserGetter) Resolve(ctx context.Context, ref any) (out uint64, err error)

Resolve returns the user ID for the provided reference

If the user can not be resolved, 0 is returned.

type YamlDecoder

type YamlDecoder struct{}

YamlDecoder is responsible for decoding YAML documents into Corteza resources which are then managed by envoy and imported via an encoder.

func (YamlDecoder) CanExt

func (d YamlDecoder) CanExt(name string) (ok bool)

CanExt returns true if the provided file extension can be decoded with this decoder

func (YamlDecoder) CanFile

func (d YamlDecoder) CanFile(f *os.File) (ok bool)

CanFile returns true if the provided file can be decoded with this decoder

func (YamlDecoder) Decode

func (d YamlDecoder) Decode(ctx context.Context, p envoyx.DecodeParams) (out envoyx.NodeSet, err error)

Decode returns a set of envoy nodes based on the provided params

YamlDecoder expects the DecodeParam of `stream` which conforms to the io.Reader interface.

type YamlEncoder

type YamlEncoder struct{}

YamlEncoder is responsible for encoding Corteza resources into a YAML supported format

func (YamlEncoder) Encode

func (e YamlEncoder) Encode(ctx context.Context, p envoyx.EncodeParams, rt string, nodes envoyx.NodeSet, tt envoyx.Traverser) (err error)

Encode encodes the given Corteza resources into some YAML supported format

Encoding should not do any additional processing apart from matching with dependencies and runtime validation

Preparation runs validation, default value initialization, matching with already existing instances, ...

The prepare function receives a set of nodes grouped by the resource type. This enables some batching optimization and simplifications when it comes to matching with existing resources.

Prepare does not receive any placeholder nodes which are used solely for dependency resolution.

Jump to

Keyboard shortcuts

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