pingsource

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Example (Full)
package main

import (
	"embed"
	"os"

	"knative.dev/reconciler-test/pkg/manifest"
)

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

func main() {
	images := map[string]string{}
	cfg := map[string]interface{}{
		"name":        "foo",
		"namespace":   "bar",
		"schedule":    "*/1 * * * *",
		"contentType": "application/json",
		"data":        `{"message": "Hello world!"}`,
		"sink": map[string]interface{}{
			"ref": map[string]string{
				"kind":       "sinkkind",
				"namespace":  "sinknamespace",
				"name":       "sinkname",
				"apiVersion": "sinkversion",
			},
			"uri": "uri/parts",
		},
	}

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

	manifest.OutputYAML(os.Stdout, files)
}
Output:

apiVersion: sources.knative.dev/v1
kind: PingSource
metadata:
  name: foo
  namespace: bar
spec:
  schedule: '*/1 * * * *'
  contentType: 'application/json'
  data: '{"message": "Hello world!"}'
  sink:
    ref:
      kind: sinkkind
      namespace: bar
      name: sinkname
      apiVersion: sinkversion
    uri: uri/parts
Example (Fullbase64)
package main

import (
	"embed"
	"os"

	"knative.dev/reconciler-test/pkg/manifest"
)

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

func main() {
	images := map[string]string{}
	cfg := map[string]interface{}{
		"name":        "foo",
		"namespace":   "bar",
		"schedule":    "*/1 * * * *",
		"contentType": "application/json",
		"dataBase64":  "aabbccddeeff",
		"sink": map[string]interface{}{
			"ref": map[string]string{
				"kind":       "sinkkind",
				"namespace":  "sinknamespace",
				"name":       "sinkname",
				"apiVersion": "sinkversion",
			},
			"uri": "uri/parts",
		},
	}

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

	manifest.OutputYAML(os.Stdout, files)
}
Output:

apiVersion: sources.knative.dev/v1
kind: PingSource
metadata:
  name: foo
  namespace: bar
spec:
  schedule: '*/1 * * * *'
  contentType: 'application/json'
  dataBase64: 'aabbccddeeff'
  sink:
    ref:
      kind: sinkkind
      namespace: bar
      name: sinkname
      apiVersion: sinkversion
    uri: uri/parts
Example (Min)
package main

import (
	"embed"
	"os"

	"knative.dev/reconciler-test/pkg/manifest"
)

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

func main() {
	images := map[string]string{}
	cfg := map[string]interface{}{
		"name":       "foo",
		"namespace":  "bar",
		"brokerName": "baz",
	}

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

	manifest.OutputYAML(os.Stdout, files)
}
Output:

apiVersion: sources.knative.dev/v1
kind: PingSource
metadata:
  name: foo
  namespace: bar
spec:

Index

Examples

Constants

This section is empty.

Variables

View Source
var WithSink = source.WithSink

WithSink adds the sink related config to a PingSource spec.

Functions

func Gvr

func Install

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

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

func IsReady

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

IsReady tests to see if a PingSource becomes ready within the time given.

func WithData

func WithData(contentType, data string) manifest.CfgFn

WithData adds the contentType and data config to a PingSource spec.

func WithDataBase64

func WithDataBase64(contentType, dataBase64 string) manifest.CfgFn

WithDataBase64 adds the contentType and dataBase64 config to a PingSource spec.

Types

This section is empty.

Jump to

Keyboard shortcuts

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