All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.awsjavakit.eventbridge.handlers.DestinationsEventBridgeEventHandler Maven / Gradle / Ivy

There is a newer version: 0.19.6
Show newest version
package com.github.awsjavakit.eventbridge.handlers;

import com.amazonaws.services.lambda.runtime.Context;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.awsjavakit.eventbridge.models.AwsEventBridgeDetail;
import com.github.awsjavakit.eventbridge.models.AwsEventBridgeEvent;

public abstract class DestinationsEventBridgeEventHandler
  extends EventHandler, O> {

  private final Class iclass;

  protected DestinationsEventBridgeEventHandler(Class iclass, ObjectMapper objectMapper) {
    super(AwsEventBridgeDetail.class, objectMapper);
    this.iclass = iclass;
  }

  @Override
  protected final O processInput(AwsEventBridgeDetail input,
    AwsEventBridgeEvent> event,
    Context context) {
    return processInputPayload(input.getResponsePayload(), event, context);
  }

  @SuppressWarnings("unchecked")
  @Override
  protected AwsEventBridgeEvent> parseEvent(String input) {
    return new EventParser>(input, objectMapper)
      .parse(AwsEventBridgeDetail.class, iclass);
  }

  protected abstract O processInputPayload(I input,
    AwsEventBridgeEvent> event,
    Context context);
}