-
Notifications
You must be signed in to change notification settings - Fork 231
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
New ScheduledV2Event implementation #480
base: main
Are you sure you want to change the base?
Changes from 7 commits
41341c6
dbda812
1aad3e4
442ca30
a24ac32
d973523
0149926
e8852a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.amazonaws.services.lambda.runtime.events; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.joda.time.DateTime; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
/** | ||
* Represents a Scheduled V2 event sent to Lambda | ||
* <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-eventbridge-scheduler.html">Using Lambda with Amazon EventBridge Scheduler</a> | ||
*/ | ||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ScheduledV2Event implements Serializable, Cloneable { | ||
msailes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
private static final long serialVersionUID = -463442139623175611L; | ||
|
||
private String version; | ||
|
||
private String account; | ||
|
||
private String region; | ||
|
||
private String detail; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we (AWS) needs to validate that there will be no events where detail will be anything other than a String for scheduled task use cases. |
||
|
||
private String detailType; | ||
|
||
private String source; | ||
|
||
private String id; | ||
|
||
private DateTime time; | ||
|
||
private List<String> resources; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
package com.amazonaws.services.lambda.runtime.events; | ||
|
||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.Instant; | ||
import java.util.Locale; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
@@ -12,6 +14,11 @@ public class APIGatewayV2CustomAuthorizerEventTest { | |
private static final long TIME_EPOCH = 1601306426515L; | ||
private static final String TIME = "28/Sep/2020:15:14:43 +0000"; | ||
|
||
@BeforeAll | ||
static void beforeAll() { | ||
Locale.setDefault(new Locale("en", "US")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for this |
||
} | ||
|
||
@Test | ||
public void testEpochLongAsAnInstant() { | ||
APIGatewayV2CustomAuthorizerEvent customAuthorizerEvent = APIGatewayV2CustomAuthorizerEvent.builder() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "0", | ||
"id": "4e6638b7-b892-4482-9762-8c58d4e71ecc", | ||
"detail-type": "Scheduled Event", | ||
"source": "aws.scheduler", | ||
"account": "123456789012", | ||
"time": "2024-05-07T15:58:34Z", | ||
"region": "eu-central-1", | ||
"resources": [ | ||
"arn:aws:scheduler:eu-central-1:123456789012:schedule/default/demoschedule" | ||
], | ||
"detail": "{}" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update the header to