utils

package
v1.17.0-beta22 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTypesNotEqual = fmt.Errorf("types not equal")
	ErrNotSettable   = fmt.Errorf("can't set value")
)

Functions

func FindAppliedRouteFilter

func FindAppliedRouteFilter(
	routeCtx *plugins.RouteContext,
	filterType gwv1.HTTPRouteFilterType,
) *gwv1.HTTPRouteFilter

FindAppliedRouteFilter finds the first instance of the filterType supplied in the Rule being processed. Returns nil if the Rule doesn't contain a filter of the provided Type

func FindAppliedRouteFilters

func FindAppliedRouteFilters(
	routeCtx *plugins.RouteContext,
	filterTypes ...gwv1.HTTPRouteFilterType,
) []gwv1.HTTPRouteFilter

FindAppliedRouteFilters finds all instances of the supplied filterTypes for the Rule supplied in the RouteContext. Should only be used for plugins that support multiple filters as part of a single Rule

func FindExtensionRefFilter

func FindExtensionRefFilter(
	routeCtx *plugins.RouteContext,
	gk schema.GroupKind,
) *gwv1.HTTPRouteFilter

FindExtensionRefFilter finds the first instance of an ExtensionRef filter that references the supplied GroupKind in the Rule being processed. Returns nil if the Rule doesn't contain a matching ExtensionRef filter

func GetExtensionRefObj

func GetExtensionRefObj(
	ctx context.Context,
	routeCtx *plugins.RouteContext,
	queries query.GatewayQueries,
	extensionRef *gwv1.LocalObjectReference,
	obj client.Object,
) error

GetExtensionRefObj uses the provided query engine to retrieve an ExtensionRef object and set the value of `obj` to point to it. The type of `obj` must match the type referenced in the extensionRef and must be a pointer. An error will be returned if the Get was unsuccessful or if the type passed is not valid. A nil error indicates success and `obj` should be usable as normal.

func SortByCreationTime

func SortByCreationTime(objs interface{})

SortByCreationTime accepts a slice of client.Object instances and sorts it by creation timestamp in ascending order. It panics if the argument isn't a slice, or if it is a slice of a type that does not implement client.Object.

Types

This section is empty.

Jump to

Keyboard shortcuts

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