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
- type Archive
- type Bus
- type InputTransformer
- type Options
- type Replay
- type Rule
- type Server
- type Store
- func (s *Store) AppendArchiveEvent(name string, t int64, eventJSON []byte) error
- func (s *Store) CreateArchive(a Archive) error
- func (s *Store) CreateBus(name string, tags map[string]string) error
- func (s *Store) DeleteArchive(name string) error
- func (s *Store) DeleteBus(name string) error
- func (s *Store) DeleteRule(bus, name string) error
- func (s *Store) GetArchive(name string) (*Archive, error)
- func (s *Store) GetReplay(name string) (*Replay, error)
- func (s *Store) GetRule(bus, name string) (*Rule, error)
- func (s *Store) ListArchives(namePrefix, sourceArn string) ([]Archive, error)
- func (s *Store) ListBuses() ([]Bus, error)
- func (s *Store) ListReplays(namePrefix string) ([]Replay, error)
- func (s *Store) PutReplay(r Replay) error
- func (s *Store) PutRule(r Rule) error
- func (s *Store) ReplayEvents(name string, start, end int64, fn func(eventJSON []byte)) (int64, int64, error)
- func (s *Store) Rules(bus, prefix string) ([]Rule, error)
- func (s *Store) UpdateArchive(name string, fn func(*Archive) error) error
- func (s *Store) UpdateRule(bus, name string, fn func(*Rule) error) error
- type Target
Constants ¶
const DefaultBus = "default"
DefaultBus is the implicit bus every account has.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archive ¶ added in v0.2.0
type Archive struct {
Name string `json:"name"`
EventSourceArn string `json:"source_arn"` // bus ARN
Pattern string `json:"pattern,omitempty"`
RetentionDays int `json:"retention_days,omitempty"`
Desc string `json:"desc,omitempty"`
State string `json:"state"`
CreationTime int64 `json:"created"` // unix seconds
EventCount int64 `json:"event_count"`
SizeBytes int64 `json:"size_bytes"`
}
Archive is an event archive over one 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 Replay ¶ added in v0.2.0
type Replay struct {
Name string `json:"name"`
EventSourceArn string `json:"archive_arn"` // archive ARN
DestinationArn string `json:"dest_arn"` // bus ARN
FilterArns []string `json:"filter_arns,omitempty"`
EventStartTime int64 `json:"event_start"`
EventEndTime int64 `json:"event_end"`
State string `json:"state"`
StateReason string `json:"state_reason,omitempty"`
StartTime int64 `json:"start"`
EndTime int64 `json:"end"`
LastEventTime int64 `json:"last_event"`
}
Replay is a completed (local replays run synchronously) archive replay.
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"` // rate(...) driven by ticker; cron(...) stored only
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.
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.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the bbolt-backed EventBridge state.
func (*Store) AppendArchiveEvent ¶ added in v0.2.0
AppendArchiveEvent stores one event under an archive and bumps its counters.
func (*Store) CreateArchive ¶ added in v0.2.0
CreateArchive registers an archive over an existing bus.
func (*Store) DeleteArchive ¶ added in v0.2.0
DeleteArchive removes an archive and its event log.
func (*Store) DeleteRule ¶
DeleteRule removes a rule (Force semantics: targets go with it).
func (*Store) GetArchive ¶ added in v0.2.0
GetArchive loads one archive.
func (*Store) ListArchives ¶ added in v0.2.0
ListArchives returns archives filtered by name prefix and/or source ARN, sorted.
func (*Store) ListReplays ¶ added in v0.2.0
ListReplays returns replays filtered by name prefix, sorted.
func (*Store) ReplayEvents ¶ added in v0.2.0
func (s *Store) ReplayEvents(name string, start, end int64, fn func(eventJSON []byte)) (int64, int64, error)
ReplayEvents calls fn for each archived event whose ingestion time is within [start, end] (inclusive; a zero bound is open). Returns the count and the latest event time seen.
func (*Store) UpdateArchive ¶ added in v0.2.0
UpdateArchive applies fn to an archive.
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.