com.amazonaws.serverless.proxy.model.HttpApiV2ProxyRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-serverless-java-container-core Show documentation
Show all versions of aws-serverless-java-container-core Show documentation
Allows Java applications written for a servlet container to run in AWS Lambda
/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.serverless.proxy.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
public class HttpApiV2ProxyRequest {
private String version;
private String routeKey;
private String rawPath;
private String rawQueryString;
private List cookies;
private Map headers;
private Map queryStringParameters;
private String body;
private Map pathParameters;
private boolean isBase64Encoded;
private Map stageVariables;
private HttpApiV2ProxyRequestContext requestContext;
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getRouteKey() {
return routeKey;
}
public void setRouteKey(String routeKey) {
this.routeKey = routeKey;
}
public String getRawPath() {
return rawPath;
}
public void setRawPath(String rawPath) {
this.rawPath = rawPath;
}
public String getRawQueryString() {
return rawQueryString;
}
public void setRawQueryString(String rawQueryString) {
this.rawQueryString = rawQueryString;
}
public List getCookies() {
return cookies;
}
public void setCookies(List cookies) {
this.cookies = cookies;
}
public Map getHeaders() {
return headers;
}
public void setHeaders(Map headers) {
this.headers = headers;
}
public Map getQueryStringParameters() {
return queryStringParameters;
}
public void setQueryStringParameters(Map queryStringParameters) {
this.queryStringParameters = queryStringParameters;
}
public String getBody() {
return body;
}
public Map getPathParameters() {
return pathParameters;
}
public void setPathParameters(Map pathParameters) {
this.pathParameters = pathParameters;
}
public void setBody(String body) {
this.body = body;
}
@JsonProperty("isBase64Encoded")
public boolean isBase64Encoded() {
return isBase64Encoded;
}
public void setBase64Encoded(boolean base64Encoded) {
isBase64Encoded = base64Encoded;
}
public Map getStageVariables() {
return stageVariables;
}
public void setStageVariables(Map stageVariables) {
this.stageVariables = stageVariables;
}
public HttpApiV2ProxyRequestContext getRequestContext() {
return requestContext;
}
public void setRequestContext(HttpApiV2ProxyRequestContext requestContext) {
this.requestContext = requestContext;
}
@JsonIgnore
public RequestSource getRequestSource() {
return Optional.ofNullable(getRequestContext())
.map(HttpApiV2ProxyRequestContext::getElb)
.map(albContext -> RequestSource.ALB)
.orElse(RequestSource.API_GATEWAY);
}
}