All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.aws.lambda.events.gateway.APIGatewayProxyEvent Maven / Gradle / Ivy

package io.aws.lambda.events.gateway;

import io.aws.lambda.events.BodyBase64Event;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jetbrains.annotations.NotNull;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * Class that represents an APIGatewayProxyRequestEvent
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class APIGatewayProxyEvent extends BodyBase64Event implements Serializable {

    private String resource;
    private String path;
    private String httpMethod;
    private Map headers;
    private Map> multiValueHeaders;
    private Map queryStringParameters;
    private Map> multiValueQueryStringParameters;
    private Map pathParameters;
    private Map stageVariables;
    private ProxyRequestContext requestContext;

    public @NotNull Map getHeaders() {
        return headers == null ? Collections.emptyMap() : headers;
    }

    public @NotNull Map getQueryStringParameters() {
        return queryStringParameters == null ? Collections.emptyMap() : queryStringParameters;
    }

    public @NotNull Map getPathParameters() {
        return pathParameters == null ? Collections.emptyMap() : pathParameters;
    }

    public @NotNull Map getStageVariables() {
        return stageVariables == null ? Collections.emptyMap() : stageVariables;
    }

    public @NotNull Map> getMultiValueHeaders() {
        return multiValueHeaders == null ? Collections.emptyMap() : multiValueHeaders;
    }

    public @NotNull Map> getMultiValueQueryStringParameters() {
        return multiValueQueryStringParameters == null ? Collections.emptyMap() : multiValueQueryStringParameters;
    }

    /**
     * class that represents proxy request context
     */
    @Data
    @Accessors(chain = true)
    public static class ProxyRequestContext implements Serializable {

        private String accountId;
        private String stage;
        private String resourceId;
        private String requestId;
        private String operationName;
        private RequestIdentity identity;
        private String resourcePath;
        private String httpMethod;
        private String apiId;
        private String path;
        private Map authorizer;

        public @NotNull Map getAuthorizer() {
            return authorizer == null ? Collections.emptyMap() : authorizer;
        }
    }

    @Data
    @Accessors(chain = true)
    public static class RequestIdentity implements Serializable {

        private String cognitoIdentityPoolId;
        private String accountId;
        private String cognitoIdentityId;
        private String caller;
        private String apiKey;
        private String principalOrgId;
        private String sourceIp;
        private String cognitoAuthenticationType;
        private String cognitoAuthenticationProvider;
        private String userArn;
        private String userAgent;
        private String user;
        private String accessKey;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy