events

package
v1.1.72 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 16 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
	GetAPIV1ResourceInstancesWithPageSize(map[string]string, string, int) ([]*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(
	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() chan error

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() chan error
	Stop()
}

Listener starts the EventListener

type NewListenerFunc

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

NewListenerFunc type for creating a new listener

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 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 NewGovernanceAgentWatchTopic

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

NewGovernanceAgentWatchTopic creates a WatchTopic template string

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