@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 48 lines 1.59 KB
Raw
1 import * as eventbridge from "@distilled.cloud/aws/eventbridge";
2 import * as Binding from "alchemy/Binding";
3 import * as Effect from "effect/Effect";
4
5 export interface TestEventPatternRequest extends eventbridge.TestEventPatternRequest {}
6
7 /**
8 * Tests whether an event matches an event pattern
9 * (`events:TestEventPattern`).
10 *
11 * An account-level operation — bind it with no resource argument. Useful for
12 * validating patterns before creating a `Rule`. Provide the
13 * `TestEventPatternHttp` layer on the Function to satisfy the binding.
14 * ### Testing Patterns
15 * **Example:** Test an Event Against a Pattern
16 * ```typescript
17 * // init — no resource argument (provide AWS.EventBridge.TestEventPatternHttp on the Function)
18 * const testEventPattern = yield* AWS.EventBridge.TestEventPattern();
19 *
20 * // runtime — check whether the event would match
21 * const { Result } = yield* testEventPattern({
22 * EventPattern: JSON.stringify({ source: ["my.app"] }),
23 * Event: JSON.stringify({
24 * id: "1",
25 * source: "my.app",
26 * "detail-type": "OrderCreated",
27 * account: "123456789012",
28 * region: "us-east-1",
29 * time: new Date().toISOString(),
30 * detail: {},
31 * }),
32 * });
33 * ```
34 *
35 * @binding
36 */
37 export interface TestEventPattern extends Binding.Service<
38 TestEventPattern,
39 "AWS.EventBridge.TestEventPattern",
40 () => Effect.Effect<
41 (
42 request: TestEventPatternRequest,
43 ) => Effect.Effect<eventbridge.TestEventPatternResponse, eventbridge.TestEventPatternError>
44 >
45 > {}
46 export const TestEventPattern = Binding.Service<TestEventPattern>(
47 "AWS.EventBridge.TestEventPattern",
48 );