eventing

package
v0.0.0-...-d340b75 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LegacyPublishEndpointFormat     = "%s/%s/v1/events"
	CloudEventPublishEndpointFormat = "%s/publish"
)
View Source
const (
	EventsEndpointFormat = "%s/events/%s"
)

Variables

View Source
var (
	ErrFailedSendingCE      = errors.New("failed to send cloudevent")
	ErrEncodingNotSupported = errors.New("unsupported cloudevent encoding")
)

Functions

func CloudEventData

func CloudEventData(source, eventType string, encoding binding.Encoding) map[string]interface{}

func CloudEventMode

func CloudEventMode(encoding binding.Encoding) string

func ExtractLegacyTypeFromSubscriptionV1Alpha2Type

func ExtractLegacyTypeFromSubscriptionV1Alpha2Type(eventVersion, eventType string, typeMatching eventingv1alpha2.TypeMatching) string

func ExtractVersionFromEventType

func ExtractVersionFromEventType(eventType string) string

func Is2XX

func Is2XX(statusCode int) bool

func LegacyEventData

func LegacyEventData(source, eventType string) string

func LegacyEventPayload

func LegacyEventPayload(id, eventVersion, eventType, data string) string

func NewCloudEvent

func NewCloudEvent(eventSource, eventType string, encoding binding.Encoding) (*cloudevents.Event, error)

func NewLegacyEvent

func NewLegacyEvent(eventSource, eventType string, typeMatching eventingv1alpha2.TypeMatching) (string, string, string, string)

Types

type Publisher

type Publisher struct {
	// contains filtered or unexported fields
}

func NewPublisher

func NewPublisher(clientCE client.Client, clientHTTP *http.Client, publisherURL string, logger *zap.Logger) *Publisher

func (*Publisher) LegacyPublishEndpoint

func (p *Publisher) LegacyPublishEndpoint(source string) string

func (*Publisher) PublishEndpoint

func (p *Publisher) PublishEndpoint() string

func (*Publisher) SendCloudEvent

func (p *Publisher) SendCloudEvent(event *cloudevents.Event, encoding binding.Encoding) error

func (*Publisher) SendCloudEventWithRetries

func (p *Publisher) SendCloudEventWithRetries(event *cloudevents.Event, encoding binding.Encoding, attempts int, interval time.Duration) error

func (*Publisher) SendLegacyEvent

func (p *Publisher) SendLegacyEvent(source, eventType, payload string) error

func (*Publisher) SendLegacyEventWithRetries

func (p *Publisher) SendLegacyEventWithRetries(source, eventType, payload string, attempts int, interval time.Duration) error

type SinkClient

type SinkClient struct {
	// contains filtered or unexported fields
}

func NewSinkClient

func NewSinkClient(clientHTTP *http.Client, sinkURL string, logger *zap.Logger) *SinkClient

func (*SinkClient) EventsEndpoint

func (sc *SinkClient) EventsEndpoint(id string) string

func (*SinkClient) GetEventFromSink

func (sc *SinkClient) GetEventFromSink(eventID string) (*SinkEvent, error)

func (*SinkClient) GetEventFromSinkWithRetries

func (sc *SinkClient) GetEventFromSinkWithRetries(id string, attempts int, interval time.Duration) (*SinkEvent, error)

type SinkEvent

type SinkEvent struct {
	// Header stores the non CE events, e.g. X-B3-Sampled and Traceparent
	http.Header
	ceevent.Event
}

type TestSubscriptionInfo

type TestSubscriptionInfo struct {
	Name         string
	Description  string
	TypeMatching eventingv1alpha2.TypeMatching
	Source       string
	Types        []string
}

func (TestSubscriptionInfo) ToSubscriptionV1Alpha2

func (s TestSubscriptionInfo) ToSubscriptionV1Alpha2(sink, namespace string) *eventingv1alpha2.Subscription

Jump to

Keyboard shortcuts

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