Commit Graph
12 Commits
Author SHA1 Message Date
Vũ Thế Huy 108f2b54bf feat(eventbridge): add ApiDestination target support (#4702) (#5009)
* feat(eventbridge): add ApiDestination target support (#4702)

- Add ApiDestination, ApiDestinationState, and HttpParameters models

- Implement CRUD operations for API destinations in EventBridgeService

- Add CreateApiDestination, DescribeApiDestination, UpdateApiDestination, DeleteApiDestination, ListApiDestinations actions in EventBridgeHandler

- Support HttpParameters on targets in PutTargets and ListTargetsByRule

- Implement HTTP delivery to API destinations in EventBridgeInvoker with connection auth and SSRF protection

- Add CloudFormation provisioning for AWS::Events::ApiDestination in EventsCfnProvisioner

- Update docs and tests

* fix(eventbridge): harden ApiDestination delivery and CloudFormation lifecycle

- Throw on delivery failure so TargetDispatcher retries 429/5xx and connection
  errors and dead-letters permanent failures
- Enforce InvocationRateLimitPerSecond per destination
- Run the OAuth client-credentials exchange for OAUTH_CLIENT_CREDENTIALS connections
- Reject non-http(s) endpoints and wildcard hosts, encode path parameter values,
  keep the query before any fragment, and stop logging URLs that may carry secrets
- Resolve destination and connection ARNs only when they match the stored ARN
- Validate every UpdateApiDestination field before applying any of them
- Paginate ListApiDestinations with Limit and NextToken
- Keep HttpParameters on AWS::Events::Rule targets and roll back
  AWS::Events::ApiDestination updates from a snapshot

* fix(eventbridge): keep connection credentials authoritative and require a valid endpoint host

- Apply target headers and query parameters before the connection's so a target
  cannot override its credentials, and replace header names that differ only by case
- Reject endpoints without a parsed host (for example https://:8080/path)
- Sweep stale rate-limit windows once the map grows

* fix(eventbridge): make the ApiDestination rate limit check atomic

Count permits inside ConcurrentHashMap.compute on an immutable window so the
stale-window sweep can no longer remove a window another delivery is using,
which let concurrent deliveries exceed InvocationRateLimitPerSecond.

* refactor(eventbridge): drop the in-service InMemoryStorage constructor and tidy tests

- Remove the compatibility constructor that instantiated InMemoryStorage inside
  EventBridgeService; tests pass the ApiDestination store explicitly
- Import classes instead of qualifying them inline in the ApiDestination integration test
- Surface worker failures in the concurrent rate limit test by checking each Future

* docs: correct the EventBridge and IAM operation counts in the service matrix
2026-10-04 18:03:31 -04:00
vamsiakandVamsi Akavarapu a18aa246d3 fix(eventbridge): preserve target role ARN configuration (#4946)
* fix(eventbridge): preserve target role ARN configuration

* fix(eventbridge): handle stored targets without an ARN

---------

Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-10-03 09:42:03 -04:00
Mario Toffia 0a54d0708e feat(eventbridge): execute target retry and dead-letter policies (#4736)
* feat(eventbridge): execute target retry and dead-letter policies

PutTargets now validates, stores and returns a target's RetryPolicy and
DeadLetterConfig. Failed deliveries from PutEvents and scheduled rules are
retried with backoff within the configured attempts and event age, and
exhausted or non-retryable events are sent to the standard SQS dead-letter
queue with the AWS failure attributes.

* fix(eventbridge): order target retries by due time and honour a lowered retry limit

Pending retries are kept in a queue ordered by their next attempt, so each wake-up
takes only what is due instead of scanning every pending retry. The clock is read
again for each retry, so a slow target cannot let a later retry run past its event
age, and a reset mid-tick stops the remaining retries. A retry now checks the
target's current MaximumRetryAttempts before invoking it, as it already did for
MaximumEventAgeInSeconds.

* fix(eventbridge): drop a target retry that outlives a reset

An attempt still running when the emulator resets can fail afterwards. Its retry
or dead-letter delivery is now dropped, so a rule and target recreated under the
same names after the reset do not receive a pre-reset event. A scheduled retry
wake-up keeps only its due time, not the event.

* fix(eventbridge): wake a target retry at its due time after a slow attempt

The retry delay was measured from when the failed attempt started but counted from
when it failed, so every retry after a slow attempt woke late by the attempt's
duration, and an expired event reached its dead-letter queue late.

* fix(eventbridge): drop a removed target's retries and drive retries from one tick

RemoveTargets now drops the removed targets' pending retries, so a target re-added
under the same Id does not receive an event from before its removal. Pending retries
are taken by one periodic tick, as in the scheduler's dispatcher, instead of a timer
per retry, so a reset leaves no timers behind.

* fix(eventbridge): warn about a blank dead-letter queue ARN

PutTargets accepts a whitespace-only DeadLetterConfig Arn, since AWS constrains only
its length. Delivery skipped it without a word; it now gets the same WARN as any other
dead-letter queue that is not a standard SQS queue in the rule's region.
2026-10-01 07:59:18 -04:00
vamsiakandVamsi Akavarapu 957542d172 feat(eventbridge): start Step Functions targets (#4006)
Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-09-20 11:36:26 -04:00
Feyikemi Ogunsanya 36a55f5060 feat(eventbridge): add Connection API actions (#1897)
* feat(eventbridge): add Connection model and state enum

* feat(eventbridge): wire connection storage through EventBridgeService

* feat(eventbridge): implement CreateConnection

* feat(eventbridge): implement DescribeConnection and ListConnections

* feat(eventbridge): implement UpdateConnection and DeleteConnection

* feat(eventbridge): build connection responses with credential sanitization

* feat(eventbridge): dispatch Connection actions in EventBridgeHandler

* test(eventbridge): add Connection lifecycle integration test

* test(eventbridge): cover connection secret stripping and validation errors

* docs(eventbridge): document Connection actions

* fix(eventbridge): register ConnectionState for reflection and validate auth type changes

* chore: remove stray PR body helper file

* fix(eventbridge): default IsValueSecret to true when omitted on connection parameters

IsValueSecret is optional on Connection header/query/body parameters, and
AWS treats an omitted flag as secret. Reading it with asBoolean(false)
inverted that default, so a parameter that simply didn't set the flag
came back in cleartext from DescribeConnection instead of masked.

Reported by @abanna on PR #1897.

* test(eventbridge): cover DescribeConnection masking when IsValueSecret is omitted

Reproduces the leak abanna reported on PR #1897: a header parameter that
doesn't set IsValueSecret must still come back masked, not in cleartext.
Fails against the pre-fix asBoolean(false) default.
2026-08-18 09:30:25 -04:00
Tim Gibson 50fe67dde6 feat(eventbridge): deliver events to event-bus targets (#1814)
* feat(eventbridge): deliver events to event-bus targets

* fix(eventbridge): skip null resources when republishing to event-bus targets

* fix(eventbridge): validate Detail and resolve account for bus targets

readTree accepts any well-formed JSON value, so an input override producing
"hello" or [1,2] passed the guard and reached the target bus as a scalar
detail, with putEvents reporting success — a silent malformation rather than
the intended warn-and-drop. The pass-through arm had the same hole. Both arms
now share one isObject() check.

Bus targets also went through the two-arg putEvents overload, which passes a
null accountId, so a cross-account bus ARN resolved in the caller's account and
surfaced only as a warning. Thread the ARN's account through, as SQS targets
already do via the queue URL. Same-account and account-less ARNs still forward
null: only that path carries the legacy-key fallback in
AccountAwareStorageBackend.get().

* docs(eventbridge): document event-bus target behavior and limits

* fix(eventbridge): cap bus-to-bus forwarding at one hop, matching AWS
2026-08-10 17:46:13 -04:00
TiM 7d70f64162 feat(docs): generate Supported Actions tables from handler source (#1641)
* feat(docs): generate Supported Actions tables from handler source

The "Supported Actions" tables in docs/services/*.md were hand-maintained and
drifted from the handlers. For example secrets-manager.md omitted RestoreSecret,
which SecretsManagerJsonHandler dispatches, and acm.md listed RenewCertificate,
which is not implemented anywhere in src/.

Derive the action list from handler source so it cannot drift, while keeping the
hand-written Description column:

- tools/docs/regen_action_docs.py extracts actions from `case "X" ->` switch arms
  (including multi-label arms) and JAX-RS REST controllers, and rewrites only the
  rows between the <!-- floci:actions --> markers. Descriptions are preserved by
  action name; new actions get a "-" placeholder. PascalCase-only matching avoids
  picking up SCREAMING_CASE labels from non-action switches.
- tools/docs/services.yaml registers 18 single-table switch services and lists the
  remaining switch handlers under deferred_handlers, so the new-service sentinel
  fires only on a genuinely unregistered handler.
- make docs-sync / docs-check / docs-test, plus a Python-only CI workflow that
  gates on handler, doc, and tooling changes.
- Migrate 18 service docs into marker blocks, reconciling real drift (adds
  RestoreSecret, ImportCertificate, and others; drops the unimplemented
  RenewCertificate).

Revives the parser and CI gate from #738 by @ericbsantana and completes the
description-preservation its spec described. REST-mode, mixed-mode, multi-table,
non-tabular, S3, and ecr docs are deferred and tracked in deferred_handlers.

* docs: drop standalone design spec from action-docs tooling

Remove ideas/auto-generated-action-tables.spec.md and the four references
to it (CONTRIBUTING.md, Makefile, regen_action_docs.py docstring,
services.yaml). It was a planning artifact; the operational docs live in
CONTRIBUTING.md and the tooling is self-documenting. The #738 / @ericbsantana
credit is preserved in the PR description.

* chore: address review on action-docs tooling

- pin actions/checkout to v7.0.0 in docs-actions workflow to match the
  repo-wide bump (#1690), so dependabot does not immediately flag the new file
- document in the generator docstring that a switch case label counts as
  supported purely by existing, so a per-action UnsupportedOperation stub
  would be a false positive (handlers here reject from the default arm)

* docs: regenerate action tables against current handler source

Resync the generated Supported Actions tables to handler source after
rebasing onto the latest main:

- cloudformation: add DescribeStackInstance and DescribeStackSetOperation
  now emitted by the handler, and keep the implemented StackSet descriptions
- cloudtrail: add LookupEvents
- firehose: add UpdateDestination
- step-functions: add PublishStateMachineVersion, ListStateMachineVersions,
  DeleteStateMachineVersion
- register the cloudcontrol handler in deferred_handlers so the strict
  unregistered-handler gate passes (no standalone action table yet)

* fix(docs): prevent action-table generator from silently dropping actions

Address the latest review pass on the action-docs tooling:

- switch extraction now captures case arms whose labels wrap across lines
  (valid Java 14+ syntax). The capture group excludes only `{ } ;` boundaries,
  so it spans newlines between labels but stops at the arm's `->`. A wrapped
  arm was previously missed, and docs-check would stay green because the doc
  and the generated output agreed on the omission, defeating the whole
  drift-prevention guarantee.
- REST extraction skips Javadoc / inline comments between a verb annotation
  and the method signature; such a line otherwise reset the lookahead and
  dropped the action.
- parse_marker_block raises a descriptive error when a marker is not on its
  own line, instead of a bare "substring not found".
- doc, source, and registry reads/writes are pinned to UTF-8 so generation is
  locale-independent (the docs contain non-ASCII text).
- the docs-actions push trigger watches Makefile and the workflow file,
  matching its pull_request trigger.

Adds regression tests for the multi-line arm and comment-skip paths (20 total).
2026-07-06 21:02:04 -05:00
Marvelous Ikponmwosa b25fcc28a2 feat(eventbridge): add UpdateEventBus action (#834)
* feat(eventbridge): add UpdateEventBus action

* address Copilot review feedback on UpdateEventBus
2026-05-14 20:31:35 -05:00
Marvelous Ikponmwosa e89777b8a2 feat(eventbridge): add TestEventPattern action (#824)
* feat(eventbridge): add TestEventPattern action

Exposes the existing rule pattern matcher as a public API so callers can
test whether a sample event would match an event pattern without firing
any targets. Adapts the AWS event envelope (lowercase source / detail-type
/ detail / resources) to the internal entry shape and delegates to the
same matchesPattern() helper that powers PutEvents rule dispatch.

Returns {"Result": <bool>} on success, InvalidEventPatternException (400)
on malformed pattern or missing event.

* fix(eventbridge): reject empty EventPattern in TestEventPattern

AWS marks EventPattern as a required field for TestEventPattern. The
previous implementation accepted null/empty values and silently delegated
to matchesPattern(), which returns true for blank patterns — turning the
API into an unintended match-all. matchesPattern()'s blank-is-match-all
behavior is intentional for rule dispatch (rules with no EventPattern are
scheduled rules that fire on every match attempt), but exposing it here
violates the spec.

Now throws InvalidEventPatternException (400) when EventPattern is null
or blank. Verified end-to-end via boto3: the typed exception is raised
client-side. The integration test that asserted the wrong behavior is
flipped, and a new test covers the missing-field case.

* fix(eventbridge): honor account/region from event and reject non-object Events
2026-05-12 20:15:56 -05:00
Hector Ventura 9e35046647 Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml
* docs: sync with main and new features
* docs: reverting docker-compose.yml
2026-05-10 11:53:31 -05:00
TiM a32b7f1f3b docs: comprehensive audit sweep + CHANGELOG backfill (1.1.0-1.5.2) (#326)
CHANGELOG.md was empty for the 1.1.0-1.5.2 release cycle and service docs
had drifted from code behaviour. This sweep reconciles docs against the
current codebase on upstream/main.

- Backfill CHANGELOG.md for 1.1.0 through 1.5.2 from git history
- Correct exact operation counts in docs/services/index.md: S3 (~30 -> 58),
  Lambda (~25 -> 30), API Gateway v1 (~24 -> 62). Counts now come from the
  actual dispatch handlers rather than @Path annotation counts.
- Rewrite README "Supported Services" table to drop per-service op counts
  (they drift too fast); point readers at docs/services/index.md
- Update 24 service docs for accuracy, add "Not Implemented" sections
  where relevant (s3.md, lambda.md, api-gateway.md)
- Refresh configuration and getting-started docs
- Add EventBridge Scheduler and AppConfig to mkdocs nav
- Add AppConfig / AppConfigData rows to README and services index
  following the 1.5.2 upstream release
2026-04-10 10:52:34 -05:00
Hector Ventura 61433f59ab firt commit 2026-03-15 17:43:56 -05:00