From d3dcb2debbe5ec6a1f872a9094aae44145df7dd5 Mon Sep 17 00:00:00 2001 From: Ramisa Alam Date: Thu, 17 Apr 2025 11:25:11 +0000 Subject: [PATCH] feat: add tenant id header to next invocation request --- include/aws/lambda-runtime/runtime.h | 5 +++++ src/runtime.cpp | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/include/aws/lambda-runtime/runtime.h b/include/aws/lambda-runtime/runtime.h index 46b8817..5c906b3 100644 --- a/include/aws/lambda-runtime/runtime.h +++ b/include/aws/lambda-runtime/runtime.h @@ -61,6 +61,11 @@ struct invocation_request { */ std::chrono::time_point deadline; + /** + * Tenant ID of the current invocation. + */ + std::string tenant_id; + /** * The number of milliseconds left before lambda terminates the current execution. */ diff --git a/src/runtime.cpp b/src/runtime.cpp index 2ae91e2..8cfcd75 100644 --- a/src/runtime.cpp +++ b/src/runtime.cpp @@ -41,6 +41,7 @@ static constexpr auto CLIENT_CONTEXT_HEADER = "lambda-runtime-client-context"; static constexpr auto COGNITO_IDENTITY_HEADER = "lambda-runtime-cognito-identity"; static constexpr auto DEADLINE_MS_HEADER = "lambda-runtime-deadline-ms"; static constexpr auto FUNCTION_ARN_HEADER = "lambda-runtime-invoked-function-arn"; +static constexpr auto TENANT_ID_HEADER = "lambda-runtime-aws-tenant-id"; enum Endpoints { INIT, @@ -315,6 +316,12 @@ runtime::next_outcome runtime::get_next() req.payload.c_str(), static_cast(req.get_time_remaining().count())); } + + out = resp.get_header(TENANT_ID_HEADER); + if (out.is_success()) { + req.tenant_id = std::move(out).get_result(); + } + return {req}; }