events

package
v0.0.0-...-a134451 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBroadcaster

type EventBroadcaster interface {
	// StartRecordingToSink starts sending events received from the specified eventBroadcaster.
	StartRecordingToSink(stopCh <-chan struct{})

	// NewRecorder returns an EventRecorder that can be used to send events to this EventBroadcaster
	// with the event source set to the given event source.
	NewRecorder(scheme *runtime.Scheme, reportingController string) EventRecorder

	// StartEventWatcher enables you to watch for emitted events without usage
	// of StartRecordingToSink. This lets you also process events in a custom way (e.g. in tests).
	// NOTE: events received on your eventHandler should be copied before being used.
	StartEventWatcher(eventHandler func(event runtime.Object)) func()

	// StartStructuredLogging starts sending events received from this EventBroadcaster to the structured
	// logging function. The return value can be ignored or used to stop recording, if desired.
	StartStructuredLogging(verbosity string) func()

	// Shutdown shuts down the broadcaster
	Shutdown()
}

EventBroadcaster knows how to receive events and send them to any EventSink, watcher, or log.

func NewBroadcaster

func NewBroadcaster(sink EventSink) EventBroadcaster

NewBroadcaster Creates a new event broadcaster.

type EventBroadcasterAdapter

type EventBroadcasterAdapter interface {
	// StartRecordingToSink starts sending events received from the specified eventBroadcaster.
	StartRecordingToSink(stopCh <-chan struct{})

	// NewRecorder creates a new Event Recorder with specified name.
	NewRecorder(name string) EventRecorder

	// DeprecatedNewLegacyRecorder creates a legacy Event Recorder with specific name.
	DeprecatedNewLegacyRecorder(name string) record.EventRecorder

	// Shutdown shuts down the broadcaster.
	Shutdown()
}

EventBroadcasterAdapter is an auxiliary interface to simplify migration to the new events API. It is a wrapper around new and legacy broadcasters that smartly chooses which one to use.

func NewEventBroadcasterAdapter

func NewEventBroadcasterAdapter(client client.Interface) EventBroadcasterAdapter

NewEventBroadcasterAdapter creates a wrapper around new and legacy broadcasters to simplify migration of individual components to the new Event API.

type EventRecorder

type EventRecorder interface {
	// Eventf constructs an event from the given information and puts it in the queue for sending.
	// 'regarding' is the object this event is about. Event will make a reference-- or you may also
	// pass a reference to the object directly.
	// 'related' is the secondary object for more complex actions. E.g. when regarding object triggers
	// a creation or deletion of related object.
	// 'type' of this event, and can be one of Normal, Warning. New types could be added in future
	// 'reason' is the reason this event is generated. 'reason' should be short and unique; it
	// should be in UpperCamelCase format (starting with a capital letter). "reason" will be used
	// to automate handling of events, so imagine people writing switch statements to handle them.
	// You want to make that easy.
	// 'action' explains what happened with regarding/what action did the ReportingController
	// (ReportingController is a type of Controller reporting an Event,
	// take in regarding's name; it should be in UpperCamelCase format (starting with a capital letter).
	// 'note' is intended to be human-readable.
	Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, messageFmt string, args ...interface{})
}

EventRecorder knows how to record events on behalf of an EventSource.

type EventSink

type EventSink interface {
	Create(event *meta.Event) (*meta.Event, error)
	Update(event *meta.Event) (*meta.Event, error)
	Patch(oldEvent *meta.Event, data []byte) (*meta.Event, error)
}

EventSink knows how to store events (client-go implements it.) EventSink must respect the namespace that will be embedded in 'event'. It is assumed that EventSink will return the same sorts of errors as client-go's REST client.

type EventSinkImpl

type EventSinkImpl struct {
	Interface eventsv1.EventsV1Interface
}

EventSinkImpl wraps EventsV1Interface to implement EventSink.

func (*EventSinkImpl) Create

func (e *EventSinkImpl) Create(event *meta.Event) (*meta.Event, error)

Create takes the representation of an event and creates it. Returns the server's representation of the event, and an error, if there is any.

func (*EventSinkImpl) Patch

func (e *EventSinkImpl) Patch(event *meta.Event, data []byte) (*meta.Event, error)

Patch applies the patch and returns the patched event, and an error, if there is any.

func (*EventSinkImpl) Update

func (e *EventSinkImpl) Update(event *meta.Event) (*meta.Event, error)

Update takes the representation of an event and updates it. Returns the server's representation of the event, and an error, if there is any.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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