function

package
v0.0.0-...-c7d747a Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const CatalogV2 = "__catalog_v2"

CatalogV2 is the an invalid namespace used to build catalog function into the porch v1alpha1.function struct. This namespace distinguishes catalog function from porch functions. This will be trimmed before showing to users.

Variables

This section is empty.

Functions

func CatalogFunction

func CatalogFunction(name string, keywords []string, fnTypes []v1alpha1.FunctionType) v1alpha1.Function

CatalogFunction converts catalog function into the porch v1alpha1.function struct.

func GetNames

func GetNames(functions []v1alpha1.Function) []string

GetNames returns the list of function names. - Porch function name is <PackageRepository>:<ImageName>:<Version>. e.g. kpt-functions:set-annotation:v0.1 - Catalog v2 function name is trimed to only contain <ImageName>:<Version>, and exclude gcr.io/kpt-fn. e.g. set-annotation:v0.1

func MatchFunctions

func MatchFunctions(functions []v1alpha1.Function, matchers ...Matcher) []v1alpha1.Function

Types

type KeywordsMatcher

type KeywordsMatcher struct {
	Keywords []string
}

func (KeywordsMatcher) Match

func (m KeywordsMatcher) Match(function v1alpha1.Function) bool

Match determines whether the `function` has keywords which match the matcher's `Keywords`. Experimental: This logic may change to only if all function keywords are found from matcher's `Keywords`, can it claims a match (return true).

type Matcher

type Matcher interface {
	Match(v1alpha1.Function) bool
}

type TypeMatcher

type TypeMatcher struct {
	FnType string
}

func (TypeMatcher) Match

func (m TypeMatcher) Match(function v1alpha1.Function) bool

Match determines whether the `function` (which can be multi-typed), belongs to the matcher's FnType. type value should only be `validator` or `mutator`.

Jump to

Keyboard shortcuts

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