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 ¶
- func Address(ctx context.Context, name string, timings ...time.Duration) (*duckv1.Addressable, error)
- func AsDestinationRef(name string) *duckv1.Destination
- func AsKReference(name string) *duckv1.KReference
- func GVR() schema.GroupVersionResource
- func GoesReady(name string) *feature.Feature
- func Install(name string, opts ...manifest.CfgFn) feature.StepFn
- func IsAddressable(name string, timings ...time.Duration) feature.StepFn
- func IsNotReady(name string, timing ...time.Duration) feature.StepFn
- func IsReady(name string, timing ...time.Duration) feature.StepFn
- func ValidateAddress(name string, validate addressable.ValidateAddressFn, timings ...time.Duration) feature.StepFn
- func WithAnnotations(annotations map[string]any) manifest.CfgFn
- func WithSpec(options ...SpecOption) manifest.CfgFn
- type SpecOption
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 GVR() schema.GroupVersionResource
func GoesReady ¶ added in v0.49.0
GoesReady installs a simple EventTransform with a Jsonata expression and waits for it to become ready.
func IsAddressable ¶
IsAddressable tests to see if a JobSink becomes addressable within the time given.
func IsNotReady ¶
IsNotReady tests to see if a JobSink becomes NotReady 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 ¶
WithAnnotations adds annotations to the JobSink.
func WithSpec ¶
func WithSpec(options ...SpecOption) manifest.CfgFn
Types ¶
type SpecOption ¶
type SpecOption func(spec *eventing.EventTransformSpec)
func WithJsonata ¶
func WithJsonata(jsonata eventing.JsonataEventTransformationSpec) SpecOption
func WithReplyJsonata ¶
func WithReplyJsonata(jsonata eventing.JsonataEventTransformationSpec) SpecOption
func WithSink ¶
func WithSink(sink *duckv1.Destination) SpecOption
Click to show internal directories.
Click to hide internal directories.