events

package
v0.26.7 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventFromMessage

func NewEventFromMessage[T any](m *message.Message) (T, error)

Types

type EndpointCheckFailed

type EndpointCheckFailed struct {
	Header        Header    `json:"header"`
	MonitorID     string    `json:"monitor_id"`
	CheckResultID string    `json:"check_result_id"`
	CheckedURL    string    `json:"checked_url"`
	At            time.Time `json:"at"`
}

func (EndpointCheckFailed) EventName

func (e EndpointCheckFailed) EventName() string

type EndpointCheckSucceededEvent

type EndpointCheckSucceededEvent struct {
	Header    Header    `json:"header"`
	MonitorID string    `json:"monitor_id"`
	At        time.Time `json:"at"`
}

func (EndpointCheckSucceededEvent) EventName

func (e EndpointCheckSucceededEvent) EventName() string

type Event

type Event interface {
	EventName() string
}
type Header struct {
	Name          string `json:"name"`
	CorrelationID string `json:"correlation_id"`
}

func NewHeader

func NewHeader(ctx context.Context, name string) Header

type IncidentCreatedEvent

type IncidentCreatedEvent struct {
	Header     Header    `json:"header"`
	IncidentID string    `json:"incident_id"`
	MonitorID  string    `json:"monitor_id"`
	At         time.Time `json:"at"`
}

func (IncidentCreatedEvent) EventName

func (e IncidentCreatedEvent) EventName() string

type IncidentResolvedEvent

type IncidentResolvedEvent struct {
	Header     Header    `json:"header"`
	MonitorID  string    `json:"monitor_id"`
	IncidentID string    `json:"incident_id"`
	At         time.Time `json:"at"`
}

func (IncidentResolvedEvent) EventName

func (e IncidentResolvedEvent) EventName() string

type MonitorCreatedEvent

type MonitorCreatedEvent struct {
	Header    Header    `json:"header"`
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at"`
}

func NewMonitorCreatedEventFromMessage

func NewMonitorCreatedEventFromMessage(m *message.Message) (MonitorCreatedEvent, error)

func (MonitorCreatedEvent) EventName

func (e MonitorCreatedEvent) EventName() string

type Publisher

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

func NewPublisher

func NewPublisher(publisher message.Publisher) Publisher

func (Publisher) PublishEndpointCheckFailed

func (p Publisher) PublishEndpointCheckFailed(ctx context.Context, event command.EndpointCheckFailedEvent) error

func (Publisher) PublishEndpointCheckSucceeded

func (p Publisher) PublishEndpointCheckSucceeded(ctx context.Context, event command.EndpointCheckSucceededEvent) error

func (Publisher) PublishIncidentCreated

func (p Publisher) PublishIncidentCreated(ctx context.Context, event command.IncidentCreatedEvent) error

func (Publisher) PublishIncidentResolved

func (p Publisher) PublishIncidentResolved(ctx context.Context, event command.IncidentResolvedEvent) error

func (Publisher) PublishMonitorCreated

func (p Publisher) PublishMonitorCreated(ctx context.Context, event command.MonitorCreatedEvent) error

type PublisherMock

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

func NewPublisherMock

func NewPublisherMock() *PublisherMock

func (*PublisherMock) Events

func (p *PublisherMock) Events() []Event

func (*PublisherMock) GetEventByID

func (p *PublisherMock) GetEventByID(id string) Event

func (*PublisherMock) PublishEndpointCheckFailed

func (p *PublisherMock) PublishEndpointCheckFailed(ctx context.Context, event command.EndpointCheckFailedEvent) error

func (*PublisherMock) PublishEndpointCheckSucceeded

func (p *PublisherMock) PublishEndpointCheckSucceeded(ctx context.Context, event command.EndpointCheckSucceededEvent) error

func (*PublisherMock) PublishIncidentCreated

func (p *PublisherMock) PublishIncidentCreated(ctx context.Context, event command.IncidentCreatedEvent) error

func (*PublisherMock) PublishIncidentResolved

func (p *PublisherMock) PublishIncidentResolved(ctx context.Context, event command.IncidentResolvedEvent) error

func (*PublisherMock) PublishMonitorCreated

func (p *PublisherMock) PublishMonitorCreated(ctx context.Context, event command.MonitorCreatedEvent) error

Jump to

Keyboard shortcuts

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