@reventlessdev/rescript-pulumi-aws 3.0.0-alpha.5 → 3.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.6 (2026-08-24)
7
+
8
+ ### Features
9
+
10
+ * **pulumi-aws:** match events by pattern and rewrite what a target receives ([8f94ef3](https://github.com/ReventlessDev/reventless-core/commit/8f94ef3c4f5d24f87c1331b8a63c35bd9c4a92b2))
11
+
12
+
6
13
  # 3.0.0-alpha.5 (2026-08-23)
7
14
 
8
15
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/rescript-pulumi-aws",
3
- "version": "3.0.0-alpha.5",
3
+ "version": "3.0.0-alpha.6",
4
4
  "description": "ReScript bindings for @pulumi/aws",
5
5
  "license": "Apache-2.0",
6
6
  "jest": {
@@ -44,6 +44,10 @@ module ScheduleExpression: {
44
44
  type args = {
45
45
  description?: Pulumi.Input.t<string>,
46
46
  scheduleExpression?: ScheduleExpression.t,
47
+ /** JSON event pattern the rule matches on. A rule fires on a schedule or on a
48
+ pattern — set exactly one of the two.
49
+ see: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html */
50
+ eventPattern?: Pulumi.Input.t<string>,
47
51
  roleArn?: Pulumi.Input.t<string>,
48
52
  tags?: Pulumi.Input.t<Aws.tags>,
49
53
  }
@@ -17,10 +17,21 @@ module Rule: {
17
17
  let ofEventRule = (rule: Cloudwatch_EventRule.t) => rule.name->Pulumi.Output.asInput
18
18
  }
19
19
 
20
+ /** Rewrites a matched event before it reaches the target. `inputPaths` binds names to
21
+ JSON paths in the event; `inputTemplate` substitutes them where it writes `<name>`.
22
+ A template that is not JSON arrives as plain text — an SNS email body, say.
23
+ see: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-transform-target-input.html */
24
+ type inputTransformer = {
25
+ inputPaths?: dict<string>,
26
+ inputTemplate: Pulumi.Input.t<string>,
27
+ }
28
+
20
29
  type args = {
21
30
  rule: Rule.t,
22
31
  arn: Pulumi.Input.t<string>,
32
+ /** A fixed payload, sent verbatim. Mutually exclusive with `inputTransformer`. */
23
33
  input?: Pulumi.Input.t<string>,
34
+ inputTransformer?: Pulumi.Input.t<inputTransformer>,
24
35
  }
25
36
 
26
37
  @module("@pulumi/aws") @scope("cloudwatch") @new
@@ -0,0 +1,34 @@
1
+ // Compile-only smoke for the EventBridge bindings: a rule that matches CloudWatch
2
+ // alarm state changes by pattern, and an SNS target that rewrites the matched event
3
+ // into a plain-text body rather than forwarding the raw JSON. Not executed at deploy
4
+ // time — it keeps `eventPattern` and `inputTransformer` type-checked together.
5
+
6
+ let alarmMailTopic = SNS.Topic.make(~name="example-alarm-mail")
7
+
8
+ let alarmStateChanges = Cloudwatch.EventRule.make(
9
+ ~name="example-alarm-state-changes",
10
+ ~args={
11
+ description: "CloudWatch alarm state changes, ALARM and OK only"->Pulumi.Input.make,
12
+ eventPattern: `{"source":["aws.cloudwatch"],"detail-type":["CloudWatch Alarm State Change"],"detail":{"state":{"value":["ALARM","OK"]}}}`->Pulumi.Input.make,
13
+ },
14
+ )
15
+
16
+ // A template that is not JSON has to arrive quoted — the surrounding double quotes are
17
+ // part of the value, not ReScript syntax.
18
+ let mailBody: Cloudwatch.EventTarget.inputTransformer = {
19
+ inputPaths: Dict.fromArray([
20
+ ("name", "$.detail.alarmName"),
21
+ ("state", "$.detail.state.value"),
22
+ ("reason", "$.detail.state.reason"),
23
+ ]),
24
+ inputTemplate: `"<state>: <name> — <reason>"`->Pulumi.Input.make,
25
+ }
26
+
27
+ let _ = Cloudwatch.EventTarget.make(
28
+ ~name="example-alarm-mail-target",
29
+ ~args={
30
+ rule: Cloudwatch.EventTarget.Rule.ofEventRule(alarmStateChanges),
31
+ arn: alarmMailTopic.arn->Pulumi.Output.asInput,
32
+ inputTransformer: mailBody->Pulumi.Input.make,
33
+ },
34
+ )
@@ -0,0 +1,44 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Aws from "@pulumi/aws";
4
+ import * as Cloudwatch_EventTarget$PulumiAws from "../Cloudwatch/Cloudwatch_EventTarget.res.mjs";
5
+
6
+ let alarmMailTopic = new (Aws.sns.Topic)("example-alarm-mail");
7
+
8
+ let alarmStateChanges = new (Aws.cloudwatch.EventRule)("example-alarm-state-changes", {
9
+ description: "CloudWatch alarm state changes, ALARM and OK only",
10
+ eventPattern: `{"source":["aws.cloudwatch"],"detail-type":["CloudWatch Alarm State Change"],"detail":{"state":{"value":["ALARM","OK"]}}}`
11
+ });
12
+
13
+ let mailBody_inputPaths = Object.fromEntries([
14
+ [
15
+ "name",
16
+ "$.detail.alarmName"
17
+ ],
18
+ [
19
+ "state",
20
+ "$.detail.state.value"
21
+ ],
22
+ [
23
+ "reason",
24
+ "$.detail.state.reason"
25
+ ]
26
+ ]);
27
+
28
+ let mailBody = {
29
+ inputPaths: mailBody_inputPaths,
30
+ inputTemplate: `"<state>: <name> — <reason>"`
31
+ };
32
+
33
+ new (Aws.cloudwatch.EventTarget)("example-alarm-mail-target", {
34
+ rule: Cloudwatch_EventTarget$PulumiAws.Rule.ofEventRule(alarmStateChanges),
35
+ arn: alarmMailTopic.arn,
36
+ inputTransformer: mailBody
37
+ });
38
+
39
+ export {
40
+ alarmMailTopic,
41
+ alarmStateChanges,
42
+ mailBody,
43
+ }
44
+ /* alarmMailTopic Not a pure module */