namespace

package
v0.1.46 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(deckfile *yaml.Node, selectors yamlbasics.SelectorSet, namespace string, allowEmptySelection bool) error

Apply updates route entities with the namespace. The selectors should select the routes to update. If the selectors are empty, then all routes will be updated.

func ApplyNamespaceHost added in v0.1.31

func ApplyNamespaceHost(
	deckfile *yaml.Node,
	selectors yamlbasics.SelectorSet,
	hosts []string,

	clear bool,
	allowEmptySelection bool,
) error

ApplyNamespaceHost applies the namespace to the hosts field of the selected routes by adding the listed hosts if they ar not in the list already.

func CheckNamespace

func CheckNamespace(ns string) error

CheckNamespace validates the prefix namespace. Returns updated namespace. Must start with "/", and must have at least 1 character after the "/".

func GetLuaStripFunction

func GetLuaStripFunction(ns string) string

GetLuaStripFunction returns the Lua function that strips the namespace from the upstream_uri.

func GetPreFunctionPlugin

func GetPreFunctionPlugin(namespace string) *yaml.Node

GetPreFunctionPlugin returns a plugin that strips the namespace from the upstream_uri.

func InjectNamespaceStripping

func InjectNamespaceStripping(deckfile *yaml.Node, namespace string,
	routesNeedStripping yamlbasics.NodeSet, routesNoStripping yamlbasics.NodeSet,
)

InjectNamespaceStripping injects a namespace stripper into the deckfile. The namespace stripper will remove the namespace from the path, if it matches. updated+unchanged must together be ALL routes in the file!

func UpdateRoute

func UpdateRoute(route *yaml.Node, namespace string) bool

UpdateRoute returns true if the route needs stripping the namespace. namespace must start with a "/" and end with a "/" (a single "/" is NOT valid).

func UpdateSinglePathString

func UpdateSinglePathString(path string, namespace string) string

UpdateSinglePathString updates a single path string with the namespace and returns it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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