Skip to content

Commit cf20382

Browse files
authored
Merge branch 'main' into modify-appsync-lambda-authorizer-event-input
2 parents afcdc34 + 4a61b56 commit cf20382

File tree

90 files changed

+2079
-871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2079
-871
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Example request handler
2121
public class Handler implements RequestHandler<Map<String, String>, String>{
2222
@Override
2323
public String handleRequest(Map<String, String> event, Context context) {
24-
24+
2525
}
2626
}
2727
```
@@ -32,7 +32,7 @@ Example request stream handler
3232
public class HandlerStream implements RequestStreamHandler {
3333
@Override
3434
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
35-
35+
3636
}
3737
}
3838
```
@@ -41,7 +41,7 @@ public class HandlerStream implements RequestStreamHandler {
4141
<dependency>
4242
<groupId>com.amazonaws</groupId>
4343
<artifactId>aws-lambda-java-core</artifactId>
44-
<version>1.2.2</version>
44+
<version>1.2.3</version>
4545
</dependency>
4646
```
4747

@@ -71,7 +71,7 @@ public class SqsHandler implements RequestHandler<SQSEvent, String> {
7171
<dependency>
7272
<groupId>com.amazonaws</groupId>
7373
<artifactId>aws-lambda-java-events</artifactId>
74-
<version>3.11.2</version>
74+
<version>3.11.4</version>
7575
</dependency>
7676
```
7777

@@ -101,7 +101,7 @@ public void testInjectSQSEvent(SQSEvent event) {
101101
## aws-lambda-java-events-sdk-transformer
102102

103103
This package provides helper classes/methods to use alongside `aws-lambda-java-events` in order to transform
104-
Lambda input event model objects into SDK-compatible output model objects.
104+
Lambda input event model objects into SDK-compatible output model objects.
105105
See the [documentation](aws-lambda-java-events-sdk-transformer/README.md) for more information.
106106

107107
- [Release Notes](aws-lambda-java-events-sdk-transformer/RELEASE.CHANGELOG.md)
@@ -125,7 +125,7 @@ See the [README](aws-lambda-java-log4j2/README.md) or the [official documentatio
125125
<dependency>
126126
<groupId>com.amazonaws</groupId>
127127
<artifactId>aws-lambda-java-log4j2</artifactId>
128-
<version>1.5.1</version>
128+
<version>1.6.0</version>
129129
</dependency>
130130
```
131131

@@ -140,7 +140,7 @@ The purpose of this package is to allow developers to deploy their applications
140140
<dependency>
141141
<groupId>com.amazonaws</groupId>
142142
<artifactId>aws-lambda-java-runtime-interface-client</artifactId>
143-
<version>2.3.2</version>
143+
<version>2.5.0</version>
144144
</dependency>
145145
```
146146

@@ -154,12 +154,12 @@ This package defines the Lambda serialization logic using in the `aws-lambda-jav
154154
<dependency>
155155
<groupId>com.amazonaws</groupId>
156156
<artifactId>aws-lambda-java-serialization</artifactId>
157-
<version>1.0.1</version>
157+
<version>1.1.5</version>
158158
</dependency>
159159
```
160160

161161
## Disclaimer of use
162162

163163
Each of the supplied packages should be used without modification. Removing
164164
dependencies, adding conflicting dependencies, or selectively including classes
165-
from the packages can result in unexpected behavior.
165+
from the packages can result in unexpected behavior.

aws-lambda-java-core/RELEASE.CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### August 17, 2023
2+
`1.2.3`:
3+
- Extended logger interface with level-aware logging backend functions
4+
15
### November 09, 2022
26
`1.2.2`:
37
- Added new `CustomPojoSerializer` interface

aws-lambda-java-core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.amazonaws</groupId>
77
<artifactId>aws-lambda-java-core</artifactId>
8-
<version>1.2.2</version>
8+
<version>1.2.3</version>
99
<packaging>jar</packaging>
1010

1111
<name>AWS Lambda Java Core Library</name>

aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/LambdaLogger.java

+26-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
package com.amazonaws.services.lambda.runtime;
44

5+
import com.amazonaws.services.lambda.runtime.logging.LogLevel;
6+
57
/**
68
* A low level Lambda runtime logger
79
*
@@ -10,7 +12,7 @@ public interface LambdaLogger {
1012

1113
/**
1214
* Logs a string to AWS CloudWatch Logs
13-
*
15+
*
1416
* <p>
1517
* Logging will not be done:
1618
* <ul>
@@ -22,7 +24,7 @@ public interface LambdaLogger {
2224
* </li>
2325
* </ul>
2426
* </p>
25-
*
27+
*
2628
* @param message A string containing the event to log.
2729
*/
2830
void log(String message);
@@ -32,5 +34,27 @@ public interface LambdaLogger {
3234
* @param message byte array containing logs
3335
*/
3436
void log(byte[] message);
37+
38+
/**
39+
* LogLevel aware logging backend function.
40+
*
41+
* @param message in String format
42+
* @param logLevel
43+
*/
44+
default void log(String message, LogLevel logLevel) {
45+
log(message);
46+
}
47+
48+
/**
49+
* LogLevel aware logging backend function.
50+
*
51+
* @param message in byte[] format
52+
* @param logLevel
53+
*/
54+
default void log(byte[] message, LogLevel logLevel) {
55+
log(message);
56+
}
57+
58+
3559
}
3660

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2+
3+
package com.amazonaws.services.lambda.runtime.logging;
4+
5+
6+
public enum LogFormat {
7+
JSON,
8+
TEXT;
9+
10+
public static LogFormat fromString(String logFormat) {
11+
try {
12+
return LogFormat.valueOf(logFormat.toUpperCase());
13+
} catch (Exception e) {
14+
throw new IllegalArgumentException("Invalid log format: '" + logFormat + "' expected one of [JSON, TEXT]");
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2+
3+
package com.amazonaws.services.lambda.runtime.logging;
4+
5+
6+
public enum LogLevel {
7+
// UNDEFINED log level is used when the legacy LambdaLogger::log(String) function is called
8+
// where the loglevel is not defined. In this case we're not filtering the message in the runtime
9+
UNDEFINED,
10+
TRACE,
11+
DEBUG,
12+
INFO,
13+
WARN,
14+
ERROR,
15+
FATAL;
16+
17+
public static LogLevel fromString(String logLevel) {
18+
try {
19+
return LogLevel.valueOf(logLevel.toUpperCase());
20+
} catch (Exception e) {
21+
throw new IllegalArgumentException(
22+
"Invalid log level: '" + logLevel + "' expected one of [TRACE, DEBUG, INFO, WARN, ERROR, FATAL]");
23+
}
24+
}
25+
}

aws-lambda-java-events/README.md

+3-26
Original file line numberDiff line numberDiff line change
@@ -56,44 +56,21 @@
5656
* `SQSEvent`
5757

5858

59-
### Getting Started
60-
61-
[Maven](https://maven.apache.org)
59+
### Usage
6260

6361
```xml
6462
<dependencies>
6563
...
6664
<dependency>
6765
<groupId>com.amazonaws</groupId>
6866
<artifactId>aws-lambda-java-core</artifactId>
69-
<version>1.2.2</version>
67+
<version>1.2.3</version>
7068
</dependency>
7169
<dependency>
7270
<groupId>com.amazonaws</groupId>
7371
<artifactId>aws-lambda-java-events</artifactId>
74-
<version>3.11.2</version>
72+
<version>3.11.4</version>
7573
</dependency>
7674
...
7775
</dependencies>
7876
```
79-
80-
[Gradle](https://gradle.org)
81-
82-
```groovy
83-
'com.amazonaws:aws-lambda-java-core:1.2.1'
84-
'com.amazonaws:aws-lambda-java-events:3.11.0'
85-
```
86-
87-
[Leiningen](http://leiningen.org) and [Boot](http://boot-clj.com)
88-
89-
```clojure
90-
[com.amazonaws/aws-lambda-java-core "1.2.1"]
91-
[com.amazonaws/aws-lambda-java-events "3.11.0"]
92-
```
93-
94-
[sbt](http://www.scala-sbt.org)
95-
96-
```scala
97-
"com.amazonaws" % "aws-lambda-java-core" % "1.2.1"
98-
"com.amazonaws" % "aws-lambda-java-events" % "3.11.0"
99-
```

aws-lambda-java-events/RELEASE.CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
### December 1, 2023
2+
`3.11.4`:
3+
- Improve `toString` in Cognito events by calling `super`
4+
- Added missing `version` field to ScheduledEvent from CloudWatch
5+
6+
### September 1, 2023
7+
`3.11.3`:
8+
- Update challengeAnswer field format in CognitoUserPoolEvent
9+
110
### May 18, 2023
211
`3.11.2`:
312
- Add missing fields to API Gateway request context

aws-lambda-java-events/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.amazonaws</groupId>
77
<artifactId>aws-lambda-java-events</artifactId>
8-
<version>3.11.2</version>
8+
<version>3.11.4</version>
99
<packaging>jar</packaging>
1010

1111
<name>AWS Lambda Java Events Library</name>

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolCreateAuthChallengeEvent.java

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
@Data
2727
@EqualsAndHashCode(callSuper = true)
2828
@NoArgsConstructor
29+
@ToString(callSuper = true)
2930
public class CognitoUserPoolCreateAuthChallengeEvent extends CognitoUserPoolEvent {
3031

3132
/**
@@ -56,6 +57,7 @@ public CognitoUserPoolCreateAuthChallengeEvent(
5657
@Data
5758
@EqualsAndHashCode(callSuper = true)
5859
@NoArgsConstructor
60+
@ToString(callSuper = true)
5961
public static class Request extends CognitoUserPoolEvent.Request {
6062
/**
6163
* One or more key-value pairs that you can provide as custom input to the Lambda function that you specify for the create auth challenge trigger.

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolCustomMessageEvent.java

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
@Data
2727
@EqualsAndHashCode(callSuper = true)
2828
@NoArgsConstructor
29+
@ToString(callSuper = true)
2930
public class CognitoUserPoolCustomMessageEvent extends CognitoUserPoolEvent {
3031
/**
3132
* The request from the Amazon Cognito service.
@@ -55,6 +56,7 @@ public CognitoUserPoolCustomMessageEvent(
5556
@Data
5657
@EqualsAndHashCode(callSuper = true)
5758
@NoArgsConstructor
59+
@ToString(callSuper = true)
5860
public static class Request extends CognitoUserPoolEvent.Request {
5961
/**
6062
* One or more key-value pairs that you can provide as custom input to the Lambda function that you specify for the custom message trigger.

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolDefineAuthChallengeEvent.java

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
@Data
2727
@EqualsAndHashCode(callSuper = true)
2828
@NoArgsConstructor
29+
@ToString(callSuper = true)
2930
public class CognitoUserPoolDefineAuthChallengeEvent extends CognitoUserPoolEvent {
3031

3132
/**
@@ -56,6 +57,7 @@ public CognitoUserPoolDefineAuthChallengeEvent(
5657
@Data
5758
@EqualsAndHashCode(callSuper = true)
5859
@NoArgsConstructor
60+
@ToString(callSuper = true)
5961
public static class Request extends CognitoUserPoolEvent.Request {
6062
/**
6163
* One or more key-value pairs that you can provide as custom input to the Lambda function that you specify for the define auth challenge trigger.

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolMigrateUserEvent.java

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
@Data
2727
@EqualsAndHashCode(callSuper = true)
2828
@NoArgsConstructor
29+
@ToString(callSuper = true)
2930
public class CognitoUserPoolMigrateUserEvent extends CognitoUserPoolEvent {
3031
/**
3132
* The request from the Amazon Cognito service.
@@ -55,6 +56,7 @@ public CognitoUserPoolMigrateUserEvent(
5556
@Data
5657
@EqualsAndHashCode(callSuper = true)
5758
@NoArgsConstructor
59+
@ToString(callSuper = true)
5860
public static class Request extends CognitoUserPoolEvent.Request {
5961
/**
6062
* The username entered by the user.

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPostAuthenticationEvent.java

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import lombok.Data;
1717
import lombok.EqualsAndHashCode;
1818
import lombok.NoArgsConstructor;
19+
import lombok.ToString;
1920

2021
import java.util.Map;
2122

@@ -29,6 +30,7 @@
2930
@Data
3031
@EqualsAndHashCode(callSuper = true)
3132
@NoArgsConstructor
33+
@ToString(callSuper = true)
3234
public class CognitoUserPoolPostAuthenticationEvent extends CognitoUserPoolEvent {
3335

3436
/**
@@ -52,6 +54,7 @@ public CognitoUserPoolPostAuthenticationEvent(
5254
@Data
5355
@EqualsAndHashCode(callSuper = true)
5456
@NoArgsConstructor
57+
@ToString(callSuper = true)
5558
public static class Request extends CognitoUserPoolEvent.Request {
5659
/**
5760
* One or more key-value pairs that you can provide as custom input to the Lambda function that you specify for the post authentication trigger.

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPostConfirmationEvent.java

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import lombok.Data;
1717
import lombok.EqualsAndHashCode;
1818
import lombok.NoArgsConstructor;
19+
import lombok.ToString;
1920

2021
import java.util.Map;
2122

@@ -29,6 +30,7 @@
2930
@EqualsAndHashCode(callSuper = true)
3031
@Data
3132
@NoArgsConstructor
33+
@ToString(callSuper = true)
3234
public class CognitoUserPoolPostConfirmationEvent extends CognitoUserPoolEvent {
3335

3436
/**
@@ -52,6 +54,7 @@ public CognitoUserPoolPostConfirmationEvent(
5254
@Data
5355
@EqualsAndHashCode(callSuper = true)
5456
@NoArgsConstructor
57+
@ToString(callSuper = true)
5558
public static class Request extends CognitoUserPoolEvent.Request {
5659
/**
5760
* One or more key-value pairs that you can provide as custom input to the Lambda function that you specify for the post confirmation trigger.

0 commit comments

Comments
 (0)