events

package
v1.1.145 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// WatchTopicFilterTypeCreated filter type name
	WatchTopicFilterTypeCreated = "created"
	// WatchTopicFilterTypeUpdated filter type name
	WatchTopicFilterTypeUpdated = "updated"
	// WatchTopicFilterTypeDeleted filter type name
	WatchTopicFilterTypeDeleted = "deleted"
)

Variables

This section is empty.

Functions

func GetWatchTopic

func GetWatchTopic(cfg config.CentralConfig, client APIClient) (*management.WatchTopic, error)

GetWatchTopic retrieves a watch topic based on the agent config. Creates a watch topic if one does not exist.

Types

type APIClient

type APIClient interface {
	GetResource(url string) (*apiv1.ResourceInstance, error)
	CreateResourceInstance(ri apiv1.Interface) (*apiv1.ResourceInstance, error)
	DeleteResourceInstance(ri apiv1.Interface) error
	GetAPIV1ResourceInstances(map[string]string, string) ([]*apiv1.ResourceInstance, error)
}

APIClient -

type EventListener

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

EventListener holds the various caches to save events into as they get written to the source channel.

func NewEventListener

func NewEventListener(ctx context.Context, cancel context.CancelCauseFunc, source chan *proto.Event, client APIClient, sequenceManager SequenceProvider, cbs ...handler.Handler) *EventListener

NewEventListener creates a new EventListener to process events based on the provided Handlers.

func (*EventListener) HandleResource

func (em *EventListener) HandleResource(
	ctx context.Context,
	eventMetadata *proto.EventMeta,
	resource *apiv1.ResourceInstance,
)

HandleResource loops through all the handlers and passes the event to each one for processing.

func (*EventListener) Listen

func (em *EventListener) Listen()

Listen starts a loop that will process events as they are sent on the channel

func (*EventListener) Stop

func (em *EventListener) Stop()

Stop stops the listener

type Listener

type Listener interface {
	Listen()
	Stop()
}

Listener starts the EventListener

type NewListenerFunc

type NewListenerFunc func(ctx context.Context, cancel context.CancelCauseFunc, source chan *proto.Event, client APIClient, sequenceManager SequenceProvider, cbs ...handler.Handler) *EventListener

NewListenerFunc type for creating a new listener

type NewRequestQueueFunc added in v1.1.105

type NewRequestQueueFunc func(ctx context.Context, cancel context.CancelCauseFunc, requestCh chan *proto.Request) RequestQueue

NewRequestQueueFunc type for creating a new request queue

type RequestQueue added in v1.1.105

type RequestQueue interface {
	Start()
	Write(request *proto.Request) error
	Stop()
	IsActive() bool
}

func NewRequestQueue added in v1.1.105

func NewRequestQueue(ctx context.Context, cancel context.CancelCauseFunc, requestCh chan *proto.Request) RequestQueue

NewRequestQueue creates a new queue for the requests to be sent for watch subscription

type SequenceProvider

type SequenceProvider interface {
	GetSequence() int64
	SetSequence(sequenceID int64)
}

SequenceProvider - Interface to provide event sequence ID to harvester client to fetch events

func NewSequenceProvider

func NewSequenceProvider(cacheManager agentcache.Manager, watchTopicName string) SequenceProvider

NewSequenceProvider creates a new SequenceProvider

type WatchTopicValues

type WatchTopicValues struct {
	Name        string
	Title       string
	Description string
	Kinds       []kindValues
}

WatchTopicValues values to populate the watch topic template

func NewComplianceWatchTopic added in v1.1.115

func NewComplianceWatchTopic(name, scope string, agentResourceGroupKind v1.GroupKind, features watchTopicFeatures) WatchTopicValues

NewComplianceWatchTopic creates a WatchTopic template string

func NewDiscoveryWatchTopic

func NewDiscoveryWatchTopic(name, scope string, agentResourceGroupKind v1.GroupKind, features watchTopicFeatures) WatchTopicValues

NewDiscoveryWatchTopic creates a WatchTopic template string. Using a template instead of unmarshalling into a struct to avoid sending a request with empty fields

func NewTraceWatchTopic

func NewTraceWatchTopic(name, scope string, agentResourceGroupKind v1.GroupKind, features watchTopicFeatures) WatchTopicValues

NewTraceWatchTopic creates a WatchTopic template string

Jump to

Keyboard shortcuts

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