cloudevents

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEncoding = ce.Binary
	DefaultSource   = "http://knative.test"
	DefaultType     = "dev.knative.test.event"
)

CloudEvent related constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseData

type BaseData struct {
	Sequence int    `json:"id"`
	Message  string `json:"message"`
}

BaseData defines a simple struct that can be used as data of a CloudEvent.

type CloudEvent

type CloudEvent struct {
	ce.EventContextV1        // use cloud events v1 context
	Data              string // must be in json format
	Encoding          string // binary or structured
}

CloudEvent specifies the arguments for a CloudEvent used as input to create a new container in test.

func New

func New(data string, options ...Option) *CloudEvent

New returns a new CloudEvent with most preset default properties.

type Option

type Option func(*CloudEvent)

Option enables further configuration of a CloudEvent.

func WithEncoding

func WithEncoding(encoding string) Option

WithType returns an option that changes the encoding for the given CloudEvent.

func WithExtensions

func WithExtensions(extensions map[string]interface{}) Option

WithExtensions returns an option that changes the extensions for the given CloudEvent.

func WithID

func WithID(id string) Option

WithType returns an option that changes the id for the given CloudEvent.

func WithSource

func WithSource(eventSource string) Option

WithSource returns an option that changes the source for the given CloudEvent.

func WithType

func WithType(eventType string) Option

WithType returns an option that changes the type for the given CloudEvent.

Jump to

Keyboard shortcuts

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