Skip to content
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

Added resolve_customer lambda handler #3

Merged
merged 2 commits into from
Jan 16, 2025
Merged

Conversation

schaefi
Copy link
Collaborator

@schaefi schaefi commented Jan 15, 2025

The resolve_customer handler expects an event providing the x-amzn-marketplace-token. It will then resolve customer information from the metering marketplace as well as the entitlements for this customer's ID and product code. The return type API is documented in the header of the lambda_handler entrypoint

@schaefi schaefi self-assigned this Jan 15, 2025
@schaefi
Copy link
Collaborator Author

schaefi commented Jan 15, 2025

ok problem with this code is that I implemented it according to the AWS documentation. I was not able to test this code for real because that requires me to have a proper x-amzn-marketplace-token which I don't have and which is the result of a click on the subscription vendor button.

@schaefi schaefi force-pushed the resolve_customer_service branch 2 times, most recently from 5f87a55 to b5b0258 Compare January 15, 2025 14:50
@schaefi
Copy link
Collaborator Author

schaefi commented Jan 15, 2025

It's expected that the resolve_customer lambda is triggered by an AWS API Gateway. This information should be added to the code and the code also needs to change because the event structure is not correctly read by the PR for this trigger mechanics. Here is an example event source

[INFO]	2025-01-15T16:44:01.777Z	1c84a83d-f813-4e1a-bacc-c42ab75ebf7d	EVENT: {'version': '2.0', 'routeKey': 'ANY /ms-lambda-from-container', 'rawPath': '/default/ms-lambda-from-container', 'rawQueryString': '', 'headers': {'accept': '*/*', 'content-length': '31', 'content-type': 'application/x-www-form-urlencoded', 'host': 'jfh2r389u9.execute-api.eu-central-1.amazonaws.com', 'user-agent': 'curl/8.0.1', 'x-amzn-trace-id': 'Root=1-6787e5d1-5850b9f64c02c6df0926b405', 'x-forwarded-for': '79.201.150.192', 'x-forwarded-port': '443', 'x-forwarded-proto': 'https'}, 'requestContext': {'accountId': '810320120389', 'apiId': 'jfh2r389u9', 'domainName': 'jfh2r389u9.execute-api.eu-central-1.amazonaws.com', 'domainPrefix': 'jfh2r389u9', 'http': {'method': 'POST', 'path': '/default/ms-lambda-from-container', 'protocol': 'HTTP/1.1', 'sourceIp': '79.201.150.192', 'userAgent': 'curl/8.0.1'}, 'requestId': 'EcDY1h1zFiAEPLQ=', 'routeKey': 'ANY /ms-lambda-from-container', 'stage': 'default', 'time': '15/Jan/2025:16:44:01 +0000', 'timeEpoch': 1736959441730}, 'body': 'eyJuYW1lIjogIk1hcmN1cyIsICJhZ2UiOiAiNTIifQ==', 'isBase64Encoded': True}

@schaefi schaefi force-pushed the resolve_customer_service branch from 919243f to c0cafa1 Compare January 16, 2025 09:25
@SUSE-Enceladus SUSE-Enceladus deleted a comment from smarlowucf Jan 16, 2025
@schaefi schaefi force-pushed the resolve_customer_service branch 2 times, most recently from 885ef74 to 65b623a Compare January 16, 2025 10:42
The resolve_customer handler expects an event providing
the x-amzn-marketplace-token. It will then resolve customer
information from the metering marketplace as well as the
entitlements for this customer's ID and product code.
The input and return API is documented in the header of the
lambda_handler entrypoint and follows the AWS API Gateway
specifications.
@schaefi schaefi force-pushed the resolve_customer_service branch from 933764c to 785fb8e Compare January 16, 2025 14:34
Add resolve_customer.py as callable entry point for the lambda
Also fix spec file errors for requirements and a mistake on the
%description field
@schaefi schaefi force-pushed the resolve_customer_service branch from 803a3fa to c72f04a Compare January 16, 2025 14:41
@schaefi schaefi merged commit 9cea4cc into main Jan 16, 2025
2 checks passed
@schaefi schaefi deleted the resolve_customer_service branch January 16, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants