Skip to content

Commit 33cbc3d

Browse files
committed
Add support for APIGatwayV2 HTTP API
1 parent c0a42f6 commit 33cbc3d

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed

aws-lambda-java-events/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@
6767
<version>1.11.163</version>
6868
<scope>provided</scope>
6969
</dependency>
70+
<dependency>
71+
<groupId>org.projectlombok</groupId>
72+
<artifactId>lombok</artifactId>
73+
<version>1.18.12</version>
74+
<scope>provided</scope>
75+
</dependency>
7076
</dependencies>
7177

7278
<profiles>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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.EqualsAndHashCode;
17+
import lombok.Getter;
18+
import lombok.NoArgsConstructor;
19+
import lombok.Setter;
20+
21+
import java.util.List;
22+
import java.util.Map;
23+
24+
import org.joda.time.DateTime;
25+
26+
@EqualsAndHashCode
27+
@Getter
28+
@NoArgsConstructor
29+
@Setter
30+
public class APIGatewayV2HttpApiRequest {
31+
private String version;
32+
private String routeKey;
33+
private String rawPath;
34+
private String rawQueryString;
35+
private List<String> cookies;
36+
private Map<String, String> headers;
37+
private Map<String, String> queryStringParameters;
38+
private Map<String, String> pathParameters;
39+
private Map<String, String> stageVariables;
40+
private String Body;
41+
private boolean isBase64Encoded;
42+
private RequestContext requestContext;
43+
44+
@EqualsAndHashCode
45+
@Getter
46+
@NoArgsConstructor
47+
@Setter
48+
public static class RequestContext {
49+
private String routeKey;
50+
private String accountId;
51+
private String stage;
52+
private String apiId;
53+
private String domainName;
54+
private String domainPrefix;
55+
private String time;
56+
private long timeEpoch;
57+
private Http http;
58+
private Authorizer authorizer;
59+
60+
@EqualsAndHashCode
61+
@Getter
62+
@NoArgsConstructor
63+
@Setter
64+
public static class Authorizer {
65+
private JWT jwt;
66+
67+
@EqualsAndHashCode
68+
@Getter
69+
@NoArgsConstructor
70+
@Setter
71+
public static class JWT {
72+
private Map<String, String> claims;
73+
private List<String> scopes;
74+
}
75+
}
76+
77+
@Getter
78+
@NoArgsConstructor
79+
@Setter
80+
public static class Http {
81+
private String method;
82+
private String path;
83+
private String protocol;
84+
private String sourceIp;
85+
private String userAgent;
86+
}
87+
}
88+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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.EqualsAndHashCode;
19+
import lombok.Getter;
20+
import lombok.NoArgsConstructor;
21+
import lombok.Setter;
22+
23+
import java.util.List;
24+
import java.util.Map;
25+
26+
@AllArgsConstructor
27+
@Builder(setterPrefix = "with")
28+
@EqualsAndHashCode
29+
@Getter
30+
@NoArgsConstructor
31+
@Setter
32+
public class APIGatewayV2HttpApiResponse {
33+
private int statusCode;
34+
private Map<String, String> headers;
35+
private Map<String, List<String>> multiValueHeaders;
36+
private List<String> cookies;
37+
private String body;
38+
private boolean isBase64Encoded;
39+
}

0 commit comments

Comments
 (0)