handler

package
v1.1.152 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetActionFromContext

func GetActionFromContext(ctx context.Context) proto.Event_Type

GetActionFromContext retrieve event type from the context

func NewEventContext

func NewEventContext(action proto.Event_Type, eventMetadata *proto.EventMeta, kind, name string) context.Context

NewEventContext - create a context for the new event

func NewEventFromResource added in v1.1.152

func NewEventFromResource(action proto.Event_Type, eventMetadata *proto.EventMeta, resource *v1.ResourceInstance) *proto.Event

NewEventFromResource builds a synthetic *proto.Event from an already-fetched resource, for callers (e.g. StreamWatchProxyHandler, discoveryCache) that only have a *v1.ResourceInstance and need to invoke Handler.ShouldHandle before Handle.

func RefreshTeamCache added in v1.1.121

func RefreshTeamCache(apicClient apicClient, cache agentCache)

func WithAccessRequestRetryCount added in v1.1.132

func WithAccessRequestRetryCount(rc int) func(c *accessRequestHandler)

func WithCredentialRetryCount added in v1.1.132

func WithCredentialRetryCount(rc int) func(c *credentials)

func WithManagedAppIDPRegistry added in v1.1.147

func WithManagedAppIDPRegistry(registry oauth.IdPRegistry) func(c *managedApplication)

func WithManagedAppRetryCount added in v1.1.132

func WithManagedAppRetryCount(rc int) func(c *managedApplication)

func WithWatchTopicFeatures added in v1.1.115

func WithWatchTopicFeatures(feature watchTopicFeatures) watchTopicOptions

func WithWatchTopicGroupKind added in v1.1.115

func WithWatchTopicGroupKind(groupKinds []v1.GroupKind) watchTopicOptions

Types

type AgentResourceUpdateHandler added in v1.1.115

type AgentResourceUpdateHandler interface {
	AgentResourceUpdate(ctx context.Context, resource *v1.ResourceInstance)
}

Register an AgentResourceUpdateHandler in an agent to trigger events when changes to the resource is made

type CacheHandler added in v1.1.152

type CacheHandler interface {
	HandleCache(resource *v1.ResourceInstance) error
}

CacheHandler is implemented by Handlers that participate in discoveryCache's bulk rebuild path - there's no proto.Event/EventMeta to build during a rebuild, and the resource is always freshly fetched (never a delete or subresource update), so it's a separate method rather than reusing ShouldHandle/Handle. Handlers that don't implement it are simply skipped during a rebuild.

type ComplianceAgentHandler added in v1.1.115

type ComplianceAgentHandler interface {
	TriggerProcessing()
}

type Handler

type Handler interface {
	// Handle receives the type of the event context, event metadata and the API Server resource, if it exists.
	Handle(ctx context.Context, eventMetadata *proto.EventMeta, resource *v1.ResourceInstance) error
	ShouldHandle(context.Context, *proto.Event) bool
}

Handler interface used by the EventListener to process events.

func NewAPDHandler added in v1.1.109

func NewAPDHandler(agentCacheManager agentcache.Manager) Handler

NewAPDHandler creates a Handler for Application Profile Definitions

func NewAPISvcHandler

func NewAPISvcHandler(agentCacheManager agentcache.Manager, envName string) Handler

NewAPISvcHandler creates a Handler for API Services.

func NewARDHandler

func NewARDHandler(agentCacheManager agentcache.Manager) Handler

NewARDHandler creates a Handler for Access Requests

func NewAccessRequestCacheHandler added in v1.1.152

func NewAccessRequestCacheHandler(agentKind config.AgentType, cache agentcache.Manager, client client) Handler

NewAccessRequestCacheHandler creates a Handler for AccessRequests for discovery/trace agent cache building. client is only required when agentKind is config.TraceabilityAgent.

func NewAccessRequestHandler

func NewAccessRequestHandler(prov prov.AccessProvisioner, cache agentcache.Manager, client client, customUnitHandler customUnitHandler, opts ...func(c *accessRequestHandler)) Handler

NewAccessRequestHandler creates a Handler for Access Requests

func NewAgentResourceHandler

func NewAgentResourceHandler(agentResourceManager resource.Manager, sampler sampling, cache agentCache, apiClient apicClient) Handler

NewAgentResourceHandler - creates a Handler for Agent resources

func NewCRDHandler

func NewCRDHandler(agentCacheManager agentcache.Manager) Handler

NewCRDHandler creates a Handler for Credential Request Definitions

func NewCRRHandler added in v1.1.118

func NewCRRHandler(agentCacheManager agentcache.Manager) Handler

