Skip to content

initial class to represent the EventBridge message format. #160

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

Closed
wants to merge 1 commit into from
Closed

initial class to represent the EventBridge message format. #160

wants to merge 1 commit into from

Conversation

msailes
Copy link
Collaborator

@msailes msailes commented Sep 14, 2020

Issue #, if available:

#109

Description of changes:

Adding support for EventBridge / CloudWatch Events

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.


private String version;
private String id;
private String detailType;
Copy link

@aashutoshbane aashutoshbane Sep 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this will get serialized as the field which comes in event looks like detail-type.
Untill and unless jackson understands the hypen to get converted into camelCase.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely correct. I'm working with the Lambda team to sort this out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private String time;
private String region;
private List<String> resources;
private Object detail;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this an object here while it is a map in https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ScheduledEvent.java.
Actually, I agree with the object more than the map... maybe I miss something.

@Builder(setterPrefix = "with")
@NoArgsConstructor
@AllArgsConstructor
public class EventBridgeEvent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the EventBridge "Download code bindings" feature actually provides an AWSEvent (below). Is it useful to have it in the lib, and if so, why not simply use the generic one below?

public class AWSEvent<T> {

  @JsonProperty("detail")
  private T detail = null;

  @JsonProperty("detail-type")
  private String detailType = null;

  @JsonProperty("resources")
  private List resources = null;

  @JsonProperty("id")
  private String id = null;

  @JsonProperty("source")
  private String source = null;

  @JsonProperty("time")
  private Date time = null;

  @JsonProperty("region")
  private String region = null;

  @JsonProperty("version")
  private String version = null;

  @JsonProperty("account")
  private String account = null;

// ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the Lambda service would be able to handle the typing.

@carlzogh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not at this point, the Java runtime needs to handle @JsonProperty annotations internally

@msailes
Copy link
Collaborator Author

msailes commented Sep 30, 2020

Closing.

EventBridge is a new service based on CloudWatch Events. The CloudWatch scheduled event object should meet the same requirements.

https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ScheduledEvent.java

@msailes msailes closed this Sep 30, 2020
@aashutoshbane
Copy link

aashutoshbane commented Oct 1, 2020

Closing.

EventBridge is a new service based on CloudWatch Events. The CloudWatch scheduled event object should meet the same requirements.

https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ScheduledEvent.java

Yeah looks the same but need a workaround for detail-type field :) cause lamdba is not mapping it, I also tried using @JsonProperty("detail-type") but got no luck

@msailes msailes deleted the eventbridge-event branch October 12, 2020 08:00
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.

4 participants