GH-743 Remove setting of HTTP 'export' properties for AWS Custom Runtime

Resolves #743
This commit is contained in:
Oleg Zhurakousky
2021-09-16 11:27:17 +02:00
parent 37fb710c75
commit 3896d26866
2 changed files with 10 additions and 21 deletions

View File

@@ -29,10 +29,6 @@ import java.util.concurrent.atomic.AtomicReference;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
import com.amazonaws.services.lambda.runtime.events.KinesisEvent;
import com.amazonaws.services.lambda.runtime.events.S3Event;
import com.amazonaws.services.lambda.runtime.events.SNSEvent;
import com.amazonaws.services.lambda.runtime.events.SQSEvent;
import com.amazonaws.services.lambda.runtime.serialization.PojoSerializer;
import com.amazonaws.services.lambda.runtime.serialization.events.LambdaEventSerializers;
import com.fasterxml.jackson.core.JsonParser;
@@ -73,12 +69,13 @@ final class AWSLambdaUtils {
}
private static boolean isSupportedAWSType(Type inputType) {
return "com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent".equals(FunctionTypeUtils.getRawType(inputType).getName())
|| S3Event.class.isAssignableFrom(FunctionTypeUtils.getRawType(inputType))
|| APIGatewayProxyRequestEvent.class.isAssignableFrom(FunctionTypeUtils.getRawType(inputType))
|| SNSEvent.class.isAssignableFrom(FunctionTypeUtils.getRawType(inputType))
|| SQSEvent.class.isAssignableFrom(FunctionTypeUtils.getRawType(inputType))
|| KinesisEvent.class.isAssignableFrom(FunctionTypeUtils.getRawType(inputType));
String typeName = inputType.getTypeName();
return typeName.equals("com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent")
|| typeName.equals("com.amazonaws.services.lambda.runtime.events.S3Event")
|| typeName.equals("com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent")
|| typeName.equals("com.amazonaws.services.lambda.runtime.events.SNSEvent")
|| typeName.equals("com.amazonaws.services.lambda.runtime.events.SQSEvent")
|| typeName.equals("com.amazonaws.services.lambda.runtime.events.KinesisEvent");
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -174,10 +171,7 @@ final class AWSLambdaUtils {
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static byte[] generateOutput(Message requestMessage, Message<byte[]> responseMessage,
ObjectMapper objectMapper) {
public static byte[] generateOutput(Message requestMessage, Message<byte[]> responseMessage, ObjectMapper objectMapper) {
if (!objectMapper.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)) {
configureObjectMapper(objectMapper);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 the original author or authors.
* Copyright 2019-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import org.springframework.core.env.MapPropertySource;
* Adds default properties to the environment for running a custom runtime in AWS.
*
* @author Dave Syer
* @author Oleg Zhurakousky
*/
public class CustomRuntimeEnvironmentPostProcessor implements EnvironmentPostProcessor {
@@ -38,12 +39,6 @@ public class CustomRuntimeEnvironmentPostProcessor implements EnvironmentPostPro
SpringApplication application) {
if (!environment.containsProperty(CUSTOM_RUNTIME)) {
Map<String, Object> defaults = getDefaultProperties(environment);
defaults.putIfAbsent("spring.cloud.function.web.export.source.url",
"http://${AWS_LAMBDA_RUNTIME_API:localhost}/2018-06-01/runtime/invocation/next");
defaults.putIfAbsent("spring.cloud.function.web.export.sink.url",
"http://${AWS_LAMBDA_RUNTIME_API:localhost}/2018-06-01/runtime/invocation/{{destination}}/response");
defaults.put("spring.cloud.function.web.export.sink.name",
"origin|${_HANDLER:}");
defaults.put(CUSTOM_RUNTIME, true);
}
}