event

package
v0.0.0-...-9ba5f82 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeCompany                       Scope  = "company"
	ScopeTeam                          Scope  = "team"
	ScopeEnvironment                   Scope  = "environment"
	FilterAll                          Filter = "all"
	FilterLatest                       Filter = "latest"
	EnvironmentSpecValidationSuccess   Type   = "environment_validation_success"
	EnvironmentSpecValidationError     Type   = "environment_validation_error"
	EnvironmentSchemaValidationError   Type   = "environment_schema_validation_error"
	EnvironmentSchemaValidationSuccess Type   = "environment_schema_validation_success"
	EnvironmentReconcileSuccess        Type   = "environment_reconcile_success"
	EnvironmentReconcileError          Type   = "environment_reconcile_error"
	TeamSpecValidationSuccess          Type   = "team_validation_success"
	TeamSpecValidationError            Type   = "team_validation_error"
	TeamSchemaValidationError          Type   = "team_schema_validation_error"
	TeamSchemaValidationSuccess        Type   = "team_schema_validation_success"
	TeamReconcileSuccess               Type   = "team_reconcile_success"
	TeamReconcileError                 Type   = "team_reconcile_error"
	FamilyValidation                   Family = "validation"
	FamilyReconcile                    Family = "reconcile"
)

Variables

This section is empty.

Functions

func IsErrorEvent

func IsErrorEvent(eventType Type) bool

Types

type API

type API interface {
	Record(ctx context.Context, e *RecordPayload, log *logrus.Entry) (*Event, error)
	List(ctx context.Context, payload *ListPayload, log *logrus.Entry) (events []*Event, err error)
}

type Event

type Event struct {
	ID        string          `json:"id" db:"id"`
	Scope     Scope           `json:"scope" db:"scope"`
	Object    string          `json:"object" db:"object"`
	Meta      json.RawMessage `json:"meta" db:"meta"`
	CreatedAt time.Time       `json:"createdAt" db:"created_at"`
	EventType Type            `json:"eventType" db:"event_type"`
	Family    Family          `json:"family" db:"family"`
	Payload   json.RawMessage `json:"payload" db:"payload"`
	Debug     any             `json:"debug" db:"debug"`
}

func NewEvent

func NewEvent(scope Scope, object string, meta *Meta, payload any, eventType Type, debug any) (*Event, error)

type Family

type Family string

func GetFamilyForType

func GetFamilyForType(eventType Type) (Family, error)

type Filter

type Filter string

type ListPayload

type ListPayload struct {
	Scope       Scope  `json:"scope"`
	Filter      Filter `json:"filter"`
	Company     string `json:"company"`
	Team        string `json:"team"`
	Environment string `json:"environment"`
}

type Meta

type Meta struct {
	Company     string `json:"company"`
	Team        string `json:"team"`
	Environment string `json:"environment"`
}

type RecordPayload

type RecordPayload struct {
	Scope     Scope  `json:"scope"`
	Object    string `json:"object"`
	Meta      *Meta  `json:"meta"`
	EventType string `json:"eventType"`
	Payload   any    `json:"payload"`
	Debug     any    `json:"debug"`
}

type Scope

type Scope string

type Service

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

func NewService

func NewService(db *sqlx.DB) *Service

func (*Service) List

func (s *Service) List(ctx context.Context, p *ListPayload, log *logrus.Entry) (events []*Event, err error)

func (*Service) Record

func (s *Service) Record(ctx context.Context, p *RecordPayload, log *logrus.Entry) (*Event, error)

type Type

type Type string

Jump to

Keyboard shortcuts

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