fn

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsMain

func AsMain(input interface{}) error

AsMain evaluates the ResourceContext from STDIN to STDOUT. `input` can be - a `ResourceContextProcessor` which implements `Process` method - a function `Runner` which implements `Run` method

func Log

func Log(in ...interface{})

func Logf

func Logf(format string, in ...interface{})

func ParseResourceContext

func ParseResourceContext(input []byte) (*rctxv1.ResourceContext, error)

func Run

func Run(p ResourceContextProcessor, in []byte) ([]byte, error)

Run evaluates the function. input must be a resourceContext in json format. An updated resourceContext will be returned.

Types

type ByteReadWriter

type ByteReadWriter struct {
	// Reader is where ResourceContext are decoded from.
	Reader io.Reader

	// Writer is where ResourceContext are encoded.
	Writer io.Writer
}

func (*ByteReadWriter) Read

func (rw *ByteReadWriter) Read() (*rctxv1.ResourceContext, error)

type ResourceContextProcessor

type ResourceContextProcessor interface {
	Process(rctx *rctxv1.ResourceContext) (bool, error)
}

ResourceContextProcessor is implemented by configuration functions built with this framework to conform to the Configuration Functions Specification: https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md

type ResourceContextProcessorFunc

type ResourceContextProcessorFunc func(rctx *rctxv1.ResourceContext) (bool, error)

ResourceContextProcessorFunc converts a compatible function to a ResourceContextProcessor.

func (ResourceContextProcessorFunc) Process

type Runner

type Runner interface {
	// Returns:
	//    return a boolean to tell whether the execution should be considered as PASS or FAIL.
	Run(rctx *rctxv1.ResourceContext) bool
}

Jump to

Keyboard shortcuts

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