Skip to content

Commit fd1cc46

Browse files
Merge branch 'develop' into logger-current-keys
2 parents f07091c + adfdb1f commit fd1cc46

File tree

25 files changed

+502
-195
lines changed

25 files changed

+502
-195
lines changed

.github/actionlint.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
self-hosted-runner:
22
labels:
3-
- aws-powertools_ubuntu-latest_4-core
43
- aws-powertools_ubuntu-latest_8-core
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Monthly roadmap reminder
2+
3+
on:
4+
workflow_dispatch: {}
5+
# schedule:
6+
# - cron: '0 0 1 * *'
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
issues: read
12+
13+
14+
jobs:
15+
call-workflow-passing-data:
16+
uses: aws-powertools/actions/.github/workflows/monthly_roadmap_reminder.yml@fd4575466e5c2ac10703ac16f5aa9fb8890f532a
17+
with:
18+
token: ${{ github.token }}
19+
20+

.github/workflows/publish_v2_layer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124

125125
- name: Set up Docker Buildx
126126
id: builder
127-
uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0
127+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
128128
with:
129129
install: true
130130
driver: docker

.github/workflows/quality_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
- name: Complexity baseline
7272
run: make complexity-baseline
7373
- name: Upload coverage to Codecov
74-
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # 4.1.1
74+
uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # 4.3.0
7575
with:
7676
file: ./coverage.xml
7777
env_vars: PYTHON

.github/workflows/secure_workflows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ jobs:
3232
- name: Checkout code
3333
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
3434
- name: Ensure 3rd party workflows have SHA pinned
35-
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@ba37328d4ea95eaf8b3bd6c6cef308f709a5f2ec # v3.0.3
35+
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@19ebcb0babbd282ae1822a0b9c28f3f1f25cea45 # v3.0.4
3636
with:
3737
allowlist: slsa-framework/slsa-github-generator

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,47 @@
44
<a name="unreleased"></a>
55
# Unreleased
66

