From dbacb6dbe7c65f5fa66b3fcd686fafc95844f51d Mon Sep 17 00:00:00 2001 From: "data-plane-api(CircleCI)" Date: Sat, 4 Apr 2020 20:12:12 +0000 Subject: [PATCH] filter: aws lambda - add async invocation mode (#10617) Signed-off-by: Marco Magdy Mirrored from https://github.com/envoyproxy/envoy @ 51c63a5352bb7749d226a52ab38dd2d27535f8a4 --- .../http/aws_lambda/v2alpha/aws_lambda.proto | 14 ++++++++++++++ .../filters/http/aws_lambda/v3/aws_lambda.proto | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/envoy/config/filter/http/aws_lambda/v2alpha/aws_lambda.proto b/envoy/config/filter/http/aws_lambda/v2alpha/aws_lambda.proto index 3c408914..5d7bdd3a 100644 --- a/envoy/config/filter/http/aws_lambda/v2alpha/aws_lambda.proto +++ b/envoy/config/filter/http/aws_lambda/v2alpha/aws_lambda.proto @@ -20,6 +20,17 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE; // AWS Lambda filter config message Config { + enum InvocationMode { + // This is the more common mode of invocation, in which Lambda responds after it has completed the function. In + // this mode the output of the Lambda function becomes the response of the HTTP request. + SYNCHRONOUS = 0; + + // In this mode Lambda responds immediately but continues to process the function asynchronously. This mode can be + // used to signal events for example. In this mode, Lambda responds with an acknowledgment that it received the + // call which is translated to an HTTP 200 OK by the filter. + ASYNCHRONOUS = 1; + } + // The ARN of the AWS Lambda to invoke when the filter is engaged // Must be in the following format: // arn::lambda:::function: @@ -27,6 +38,9 @@ message Config { // Whether to transform the request (headers and body) to a JSON payload or pass it as is. bool payload_passthrough = 2; + + // Determines the way to invoke the Lambda function. + InvocationMode invocation_mode = 3 [(validate.rules).enum = {defined_only: true}]; } // Per-route configuration for AWS Lambda. This can be useful when invoking a different Lambda function or a different diff --git a/envoy/extensions/filters/http/aws_lambda/v3/aws_lambda.proto b/envoy/extensions/filters/http/aws_lambda/v3/aws_lambda.proto index 90d39302..ed837554 100644 --- a/envoy/extensions/filters/http/aws_lambda/v3/aws_lambda.proto +++ b/envoy/extensions/filters/http/aws_lambda/v3/aws_lambda.proto @@ -20,6 +20,17 @@ message Config { option (udpa.annotations.versioning).previous_message_type = "envoy.config.filter.http.aws_lambda.v2alpha.Config"; + enum InvocationMode { + // This is the more common mode of invocation, in which Lambda responds after it has completed the function. In + // this mode the output of the Lambda function becomes the response of the HTTP request. + SYNCHRONOUS = 0; + + // In this mode Lambda responds immediately but continues to process the function asynchronously. This mode can be + // used to signal events for example. In this mode, Lambda responds with an acknowledgment that it received the + // call which is translated to an HTTP 200 OK by the filter. + ASYNCHRONOUS = 1; + } + // The ARN of the AWS Lambda to invoke when the filter is engaged // Must be in the following format: // arn::lambda:::function: @@ -27,6 +38,9 @@ message Config { // Whether to transform the request (headers and body) to a JSON payload or pass it as is. bool payload_passthrough = 2; + + // Determines the way to invoke the Lambda function. + InvocationMode invocation_mode = 3 [(validate.rules).enum = {defined_only: true}]; } // Per-route configuration for AWS Lambda. This can be useful when invoking a different Lambda function or a different