-
Notifications
You must be signed in to change notification settings - Fork 60
feat: add tenant-id to invoke context #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ramisa2108
wants to merge
2
commits into
aws:main
Choose a base branch
from
ramisa2108:ramisa2108/support-multi-tenancy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+174
−1
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
diff --git a/include/aws/lambda-runtime/runtime.h b/include/aws/lambda-runtime/runtime.h | ||
index f7cb8ef..833b69d 100644 | ||
--- a/include/aws/lambda-runtime/runtime.h | ||
+++ b/include/aws/lambda-runtime/runtime.h | ||
@@ -56,6 +56,11 @@ struct invocation_request { | ||
*/ | ||
std::string function_arn; | ||
|
||
+ /** | ||
+ * The Tenant ID of the current invocation. | ||
+ */ | ||
+ std::string tenant_id; | ||
+ | ||
/** | ||
* Function execution deadline counted in milliseconds since the Unix epoch. | ||
*/ | ||
diff --git a/src/runtime.cpp b/src/runtime.cpp | ||
index d1e655f..bcc217d 100644 | ||
--- a/src/runtime.cpp | ||
+++ b/src/runtime.cpp | ||
@@ -40,6 +40,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, | ||
@@ -296,6 +297,11 @@ runtime::next_outcome runtime::get_next() | ||
req.function_arn = std::move(out).get_result(); | ||
} | ||
|
||
+ out = resp.get_header(TENANT_ID_HEADER); | ||
+ if (out.is_success()) { | ||
+ req.tenant_id = std::move(out).get_result(); | ||
+ } | ||
+ | ||
out = resp.get_header(DEADLINE_MS_HEADER); | ||
if (out.is_success()) { | ||
auto const& deadline_string = std::move(out).get_result(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good tests!