eventtransform

package
v0.49.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Example (Full)
package main

import (
	"embed"
	"os"

	eventing "knative.dev/eventing/pkg/apis/eventing/v1alpha1"

	testlog "knative.dev/reconciler-test/pkg/logging"
	"knative.dev/reconciler-test/pkg/manifest"

	"knative.dev/eventing/test/rekt/resources/eventtransform"
)

//go:embed *.yaml
var yaml embed.FS

// The following examples validate the processing of the With* helper methods
// applied to config and go template parser.

func main() {
	ctx := testlog.NewContext()
	images := map[string]string{}
	cfg := map[string]interface{}{
		"name":      "foo",
		"namespace": "bar",
	}

	eventtransform.WithAnnotations(map[string]interface{}{
		"annotation1": "value1",
	})(cfg)

	eventtransform.WithSpec(
		eventtransform.WithJsonata(eventing.JsonataEventTransformationSpec{
			Expression: `{"data": $ }`,
		}),
	)(cfg)

	files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)
	if err != nil {
		panic(err)
	}

	manifest.OutputYAML(os.Stdout, files)
}
Output:
apiVersion: eventing.knative.dev/v1alpha1
kind: EventTransform
metadata:
  name: foo
  namespace: bar
    annotation1: "value1"
spec:
  jsonata:
    expression: '{"data": $ }'

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address(ctx context.Context, name string, timings ...time.Duration) (*duckv1.Addressable, error)

Address returns a JobSink's address.

func AsDestinationRef

func AsDestinationRef(name string) *duckv1.Destination

func AsKReference

func AsKReference(name string) *duckv1.KReference

AsKReference returns a KReference for a JobSink without namespace.

func GVR

func GoesReady added in v0.49.0

func GoesReady(name string) *feature.Feature

GoesReady installs a simple EventTransform with a Jsonata expression and waits for it to become ready.

func Install

func Install(name string, opts ...manifest.CfgFn) feature.StepFn

Install will create a resource, augmented with the config fn options.

func IsAddressable

func IsAddressable(name string, timings ...time.Duration) feature.StepFn

IsAddressable tests to see if a JobSink becomes addressable within the time given.

func IsNotReady

func IsNotReady(name string, timing ...time.Duration) feature.StepFn

IsNotReady tests to see if a JobSink becomes NotReady within the time given.

func IsReady

func IsReady(name string, timing ...time.Duration) feature.StepFn

IsReady tests to see if an EventTransform becomes ready within the time given.

func ValidateAddress

func ValidateAddress(name string, validate addressable.ValidateAddressFn, timings ...time.Duration) feature.StepFn

ValidateAddress validates the address returned by Address

func WithAnnotations

func WithAnnotations(annotations map[string]any) manifest.CfgFn

WithAnnotations adds annotations to the JobSink.

func WithSpec

func WithSpec(options ...SpecOption) manifest.CfgFn

Types

type SpecOption

type SpecOption func(spec *eventing.EventTransformSpec)

func WithSink

func WithSink(sink *duckv1.Destination) SpecOption

Jump to

Keyboard shortcuts

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