Skip to content

Commit f60de91

Browse files
bmoffattcarlzogh
authored andcommitted
Add support for APIGatwayV2 HTTP API (aws#123)
1 parent 19b6135 commit f60de91

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed

aws-lambda-java-events/pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@
6262
<version>1.18.12</version>
6363
<scope>provided</scope>
6464
</dependency>
65+
<dependency>
66+
<groupId>org.projectlombok</groupId>
67+
<artifactId>lombok</artifactId>
68+
<version>1.18.12</version>
69+
<scope>provided</scope>
70+
</dependency>
6571
</dependencies>
6672

6773
<profiles>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5+
* the License. A copy of the License is located at
6+
*
7+
* http://aws.amazon.com/apache2.0
8+
*
9+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11+
* and limitations under the License.
12+
*/
13+
14+
package com.amazonaws.services.lambda.runtime.events;
15+
16+
import lombok.AllArgsConstructor;
17+
import lombok.Builder;
18+
import lombok.Data;
19+
import lombok.NoArgsConstructor;
20+
21+
import java.util.List;
22+
import java.util.Map;
23+
24+
@AllArgsConstructor
25+
@Builder(setterPrefix = "with")
26+
@Data
27+
@NoArgsConstructor
28+
public class APIGatewayV2HTTPEvent {
29+
private String version;
30+
private String routeKey;
31+
private String rawPath;
32+
private String rawQueryString;
33+
private List<String> cookies;
34+
private Map<String, String> headers;
35+
private Map<String, String> queryStringParameters;
36+
private Map<String, String> pathParameters;
37+
private Map<String, String> stageVariables;
38+
private String Body;
39+
private boolean isBase64Encoded;
40+
private RequestContext requestContext;
41+
42+
@AllArgsConstructor
43+
@Builder(setterPrefix = "with")
44+
@Data
45+
@NoArgsConstructor
46+
public static class RequestContext {
47+
private String routeKey;
48+
private String accountId;
49+
private String stage;
50+
private String apiId;
51+
private String domainName;
52+
private String domainPrefix;
53+
private String time;
54+
private long timeEpoch;
55+
private Http http;
56+
private Authorizer authorizer;
57+
58+
@AllArgsConstructor
59+
@Builder(setterPrefix = "with")
60+
@Data
61+
@NoArgsConstructor
62+
public static class Authorizer {
63+
private JWT jwt;
64+
65+
@AllArgsConstructor
66+
@Builder(setterPrefix = "with")
67+
@Data
68+
@NoArgsConstructor
69+
public static class JWT {
70+
private Map<String, String> claims;
71+
private List<String> scopes;
72+
}
73+
}
74+
75+
@AllArgsConstructor
76+
@Builder(setterPrefix = "with")
77+
@Data
78+
@NoArgsConstructor
79+
public static class Http {
80+
private String method;
81+
private String path;
82+
private String protocol;
83+
private String sourceIp;
84+
private String userAgent;
85+
}
86+
}
87+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5+
* the License. A copy of the License is located at
6+
*
7+
* http://aws.amazon.com/apache2.0
8+
*
9+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11+
* and limitations under the License.
12+
*/
13+
14+
package com.amazonaws.services.lambda.runtime.events;
15+
16+
import lombok.AllArgsConstructor;
17+
import lombok.Builder;
18+
import lombok.Data;
19+
import lombok.NoArgsConstructor;
20+
21+
import java.util.List;
22+
import java.util.Map;
23+
24+
@AllArgsConstructor
25+
@Builder(setterPrefix = "with")
26+
@Data
27+
@NoArgsConstructor
28+
public class APIGatewayV2HTTPResponse {
29+
private int statusCode;
30+
private Map<String, String> headers;
31+
private Map<String, List<String>> multiValueHeaders;
32+
private List<String> cookies;
33+
private String body;
34+
private boolean isBase64Encoded;
35+
}

0 commit comments

Comments
 (0)