-
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
Common response class for ApiGateway and ALB #427
Changes from 4 commits
f2e0e5d
31bd4d4
d94b6f7
0bfbb35
b01e9c2
be46557
1f3f1bd
5a5f419
f51cb35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. Is there an existing class which already covers this response? 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. No. This response class is similar to the one we currently have on aws-serverless-java-container. Having it here allows us to maintain a single response class on the serverless java container, which will remove a lot of duplicated code. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.amazonaws.services.lambda.runtime.events; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
Common response class for APIGateway and ALB | ||
*/ | ||
@NoArgsConstructor | ||
@Data | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class AwsProxyResponseEvent { | ||
private static final long serialVersionUID = 2263167344670024138L; | ||
|
||
private Integer statusCode; | ||
|
||
private String statusDescription; | ||
|
||
private List<String> cookies; | ||
|
||
private Map<String, String> headers; | ||
|
||
private Map<String, List<String>> multiValueHeaders; | ||
|
||
private String body; | ||
|
||
private Boolean isBase64Encoded; | ||
} |
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'm not sure which package this should be in, but it doesn't feel like it should be in helper. 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. Right. Moving it to the events folder. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.amazonaws.services.lambda.runtime.events.helper; | ||
|
||
/** | ||
* Interface to abstract APIGWY and ALB request classes, reduce complexity and increase efficiency. | ||
*/ | ||
public interface AwsLambdaRequestEvent { | ||
RequestSource getRequestSource(); | ||
} |
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.
I don't think we need an extra response object. I think we need to pick one, and if they're all the same, remove the others.
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.
I think customers should still be able to use the current response classes.
AwsProxyResponseEvent
is just meant simplify things; It would be very helpful for the Serverless-java-container use-case, but I'm not sure everybody would want that. That's why I kept the current classes.