7+
## Bug Fixes
8+
9+
* **event_source:** fix typo in physicalname attribute for AmazonMQ events ([#4053](https://github.com/aws-powertools/powertools-lambda-python/issues/4053))
10+
11+
## Documentation
12+
13+
* **we-made-this:** new article on how to stream data with AWS Lambda & Powertools for AWS Lambda ([#4068](https://github.com/aws-powertools/powertools-lambda-python/issues/4068))
14+
15+
## Features
16+
17+
* **Idempotency:** add feature for manipulating idempotent responses ([#4037](https://github.com/aws-powertools/powertools-lambda-python/issues/4037))
18+
719
## Maintenance
820

21+
* **ci:** add monthly roadmap reminder workflow ([#4075](https://github.com/aws-powertools/powertools-lambda-python/issues/4075))
22+
* **ci:** prevent deprecated custom runner from being used ([#4061](https://github.com/aws-powertools/powertools-lambda-python/issues/4061))
23+
* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update ([#4066](https://github.com/aws-powertools/powertools-lambda-python/issues/4066))
24+
* **deps:** bump pydantic from 1.10.14 to 1.10.15 ([#4064](https://github.com/aws-powertools/powertools-lambda-python/issues/4064))
25+
* **deps:** bump golang.org/x/sync from 0.6.0 to 0.7.0 in /layer/scripts/layer-balancer in the layer-balancer group ([#4071](https://github.com/aws-powertools/powertools-lambda-python/issues/4071))
26+
* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates ([#4042](https://github.com/aws-powertools/powertools-lambda-python/issues/4042))
27+
* **deps:** bump codecov/codecov-action from 4.1.1 to 4.2.0 ([#4072](https://github.com/aws-powertools/powertools-lambda-python/issues/4072))
28+
* **deps:** bump squidfunk/mkdocs-material from `3307665` to `065f3af` in /docs ([#4052](https://github.com/aws-powertools/powertools-lambda-python/issues/4052))
29+
* **deps:** bump squidfunk/mkdocs-material from `065f3af` to `6b124e1` in /docs ([#4055](https://github.com/aws-powertools/powertools-lambda-python/issues/4055))
930
* **deps:** bump datadog-lambda from 5.91.0 to 5.92.0 ([#4038](https://github.com/aws-powertools/powertools-lambda-python/issues/4038))
31+
* **deps:** bump github.com/aws/aws-sdk-go-v2/config from 1.27.10 to 1.27.11 in /layer/scripts/layer-balancer in the layer-balancer group ([#4079](https://github.com/aws-powertools/powertools-lambda-python/issues/4079))
32+
* **deps-dev:** bump mkdocs-material from 9.5.15 to 9.5.16 ([#4050](https://github.com/aws-powertools/powertools-lambda-python/issues/4050))
33+
* **deps-dev:** bump the boto-typing group with 1 update ([#4047](https://github.com/aws-powertools/powertools-lambda-python/issues/4047))
34+
* **deps-dev:** bump mkdocs-material from 9.5.16 to 9.5.17 ([#4056](https://github.com/aws-powertools/powertools-lambda-python/issues/4056))
35+
* **deps-dev:** bump cdklabs-generative-ai-cdk-constructs from 0.1.105 to 0.1.106 ([#4048](https://github.com/aws-powertools/powertools-lambda-python/issues/4048))
36+
* **deps-dev:** bump aws-cdk-lib from 2.134.0 to 2.135.0 ([#4057](https://github.com/aws-powertools/powertools-lambda-python/issues/4057))
37+
* **deps-dev:** bump aws-cdk from 2.134.0 to 2.135.0 ([#4058](https://github.com/aws-powertools/powertools-lambda-python/issues/4058))
1038
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.133.0a0 to 2.134.0a0 ([#4039](https://github.com/aws-powertools/powertools-lambda-python/issues/4039))
1139
* **deps-dev:** bump sentry-sdk from 1.43.0 to 1.44.0 ([#4040](https://github.com/aws-powertools/powertools-lambda-python/issues/4040))
40+
* **deps-dev:** bump the boto-typing group with 2 updates ([#4062](https://github.com/aws-powertools/powertools-lambda-python/issues/4062))
41+
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.134.0a0 to 2.135.0a0 ([#4063](https://github.com/aws-powertools/powertools-lambda-python/issues/4063))
1242
* **deps-dev:** bump aws-cdk-lib from 2.133.0 to 2.134.0 ([#4031](https://github.com/aws-powertools/powertools-lambda-python/issues/4031))
1343
* **deps-dev:** bump cdklabs-generative-ai-cdk-constructs from 0.1.104 to 0.1.105 ([#4030](https://github.com/aws-powertools/powertools-lambda-python/issues/4030))
1444
* **deps-dev:** bump aws-cdk from 2.133.0 to 2.134.0 ([#4032](https://github.com/aws-powertools/powertools-lambda-python/issues/4032))
1545
* **deps-dev:** bump the boto-typing group with 1 update ([#4029](https://github.com/aws-powertools/powertools-lambda-python/issues/4029))
46+
* **deps-dev:** bump sentry-sdk from 1.44.0 to 1.44.1 ([#4065](https://github.com/aws-powertools/powertools-lambda-python/issues/4065))
47+
* **deps-dev:** bump ruff from 0.3.4 to 0.3.5 ([#4049](https://github.com/aws-powertools/powertools-lambda-python/issues/4049))
1648

1749

1850
<a name="v2.36.0"></a>

aws_lambda_powertools/utilities/data_classes/active_mq_event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def properties(self) -> dict:
5959

6060
@property
6161
def destination_physicalname(self) -> str:
62-
return self["destination"]["physicalname"]
62+
return self["destination"]["physicalName"]
6363

6464
@property
6565
def delivery_mode(self) -> Optional[int]:

aws_lambda_powertools/utilities/idempotency/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Utility for adding idempotency to lambda functions
33
"""
44

5+
from aws_lambda_powertools.utilities.idempotency.hook import (
6+
IdempotentHookFunction,
7+
)
58
from aws_lambda_powertools.utilities.idempotency.persistence.base import (
69
BasePersistenceLayer,
710
)
@@ -17,4 +20,5 @@
1720
"idempotent",
1821
"idempotent_function",
1922
"IdempotencyConfig",
23+
"IdempotentHookFunction",
2024
)

aws_lambda_powertools/utilities/idempotency/base.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from copy import deepcopy
44
from typing import Any, Callable, Dict, Optional, Tuple
55

6-
from aws_lambda_powertools.utilities.idempotency.config import IdempotencyConfig
6+
from aws_lambda_powertools.utilities.idempotency.config import (
7+
IdempotencyConfig,
8+
)
79
from aws_lambda_powertools.utilities.idempotency.exceptions import (
810
IdempotencyAlreadyInProgressError,
911
IdempotencyInconsistentStateError,
@@ -227,7 +229,15 @@ def _handle_for_status(self, data_record: DataRecord) -> Optional[Any]:
227229
)
228230
response_dict: Optional[dict] = data_record.response_json_as_dict()
229231
if response_dict is not None:
230-
return self.output_serializer.from_dict(response_dict)
232+
serialized_response = self.output_serializer.from_dict(response_dict)
233+
if self.config.response_hook is not None:
234+
logger.debug("Response hook configured, invoking function")
235+
return self.config.response_hook(
236+
serialized_response,
237+
data_record,
238+
)
239+
return serialized_response
240+
231241
return None
232242

233243
def _get_function_response(self):

aws_lambda_powertools/utilities/idempotency/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Dict, Optional
22

3+
from aws_lambda_powertools.utilities.idempotency import IdempotentHookFunction
34
from aws_lambda_powertools.utilities.typing import LambdaContext
45

56

@@ -15,6 +16,7 @@ def __init__(
1516
local_cache_max_items: int = 256,
1617
hash_function: str = "md5",
1718
lambda_context: Optional[LambdaContext] = None,
19+
response_hook: Optional[IdempotentHookFunction] = None,
1820
):
1921
"""
2022
Initialize the base persistence layer
@@ -37,6 +39,8 @@ def __init__(
3739
Function to use for calculating hashes, by default md5.
3840
lambda_context: LambdaContext, optional
3941
Lambda Context containing information about the invocation, function and execution environment.
42+
response_hook: IdempotentHookFunction, optional
43+
Hook function to be called when an idempotent response is returned from the idempotent store.
4044
"""
4145
self.event_key_jmespath = event_key_jmespath
4246
self.payload_validation_jmespath = payload_validation_jmespath
@@ -47,6 +51,7 @@ def __init__(
4751
self.local_cache_max_items = local_cache_max_items
4852
self.hash_function = hash_function
4953
self.lambda_context: Optional[LambdaContext] = lambda_context
54+
self.response_hook: Optional[IdempotentHookFunction] = response_hook
5055

5156
def register_lambda_context(self, lambda_context: LambdaContext):
5257
"""Captures the Lambda context, to calculate the remaining time before the invocation times out"""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from typing import Any
2+
3+
from aws_lambda_powertools.shared.types import Protocol
4+
from aws_lambda_powertools.utilities.idempotency.persistence.datarecord import DataRecord
5+
6+
7+
class IdempotentHookFunction(Protocol):
8+
"""
9+
The IdempotentHookFunction.
10+
This class defines the calling signature for IdempotentHookFunction callbacks.
11+
"""
12+
13+
def __call__(self, response: Any, idempotent_data: DataRecord) -> Any: ...

docs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# v9.1.18
2-
FROM squidfunk/mkdocs-material@sha256:33076657e536b6b8439168296a193098aef3c4c88cc2cecd0736cd391b90e7fd
2+
FROM squidfunk/mkdocs-material@sha256:6b124e13728a591607e0f087920763e405fc18861736a997896d0b253867a7b7
33
# pip-compile --generate-hashes --output-file=requirements.txt requirements.in
44
COPY requirements.txt /tmp/
55
RUN pip install --require-hashes -r /tmp/requirements.txt

0 commit comments

Comments
 (0)