Documentation
¶
Index ¶
- func ConvertYamlNodeToBytes(node *yaml.Node) ([]byte, error)
- func CreateKongService(baseName string, servers []*v3.Server, serviceDefaults []byte, ...) (map[string]interface{}, map[string]interface{}, error)
- func CrossProduct(slices ...[]any) [][]any
- func DereferenceJSONObject(value map[string]interface{}, components *map[string]interface{}) (map[string]interface{}, error)
- func GetRouteDefaults(extensions *orderedmap.Map[string, *yaml.Node], ...) ([]byte, error)
- func GetXKongComponents(doc v3.Document) (*map[string]interface{}, error)
- func GetXKongObject(extensions *orderedmap.Map[string, *yaml.Node], key string, ...) ([]byte, error)
- func SanitizeRegexCapture(varName string, insoCompat bool) string
- func Slugify(insoCompat bool, name ...string) string
- func ToKebabCase(s string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertYamlNodeToBytes ¶
ConvertYamlNodeToBytes will convert a yaml node to bytes.
func CreateKongService ¶
func CreateKongService( baseName string, servers []*v3.Server, serviceDefaults []byte, upstreamDefaults []byte, tags []string, uuidNamespace uuid.UUID, skipID bool, ) (map[string]interface{}, map[string]interface{}, error)
CreateKongService creates a new Kong service entity, and optional upstream. `baseName` will be used as the name of the service (slugified), and as input for the UUIDv5 generation.
func CrossProduct ¶
CrossProduct computes the Cartesian product of the input slices. The slices can be of any type
func DereferenceJSONObject ¶
func DereferenceJSONObject( value map[string]interface{}, components *map[string]interface{}, ) (map[string]interface{}, error)
DereferenceJSONObject will dereference a JSON object.
func GetRouteDefaults ¶
func GetRouteDefaults( extensions *orderedmap.Map[string, *yaml.Node], components *map[string]interface{}, ) ([]byte, error)
GetRouteDefaults returns a JSON string containing the route defaults
func GetXKongComponents ¶
GetXKongComponents returns a map of the '/components/x-kong/' object. If the extension is not there it will return an empty map. If the entry is not a yaml object, it will return an error.
func GetXKongObject ¶
func GetXKongObject( extensions *orderedmap.Map[string, *yaml.Node], key string, components *map[string]interface{}, ) ([]byte, error)
GetXKongObject returns specified 'key' from the extension properties if available. Returns nil if it wasn't found, an error if it wasn't an object or couldn't be dereferenced. The returned object will be json encoded again.
func SanitizeRegexCapture ¶
SanitizeRegexCapture will remove illegal characters from the path-variable name. The returned name will be valid for PCRE regex captures; Alphanumeric + '_', starting with [a-zA-Z].
func Slugify ¶
Slugify converts a name to a valid Kong name by removing and replacing unallowed characters and sanitizing non-latin characters. Multiple inputs will be concatenated using '_'.
func ToKebabCase ¶
ToKebabCase converts a string to kebab-case Handles camelCase, PascalCase, snake_case, and existing kebab-case
Types ¶
This section is empty.