eventbridge

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package eventbridge is doze-aws's local EventBridge: event buses, rules with the full content-based pattern language (internal/eventpattern), and synchronous delivery to SQS and Lambda targets with Input / InputPath / InputTransformer shaping.

rate(...) scheduled rules are driven by a local ticker; cron(...) and destinations, partner event sources, and the schemas registry are cloud infrastructure and answer honestly.

See docs/api-support/eventbridge.md for the operation table.

Index

Constants

View Source
const DefaultBus = "default"

DefaultBus is the implicit bus every account has.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus struct {
	Name string            `json:"name"`
	Tags map[string]string `json:"tags,omitempty"`
}

Bus is a custom event bus.

type InputTransformer

type InputTransformer struct {
	PathsMap map[string]string `json:"paths_map,omitempty"`
	Template string            `json:"template"`
}

InputTransformer maps event paths into a template.

type Options

type Options struct {
	// DataDir holds the bbolt store (eventbridge.bolt). Required.
	DataDir string
	// Peers resolves SQS/Lambda targets. Nil disables delivery (logged).
	Peers peers.Directory
	// Logf receives log lines; nil discards.
	Logf func(format string, args ...any)
	// Clock overrides time.Now in tests.
	Clock func() time.Time
}

Options configures the service.

type Rule

type Rule struct {
	Bus      string            `json:"bus"`
	Name     string            `json:"name"`
	Pattern  string            `json:"pattern,omitempty"`  // event pattern JSON
	Schedule string            `json:"schedule,omitempty"` // stored; ticker in Phase 8
	State    string            `json:"state"`              // ENABLED | DISABLED
	Desc     string            `json:"desc,omitempty"`
	Targets  []Target          `json:"targets,omitempty"`
	Tags     map[string]string `json:"tags,omitempty"`
}

Rule is one rule on a bus.

func (*Rule) ARN

func (r *Rule) ARN() string

ARN returns the rule ARN.

type Server

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

Server is the EventBridge service: an http.Handler speaking AWS JSON 1.1, and an io.Closer.

func New

func New(opts Options) (*Server, error)

New opens the store under DataDir (the default bus exists implicitly).

func (*Server) Close

func (s *Server) Close() error

Close stops the scheduler and closes the bbolt DB.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Store

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

Store is the bbolt-backed EventBridge state.

func (*Store) CreateBus

func (s *Store) CreateBus(name string, tags map[string]string) error

CreateBus registers a custom bus.

func (*Store) DeleteBus

func (s *Store) DeleteBus(name string) error

DeleteBus removes a custom bus and its rules.

func (*Store) DeleteRule

func (s *Store) DeleteRule(bus, name string) error

DeleteRule removes a rule (Force semantics: targets go with it).

func (*Store) GetRule

func (s *Store) GetRule(bus, name string) (*Rule, error)

GetRule loads one rule.

func (*Store) ListBuses

func (s *Store) ListBuses() ([]Bus, error)

ListBuses returns the default bus plus custom buses, sorted.

func (*Store) PutRule

func (s *Store) PutRule(r Rule) error

PutRule creates or updates a rule.

func (*Store) Rules

func (s *Store) Rules(bus, prefix string) ([]Rule, error)

Rules lists a bus's rules, optionally by name prefix.

func (*Store) UpdateRule

func (s *Store) UpdateRule(bus, name string, fn func(*Rule) error) error

UpdateRule applies fn to a rule.

type Target

type Target struct {
	ID               string            `json:"id"`
	ARN              string            `json:"arn"`
	Input            string            `json:"input,omitempty"`      // literal input override
	InputPath        string            `json:"input_path,omitempty"` // $.path extraction
	InputTransformer *InputTransformer `json:"input_transformer,omitempty"`
}

Target is one rule target.

Jump to

Keyboard shortcuts

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