-
Notifications
You must be signed in to change notification settings - Fork 32
-
Summary
In this release we introduce built in JMESPath support for Powertools Idempotency utility.
With this release we remove the need for 3rd party dependencies and move from the old Newtonsoft.Json
to the new System.Text.Json
also is fully JMESPath spec compliant.
Fully backwards compatible, there are no changes to the way you having been using Idempotency before.
Powertools JMESPath functions
You can use our built-in JMESPath functions within your envelope expression. They handle deserialization for common data formats found in AWS Lambda event sources such as JSON strings, base64, and uncompress gzip data.
powertools_json function idempotency example
Use powertools_json function to decode any JSON string anywhere a JMESPath expression is allowed.
Example of using JMESPath with Idempotency to create the idempotent key
Idempotency.Configure(builder => builder .WithOptions(optionsBuilder => optionsBuilder.WithEventKeyJmesPath("powertools_json(Body).[\"user_id\", \"product_id\"]")) .UseDynamoDb("idempotency_table"));
{ "version": "2.0", "routeKey": "ANY /createpayment", "rawPath": "/createpayment", "rawQueryString": "", "headers": { "Header1": "value1", "Header2": "value2" }, "requestContext": { "accountId": "123456789012", "apiId": "api-id", "domainName": "id.execute-api.us-east-1.amazonaws.com", "domainPrefix": "id", "http": { "method": "POST", "path": "/createpayment", "protocol": "HTTP/1.1", "sourceIp": "ip", "userAgent": "agent" }, "requestId": "id", "routeKey": "ANY /createpayment", "stage": "$default", "time": "10/Feb/2021:13:40:43 +0000", "timeEpoch": 1612964443723 }, "body": "{\"user_id\":\"xyz\",\"product_id\":\"123456789\"}", "isBase64Encoded": false }
Changes
🌟New features and non-breaking changes
- feat(idempotency): add internal powertools JMESPath support (feat(idempotency): add internal powertools JMESPath support #578 ) by @hjgraca
📜 Documentation updates
- feat(idempotency): add internal powertools JMESPath support (feat(idempotency): add internal powertools JMESPath support #578 ) by @hjgraca
🔧 Maintenance
- docs: add link to Powertools for AWS Lambda workshop (docs: add link to Powertools for AWS Lambda workshop #581 ) by @dreamorosi
- chore: Update build pipeline (chore: Update build pipeline #584 ) by @hjgraca
This release was made possible by the following contributors:
Code and inspiration from jdevillard/JmesPath.Net and danielaparker/JsonCons.Net
This discussion was created from the release 1.10.0.
Beta Was this translation helpful? Give feedback.