Skip to content

EventType enum should include a larger set of common AWS events #38

@sergioflores-j

Description

@sergioflores-j

Problem being solved

In the BaseNodeJsFunction construct the field eventType is limited to this enum:

export enum EventType {
  Cloudwatch = 'cloudwatch',
  Http = 'http',
  CustomResource = 'custom-resource',
}

That does not cover all "common" AWS events (e.g. SQS, StepFunctions, EventBridge, etc) and it makes consuming the construct slightly confusing for those scenarios.

And as a consumer of the construct it seems you have to reccur to using a custom resource:

new BaseNodeJsFunction(
      this,
      'my-function-name',
      {
        eventType: EventType.CustomResource,
        baseCodePath: 'src/handlers',

Proposal

  1. Improve the enum list to include more event types.
  2. Allow sending any string value if the consumer wishes to standardize his project in his own setup without having to always use entry

Examples of the proposal:

new BaseNodeJsFunction(
      this,
      'my-function-name',
      {
        eventType: EventType.Sqs,
        baseCodePath: 'src/handlers',

new BaseNodeJsFunction(
      this,
      'my-function-name',
      {
        eventType: EventType.StepFunction,
        baseCodePath: 'src/handlers',

new BaseNodeJsFunction(
      this,
      'my-function-name',
      {
        eventType: 'my-custom-event-type',
        baseCodePath: 'src/handlers',

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions