messages

package
v0.0.83 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package messages contains messages structs and builders for events handled by reconcilers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepoReconcilerMessage

func NewRepoReconcilerMessage(providerID uuid.UUID, entityID uuid.UUID, projectID uuid.UUID) (*message.Message, error)

NewRepoReconcilerMessage creates a new repos init event

Types

type CoreContext

type CoreContext struct {
	ProviderID uuid.UUID
	ProjectID  uuid.UUID
	Type       string
	Payload    []byte
}

CoreContext contains information necessary to further process events inside Minder Core.

type MinderEvent

type MinderEvent struct {
	ProviderID uuid.UUID       `json:"provider_id" validate:"required"`
	ProjectID  uuid.UUID       `json:"project_id" validate:"required"`
	EntityType minderv1.Entity `json:"entity_type" validate:"required"`
	EntityID   uuid.UUID       `json:"entity_id"`
	Properties map[string]any  `json:"entity" validate:"required"`
}

MinderEvent encapsulate necessary information about creation or deletion of entities so that they can be further processed by Minder core.

This struct is meant to be used with providers that can push events to Minder, or with providers that Minder can poll.

func NewMinderEvent

func NewMinderEvent() *MinderEvent

NewMinderEvent creates a new entity added event.

func (*MinderEvent) ToMessage

func (e *MinderEvent) ToMessage(msg *message.Message) error

ToMessage implements an interface that is currently used on the webhook handler. Such interface works by modifiying an existing message by means of side effect, which is unnecessary for this struct, thus its simplicity.

func (*MinderEvent) WithEntityID

func (e *MinderEvent) WithEntityID(entityID uuid.UUID) *MinderEvent

WithEntityID sets the id of the entity.

func (*MinderEvent) WithEntityType

func (e *MinderEvent) WithEntityType(entityType minderv1.Entity) *MinderEvent

WithEntityType sets the type of the entity. Type of the entity must be meaningful to the Provider.

func (*MinderEvent) WithProjectID

func (e *MinderEvent) WithProjectID(projectID uuid.UUID) *MinderEvent

WithProjectID adds project id to MinderEvent.

func (*MinderEvent) WithProperties

func (e *MinderEvent) WithProperties(props *properties.Properties) *MinderEvent

WithProperties adds properties to MinderEvent.

func (*MinderEvent) WithProviderID

func (e *MinderEvent) WithProviderID(providerID uuid.UUID) *MinderEvent

WithProviderID adds provider id to MinderEvent.

type RepoReconcilerEvent

type RepoReconcilerEvent struct {
	// Project is the project that the event is relevant to
	Project uuid.UUID `json:"project"`
	// Provider is the provider that the event is relevant to
	Provider uuid.UUID `json:"provider"`
	// EntityID is the entity id of the repository to be reconciled
	EntityID uuid.UUID `json:"entity_id"`
}

RepoReconcilerEvent is an event that is sent to the reconciler topic

Jump to

Keyboard shortcuts

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