Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sqs-lambda] Remove legacy defaults and make construct more generale purpose #3

Merged
merged 4 commits into from
Dec 3, 2024

Conversation

brandomeniconi
Copy link
Member

@brandomeniconi brandomeniconi commented Dec 2, 2024

BRAKING CHANGE! this will be version 1.0.0

The initial release (v0.0.1) is compatible with current implementations. This new one drops some ad-hoc configurations to be more general-purpose but is incompatible with the previous version. The props have been simplified and made more flexible.

Feats:

  • resource naming was fixed and improved, no more repeated names. Outside-the-box default management.
  • rules are always passed as an array, this simplifies typings. It only adds a few braces in single-rule implementation ;)
  • adds some global default management for projects where there is a need for shared properties (es lambda config).

Example:

  // this sets the defaults for all implementations
  EventBridgeSqsLambda.setDefaults({
    lambda: {
      architecture: Architecture.ARM_64,
      runtime: Runtime.NODEJS_20_X,
    },
    namesPrefix: "test", // your env prefix
  });

  new EventBridgeSqsLambda(testStack, "TestConstruct", {
    rules: [
      {
        ruleName: "TestRule",
        eventBus: EventBus.fromEventBusName(testStack, "EventBus", `mybus`),
        eventPattern: {
          detailType: ["MyEvent"],
        },
      },
    ],
    lambda: {
      entry: path.join(__dirname, "./lambda.js"),
    },
  });

  new EventBridgeSqsLambda(testStack, "TestConstruct2", {
    rules: [
      {
        ruleName: "TestRule2",
        eventBus: EventBus.fromEventBusName(testStack, "EventBus", `mybus`),
        eventPattern: {
          detailType: ["MyEvent2"],
        },
      },
    ],
    lambda: {
      entry: path.join(__dirname, "./lambda2.js"),
    },
  });

they will both run in nodejs 20 (ARM) and have all resource names prefixed with test-.

@brandomeniconi brandomeniconi marked this pull request as ready for review December 2, 2024 16:29
@brandomeniconi brandomeniconi merged commit 96b2b53 into main Dec 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants