events

package
v0.16.13-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: Apache-2.0 Imports: 20 Imported by: 152

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.
	// TODO: figure out if this can be removed.
	StartEventWatcher(eventHandler func(event runtime.Object)) func()
}

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 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.
	// 'note' is intended to be human readable.
	Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{})
}

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

type EventSink

type EventSink interface {
	Create(event *v1beta1.Event) (*v1beta1.Event, error)
	Update(event *v1beta1.Event) (*v1beta1.Event, error)
	Patch(oldEvent *v1beta1.Event, data []byte) (*v1beta1.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 typedv1beta1.EventInterface
}

EventSinkImpl wraps EventInterface to implement EventSink. TODO: this makes it easier for testing purpose and masks the logic of performing API calls. Note that rollbacking to raw clientset should also be transparent.

func (*EventSinkImpl) Create

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

Create is the same as CreateWithEventNamespace of the EventExpansion

func (*EventSinkImpl) Patch

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

Patch is the same as PatchWithEventNamespace of the EventExpansion

func (*EventSinkImpl) Update

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

Update is the same as UpdateithEventNamespace of the EventExpansion

type FakeRecorder added in v0.16.4

type FakeRecorder struct {
	Events chan string
}

FakeRecorder is used as a fake during tests. It is thread safe. It is usable when created manually and not by NewFakeRecorder, however all events may be thrown away in this case.

func NewFakeRecorder added in v0.16.4

func NewFakeRecorder(bufferSize int) *FakeRecorder

NewFakeRecorder creates new fake event recorder with event channel with buffer of given size.

func (*FakeRecorder) Eventf added in v0.16.4

func (f *FakeRecorder) Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{})

Eventf emits an event

Jump to

Keyboard shortcuts

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