events

package
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package events provides interfaces and types for working with events

Index

Constants

View Source
const (
	CientConnect  = eventv1.Event_EVENT_CLIENT_CONNECT
	BackendCreate = eventv1.Event_EVENT_BACKEND_CREATE
	BackendDelete = eventv1.Event_EVENT_BACKEND_DELETE
	BackendUpdate = eventv1.Event_EVENT_BACKEND_UPDATE
	BackendPatch  = eventv1.Event_EVENT_BACKEND_PATCH

	CertificateAuthorityCreate = eventv1.Event_EVENT_CERTIFICATEAUTHORITY_CREATE
	CertificateAuthorityDelete = eventv1.Event_EVENT_CERTIFICATEAUTHORITY_DELETE
	CertificateAuthorityUpdate = eventv1.Event_EVENT_CERTIFICATEAUTHORITY_UPDATE
	CertificateAuthorityPatch  = eventv1.Event_EVENT_CERTIFICATEAUTHORITY_PATCH

	CertificateCreate = eventv1.Event_EVENT_CERTIFICATE_CREATE
	CertificateDelete = eventv1.Event_EVENT_CERTIFICATE_DELETE
	CertificateUpdate = eventv1.Event_EVENT_CERTIFICATE_UPDATE
	CertificatePatch  = eventv1.Event_EVENT_CERTIFICATE_PATCH

	RouteCreate = eventv1.Event_EVENT_ROUTE_CREATE
	RouteDelete = eventv1.Event_EVENT_ROUTE_DELETE
	RouteUpdate = eventv1.Event_EVENT_ROUTE_UPDATE
	RoutePatch  = eventv1.Event_EVENT_ROUTE_PATCH

	PolicyCreate = eventv1.Event_EVENT_POLICY_CREATE
	PolicyDelete = eventv1.Event_EVENT_POLICY_DELETE
	PolicyUpdate = eventv1.Event_EVENT_POLICY_UPDATE
	PolicyPatch  = eventv1.Event_EVENT_POLICY_PATCH

	CredentialCreate = eventv1.Event_EVENT_CREDENTIAL_CREATE
	CredentialDelete = eventv1.Event_EVENT_CREDENTIAL_DELETE
	CredentialUpdate = eventv1.Event_EVENT_CREDENTIAL_UPDATE
	CredentialPatch  = eventv1.Event_EVENT_CREDENTIAL_PATCH

	TokenIssue  = eventv1.Event_EVENT_TOKEN_ISSUE
	TokenRevoke = eventv1.Event_EVENT_TOKEN_REVOKE
)

Variables

This section is empty.

Functions

func NewEvent

func NewEvent(evType eventv1.Event, obj Object, eventLabels ...map[string]string) *eventv1.Envelope

func NewHandler

func NewHandler[T any, PT interface {
	*T
	proto.Message
}](
	h func(context.Context, PT) error,
) func(context.Context, proto.Message) error

func NewRequest

func NewRequest(evType eventv1.Event, obj Object, labels ...map[string]string) *eventv1.PublishRequest

Types

type BackendHandlerFunc

type BackendHandlerFunc func(context.Context, *backendv1.Backend) error

type CertificateAuthorityHandlerFunc

type CertificateAuthorityHandlerFunc func(context.Context, *cav1.CertificateAuthority) error

type CertificateHandlerFunc

type CertificateHandlerFunc func(context.Context, *certificatev1.Certificate) error

type CredentialHandlerFunc

type CredentialHandlerFunc func(context.Context, *credentialv1.Credential) error

type Exchange

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

func NewExchange

func NewExchange(opts ...NewExchangeOption) *Exchange

func (*Exchange) AddForwarder

func (e *Exchange) AddForwarder(forwarder Forwarder)

AddForwarder adds a forwarder to this Exchange, forwarding any message on Publish()

func (*Exchange) Forward

func (e *Exchange) Forward(ctx context.Context, ev *eventv1.Envelope) error

Forward publishes the event using the publishers added to this exchange. Implements Forwarder.

func (*Exchange) On

func (e *Exchange) On(ev eventv1.Event, f HandlerFunc)

On registers a handler func for a certain event type

func (*Exchange) Once

func (e *Exchange) Once(ev eventv1.Event, f HandlerFunc)

Once attaches a handler to the specified event type. The handler func is only executed once

func (*Exchange) Publish

func (e *Exchange) Publish(ctx context.Context, ev *eventv1.Envelope) error

Publish publishes an event of a certain type

func (*Exchange) Subscribe

func (e *Exchange) Subscribe(ctx context.Context, t ...eventv1.Event) chan *eventv1.Envelope

Subscribe subscribes to events of a certain event type

func (*Exchange) Unsubscribe

func (e *Exchange) Unsubscribe(context.Context, eventv1.Event) error

Unsubscribe implements Subscriber.

type Forwarder

type Forwarder interface {
	Forward(context.Context, *eventv1.Envelope) error
}

type Handler

type Handler interface {
	Handle(context.Context, *eventsv1.Envelope) error
}

type HandlerFunc

type HandlerFunc func(context.Context, *eventsv1.Envelope) error

func Handle

func Handle(h HandlerFunc) HandlerFunc

func HandleBackends

func HandleBackends(h ...BackendHandlerFunc) HandlerFunc

func HandleCertificateAuthorities

func HandleCertificateAuthorities(h ...CertificateAuthorityHandlerFunc) HandlerFunc

func HandleCertificates

func HandleCertificates(h ...CertificateHandlerFunc) HandlerFunc

func HandleCredentials

func HandleCredentials(h ...CredentialHandlerFunc) HandlerFunc

func HandleErrors

func HandleErrors(log logger.Logger, h HandlerFunc) HandlerFunc

func HandleNew

func HandleNew[T any, PT interface {
	*T
	proto.Message
}](h func(context.Context, PT) error) HandlerFunc

func HandlePolicies

func HandlePolicies(h ...PolicyHandlerFunc) HandlerFunc

func HandleRoutes

func HandleRoutes(h ...RouteHandlerFunc) HandlerFunc

type NewExchangeOption

type NewExchangeOption func(*Exchange)

func WithExchangeLogger

func WithExchangeLogger(l logger.Logger) NewExchangeOption

type Object

type PolicyHandlerFunc

type PolicyHandlerFunc func(context.Context, *policyv1.Policy) error

type Publisher

type Publisher interface {
	Publish(context.Context, *eventv1.Envelope) error
}

type RouteHandlerFunc

type RouteHandlerFunc func(context.Context, *routev1.Route) error

type Subscriber

type Subscriber interface {
	Subscribe(context.Context, ...eventv1.Event) chan *eventv1.Envelope
	Unsubscribe(context.Context, eventv1.Event) error
}

Jump to

Keyboard shortcuts

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