controlplane

package
v0.0.0-...-53646af Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEventHandleFatal = errors.New("fatal event handling error")
View Source
var ErrEventHandleIgnore = errors.New("event handling error")
View Source
var EventSenderKey = EventSenderKeyType{}

Functions

func WithFetchInterval

func WithFetchInterval(interval time.Duration) func(s *UniformSubscriptionSource)

WithFetchInterval specifies the interval the subscription source should use when polling for new subscriptions

Types

type ControlPlane

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

ControlPlane can be used to connect to the Keptn Control Plane

func New

func New(subscriptionSource SubscriptionSource, eventSource EventSource) *ControlPlane

New creates a new ControlPlane It is using a SubscriptionSource source to get information about current uniform subscriptions as well as an EventSource to actually receive events from Keptn

func (*ControlPlane) Register

func (cp *ControlPlane) Register(ctx context.Context, integration Integration) error

Register is initially used to register the Keptn integration to the Control Plane

type EventMatcher

type EventMatcher struct {
	Project string
	Stage   string
	Service string
}

EventMatcher is used to check whether an event contains is containing information about a specif event, stage or service

func NewEventMatcherFromSubscription

func NewEventMatcherFromSubscription(subscription models.EventSubscription) *EventMatcher

NewEventMatcherFromSubscription creates a new EventMatcher that is configured with informtaion about project, stage and service filter contained in an event subscription

func (EventMatcher) Matches

Matches checks whether a Keptn event matches the information of the currently configured EventMatcher

type EventSender

type EventSender func(ce models.KeptnContextExtendedCE) error

type EventSenderKeyType

type EventSenderKeyType struct{}

type EventSource

type EventSource interface {
	// Start triggers the execution of the EventSource
	Start(context.Context, RegistrationData, chan EventUpdate) error
	// OnSubscriptionUpdate can be called to tell the EventSource that
	// the current subscriptions have been changed
	OnSubscriptionUpdate([]string)
	// Sender returns a component that gives the possiblity to send events back
	// to the Keptn Control plane
	Sender() EventSender
	//Stop is stopping the EventSource
	Stop() error
}

EventSource is anything that can be used to get events from the Keptn Control Plane

type EventUpdate

type EventUpdate struct {
	KeptnEvent models.KeptnContextExtendedCE
	MetaData   EventUpdateMetaData
}

EventUpdate wraps a new Keptn event received from the Event source

type EventUpdateMetaData

type EventUpdateMetaData struct {
	Subject string
}

EventUpdateMetaData is additional metadata for bound to the event received from the event source

type Integration

type Integration interface {
	// OnEvent is called when a new event was received
	OnEvent(context.Context, models.KeptnContextExtendedCE) error

	// RegistrationData is called to get the initial registration data
	RegistrationData() RegistrationData
}

Integration represents a Keptn Service that wants to receive events from the Keptn Control plane

type NATSEventSource

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

NATSEventSource is an implementation of EventSource that is using the NATS event broker internally

func NewNATSEventSource

func NewNATSEventSource(natsConnector natseventsource.NATS) *NATSEventSource

NewNATSEventSource creates a new NATSEventSource

func (*NATSEventSource) OnSubscriptionUpdate

func (n *NATSEventSource) OnSubscriptionUpdate(subjects []string)

func (*NATSEventSource) Sender

func (n *NATSEventSource) Sender() EventSender

func (*NATSEventSource) Start

func (n *NATSEventSource) Start(ctx context.Context, registrationData RegistrationData, eventChannel chan EventUpdate) error

func (*NATSEventSource) Stop

func (n *NATSEventSource) Stop() error

type RegistrationData

type RegistrationData models.Integration

type SubscriptionSource

type SubscriptionSource interface {
	Start(context.Context, RegistrationData, chan []models.EventSubscription) error
}

type UniformSubscriptionSource

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

UniformSubscriptionSource represents a source for uniform subscriptions

func NewUniformSubscriptionSource

func NewUniformSubscriptionSource(uniformAPI api.UniformV1Interface, options ...func(source *UniformSubscriptionSource)) *UniformSubscriptionSource

NewUniformSubscriptionSource creates a new UniformSubscriptionSource

func (*UniformSubscriptionSource) Start

func (s *UniformSubscriptionSource) Start(ctx context.Context, registrationData RegistrationData, subscriptionChannel chan []models.EventSubscription) error

Start triggers the execution of the UniformSubscriptionSource

Jump to

Keyboard shortcuts

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