NewCRRHandler creates a Handler for Compliance Runtime Results

func NewCredentialHandler

func NewCredentialHandler(prov credProv, client client, providerRegistry oauth.IdPRegistry, opts ...func(*credentials)) Handler

NewCredentialHandler creates a Handler for Credentials

func NewEnvironmentHandler added in v1.1.52

func NewEnvironmentHandler(agentCacheManager agentcache.Manager, credentialConfig config.CredentialConfig, envName string) Handler

NewEnvironmentHandler creates a Handler for Environments.

func NewIDPHandler added in v1.1.142

func NewIDPHandler(agentCacheManager agentcache.Manager, credentialConfig config.CredentialConfig) Handler

NewIDPHandler creates a Handler for Identity Providers.

func NewInstanceHandler

func NewInstanceHandler(agentCacheManager agentcache.Manager, envName string) Handler

NewInstanceHandler creates a Handler for API Service Instances.

func NewManagedApplicationCacheHandler added in v1.1.152

func NewManagedApplicationCacheHandler(cache agentcache.Manager) Handler

NewManagedApplicationCacheHandler creates a Handler that keeps the ManagedApplication cache up to date from watch events. It is used by both the discovery agent and the traceability agent, which only need to keep their local ManagedApplication cache current rather than provision anything.

func NewManagedApplicationHandler

func NewManagedApplicationHandler(prov prov.ApplicationProvisioner, cache agentcache.Manager, client client, opts ...func(c *managedApplication)) Handler

func NewManagedApplicationProfileHandler added in v1.1.109

func NewManagedApplicationProfileHandler(prov prov.ApplicationProfileProvisioner, cache managedApplicationProfileCache, client client) Handler

NewManagedApplicationProfileHandler creates a Handler for Credentials

func NewWatchResourceHandler

func NewWatchResourceHandler(agentCacheManager agentcache.Manager, opts ...watchTopicOptions) Handler

NewWatchResourceHandler creates a Handler for custom watch resources to store resource in agent cache

type ProxyHandler

type ProxyHandler interface {
	// RegisterTargetHandler adds the target handler
	RegisterTargetHandler(name string, resourceHandler Handler)
	// UnregisterTargetHandler removes the specified handler
	UnregisterTargetHandler(name string)
}

ProxyHandler interface to represent the proxy resource handler.

type RequiredFieldsHandler added in v1.1.152

type RequiredFieldsHandler interface {
	GetAPIServerFields(ctx context.Context, event *proto.Event) []string
}

RequiredFieldsHandler is implemented by Handlers that only need specific fields of the API Server resource fetched for a given event, instead of the full resource. The required fields can vary by event - e.g. a subresource update only needs that subresource fetched.

type StreamWatchProxyHandler

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

StreamWatchProxyHandler - proxy handler for stream watch

func NewStreamWatchProxyHandler

func NewStreamWatchProxyHandler() *StreamWatchProxyHandler

NewStreamWatchProxyHandler - creates a Handler to proxy target resource handler

func (*StreamWatchProxyHandler) GetAPIServerFields added in v1.1.152

func (h *StreamWatchProxyHandler) GetAPIServerFields(ctx context.Context, event *proto.Event) []string

GetAPIServerFields delegates to the target handler registered for the event's kind, if it implements RequiredFieldsHandler. Returns nil (no restriction) otherwise.

func (*StreamWatchProxyHandler) GetHandlers added in v1.1.152

func (h *StreamWatchProxyHandler) GetHandlers() map[string]Handler

func (*StreamWatchProxyHandler) Handle

func (h *StreamWatchProxyHandler) Handle(ctx context.Context, eventMetadata *proto.EventMeta, resource *v1.ResourceInstance) error

Handle receives the type of the event (add, update, delete), event metadata and updated API Server resource

func (*StreamWatchProxyHandler) RegisterTargetHandler

func (h *StreamWatchProxyHandler) RegisterTargetHandler(name string, resourceHandler Handler)

RegisterTargetHandler adds the target handler

func (*StreamWatchProxyHandler) ShouldHandle added in v1.1.152

func (h *StreamWatchProxyHandler) ShouldHandle(ctx context.Context, event *proto.Event) bool

func (*StreamWatchProxyHandler) UnregisterTargetHandler

func (h *StreamWatchProxyHandler) UnregisterTargetHandler(name string)

UnregisterTargetHandler removes the specified handler

type TraceabilityTriggerHandler added in v1.1.113

type TraceabilityTriggerHandler interface {
	TriggerTraceability()
}

Jump to

Keyboard shortcuts

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