Skip to content

Commit e2ee8ba

Browse files
Merging from develop
2 parents bb0e495 + 861ea1f commit e2ee8ba

File tree

16 files changed

+815
-559
lines changed

16 files changed

+815
-559
lines changed

.github/workflows/secure_workflows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Checkout code
3333
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3434
- name: Ensure 3rd party workflows have SHA pinned
35-
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@9e9574ef04ea69da568d6249bd69539ccc704e74 # v4.0.0
35+
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@6124774845927d14c601359ab8138699fa5b70c3 # v4.0.1
3636
with:
3737
allowlist: |
3838
slsa-framework/slsa-github-generator

CHANGELOG.md

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
## Bug Fixes
88

9+
* **batch_processor:** fix batch processor ([#7798](https://github.com/aws-powertools/powertools-lambda-python/issues/7798))
910
* **ci:** add missing dollar signs in SSM parameter path variables ([#7695](https://github.com/aws-powertools/powertools-lambda-python/issues/7695))
1011
* **data-classes:** ensure lazy initialization for Cognito token generation response properties ([#7653](https://github.com/aws-powertools/powertools-lambda-python/issues/7653))
1112

@@ -15,52 +16,62 @@
1516

1617
## Documentation
1718

19+
* add EF Education First as customer reference ([#7809](https://github.com/aws-powertools/powertools-lambda-python/issues/7809))
1820
* clarify BedrockResponse.is_json() always returns True ([#7748](https://github.com/aws-powertools/powertools-lambda-python/issues/7748))
21+
* **event-handler:** add docstring for serializer in `BedrockAgentFunctionResolver` ([#7808](https://github.com/aws-powertools/powertools-lambda-python/issues/7808))
1922

2023
## Maintenance
2124

22-
* **ci:** new pre-release 3.23.1a7 ([#7740](https://github.com/aws-powertools/powertools-lambda-python/issues/7740))
23-
* **ci:** new pre-release 3.23.1a5 ([#7725](https://github.com/aws-powertools/powertools-lambda-python/issues/7725))
2425
* **ci:** new pre-release 3.23.1a0 ([#7685](https://github.com/aws-powertools/powertools-lambda-python/issues/7685))
25-
* **ci:** new pre-release 3.23.1a6 ([#7733](https://github.com/aws-powertools/powertools-lambda-python/issues/7733))
26-
* **ci:** new pre-release 3.23.1a3 ([#7710](https://github.com/aws-powertools/powertools-lambda-python/issues/7710))
26+
* **ci:** new pre-release 3.23.1a4 ([#7715](https://github.com/aws-powertools/powertools-lambda-python/issues/7715))
27+
* **ci:** new pre-release 3.23.1a7 ([#7740](https://github.com/aws-powertools/powertools-lambda-python/issues/7740))
2728
* **ci:** new pre-release 3.23.1a1 ([#7697](https://github.com/aws-powertools/powertools-lambda-python/issues/7697))
28-
* **ci:** new pre-release 3.23.1a2 ([#7706](https://github.com/aws-powertools/powertools-lambda-python/issues/7706))
2929
* **ci:** new pre-release 3.23.1a8 ([#7753](https://github.com/aws-powertools/powertools-lambda-python/issues/7753))
30-
* **ci:** new pre-release 3.23.1a4 ([#7715](https://github.com/aws-powertools/powertools-lambda-python/issues/7715))
31-
* **deps:** bump redis from 6.4.0 to 7.0.1 ([#7687](https://github.com/aws-powertools/powertools-lambda-python/issues/7687))
30+
* **ci:** new pre-release 3.23.1a2 ([#7706](https://github.com/aws-powertools/powertools-lambda-python/issues/7706))
31+
* **ci:** new pre-release 3.23.1a3 ([#7710](https://github.com/aws-powertools/powertools-lambda-python/issues/7710))
32+
* **ci:** new pre-release 3.23.1a5 ([#7725](https://github.com/aws-powertools/powertools-lambda-python/issues/7725))
33+
* **ci:** new pre-release 3.23.1a6 ([#7733](https://github.com/aws-powertools/powertools-lambda-python/issues/7733))
34+
* **deps:** bump codecov/codecov-action from 5.5.1 to 5.5.2 ([#7788](https://github.com/aws-powertools/powertools-lambda-python/issues/7788))
3235
* **deps:** bump actions/checkout from 6.0.0 to 6.0.1 ([#7766](https://github.com/aws-powertools/powertools-lambda-python/issues/7766))
36+
* **deps:** bump datadog-lambda from 8.116.0 to 8.118.0 ([#7785](https://github.com/aws-powertools/powertools-lambda-python/issues/7785))
37+
* **deps:** bump urllib3 from 2.5.0 to 2.6.0 in /docs ([#7778](https://github.com/aws-powertools/powertools-lambda-python/issues/7778))
38+
* **deps:** bump protobuf from 6.33.1 to 6.33.2 ([#7786](https://github.com/aws-powertools/powertools-lambda-python/issues/7786))
39+
* **deps:** bump valkey-glide from 2.2.1 to 2.2.2 ([#7802](https://github.com/aws-powertools/powertools-lambda-python/issues/7802))
40+
* **deps:** bump actions/setup-node from 6.0.0 to 6.1.0 ([#7773](https://github.com/aws-powertools/powertools-lambda-python/issues/7773))
41+
* **deps:** bump actions/upload-artifact from 5.0.0 to 6.0.0 ([#7800](https://github.com/aws-powertools/powertools-lambda-python/issues/7800))
42+
* **deps:** bump actions/download-artifact from 6.0.0 to 7.0.0 ([#7801](https://github.com/aws-powertools/powertools-lambda-python/issues/7801))
3343
* **deps:** bump mkdocs-llmstxt from 0.4.0 to 0.5.0 in /docs ([#7720](https://github.com/aws-powertools/powertools-lambda-python/issues/7720))
44+
* **deps:** bump actions/setup-go from 6.0.0 to 6.1.0 ([#7718](https://github.com/aws-powertools/powertools-lambda-python/issues/7718))
3445
* **deps:** bump actions/checkout from 5.0.1 to 6.0.0 ([#7719](https://github.com/aws-powertools/powertools-lambda-python/issues/7719))
35-
* **deps:** bump actions/setup-node from 6.0.0 to 6.1.0 ([#7773](https://github.com/aws-powertools/powertools-lambda-python/issues/7773))
46+
* **deps:** bump protobuf from 6.33.0 to 6.33.1 ([#7681](https://github.com/aws-powertools/powertools-lambda-python/issues/7681))
3647
* **deps:** bump actions/checkout from 5.0.0 to 5.0.1 ([#7701](https://github.com/aws-powertools/powertools-lambda-python/issues/7701))
3748
* **deps:** bump valkey-glide from 2.1.1 to 2.2.1 ([#7783](https://github.com/aws-powertools/powertools-lambda-python/issues/7783))
38-
* **deps:** bump actions/setup-go from 6.0.0 to 6.1.0 ([#7718](https://github.com/aws-powertools/powertools-lambda-python/issues/7718))
39-
* **deps:** bump datadog-lambda from 8.116.0 to 8.118.0 ([#7785](https://github.com/aws-powertools/powertools-lambda-python/issues/7785))
40-
* **deps:** bump protobuf from 6.33.1 to 6.33.2 ([#7786](https://github.com/aws-powertools/powertools-lambda-python/issues/7786))
41-
* **deps:** bump protobuf from 6.33.0 to 6.33.1 ([#7681](https://github.com/aws-powertools/powertools-lambda-python/issues/7681))
42-
* **deps:** bump urllib3 from 2.5.0 to 2.6.0 in /docs ([#7778](https://github.com/aws-powertools/powertools-lambda-python/issues/7778))
43-
* **deps:** bump valkey-glide from 2.2.1 to 2.2.2 ([#7802](https://github.com/aws-powertools/powertools-lambda-python/issues/7802))
49+
* **deps:** bump redis from 6.4.0 to 7.0.1 ([#7687](https://github.com/aws-powertools/powertools-lambda-python/issues/7687))
50+
* **deps-dev:** bump boto3-stubs from 1.41.2 to 1.41.5 ([#7768](https://github.com/aws-powertools/powertools-lambda-python/issues/7768))
51+
* **deps-dev:** bump aws-cdk from 2.1032.0 to 2.1033.0 ([#7713](https://github.com/aws-powertools/powertools-lambda-python/issues/7713))
4452
* **deps-dev:** bump boto3-stubs from 1.40.75 to 1.40.76 ([#7714](https://github.com/aws-powertools/powertools-lambda-python/issues/7714))
53+
* **deps-dev:** bump boto3-stubs from 1.40.76 to 1.41.1 ([#7727](https://github.com/aws-powertools/powertools-lambda-python/issues/7727))
54+
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.225.0a0 to 2.227.0a0 ([#7730](https://github.com/aws-powertools/powertools-lambda-python/issues/7730))
55+
* **deps-dev:** bump aws-cdk-lib from 2.227.0 to 2.231.0 ([#7771](https://github.com/aws-powertools/powertools-lambda-python/issues/7771))
4556
* **deps-dev:** bump cfn-lint from 1.40.4 to 1.41.0 ([#7709](https://github.com/aws-powertools/powertools-lambda-python/issues/7709))
4657
* **deps-dev:** bump sentry-sdk from 2.44.0 to 2.45.0 ([#7708](https://github.com/aws-powertools/powertools-lambda-python/issues/7708))
47-
* **deps-dev:** bump aws-cdk from 2.1032.0 to 2.1033.0 ([#7713](https://github.com/aws-powertools/powertools-lambda-python/issues/7713))
48-
* **deps-dev:** bump ruff from 0.14.5 to 0.14.6 ([#7728](https://github.com/aws-powertools/powertools-lambda-python/issues/7728))
58+
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.227.0a0 to 2.231.0a0 ([#7767](https://github.com/aws-powertools/powertools-lambda-python/issues/7767))
59+
* **deps-dev:** bump ruff from 0.14.6 to 0.14.7 ([#7770](https://github.com/aws-powertools/powertools-lambda-python/issues/7770))
4960
* **deps-dev:** bump boto3-stubs from 1.40.73 to 1.40.74 ([#7703](https://github.com/aws-powertools/powertools-lambda-python/issues/7703))
5061
* **deps-dev:** bump types-python-dateutil from 2.9.0.20251108 to 2.9.0.20251115 ([#7702](https://github.com/aws-powertools/powertools-lambda-python/issues/7702))
51-
* **deps-dev:** bump boto3-stubs from 1.40.76 to 1.41.1 ([#7727](https://github.com/aws-powertools/powertools-lambda-python/issues/7727))
62+
* **deps-dev:** bump ruff from 0.14.5 to 0.14.6 ([#7728](https://github.com/aws-powertools/powertools-lambda-python/issues/7728))
5263
* **deps-dev:** bump aws-cdk from 2.1031.2 to 2.1032.0 ([#7700](https://github.com/aws-powertools/powertools-lambda-python/issues/7700))
53-
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.225.0a0 to 2.227.0a0 ([#7730](https://github.com/aws-powertools/powertools-lambda-python/issues/7730))
64+
* **deps-dev:** bump aws-cdk-lib from 2.232.1 to 2.232.2 ([#7816](https://github.com/aws-powertools/powertools-lambda-python/issues/7816))
5465
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.224.0a0 to 2.225.0a0 ([#7704](https://github.com/aws-powertools/powertools-lambda-python/issues/7704))
5566
* **deps-dev:** bump boto3-stubs from 1.40.72 to 1.40.73 ([#7688](https://github.com/aws-powertools/powertools-lambda-python/issues/7688))
56-
* **deps-dev:** bump boto3-stubs from 1.41.2 to 1.41.5 ([#7768](https://github.com/aws-powertools/powertools-lambda-python/issues/7768))
57-
* **deps-dev:** bump aws-cdk-lib from 2.227.0 to 2.231.0 ([#7771](https://github.com/aws-powertools/powertools-lambda-python/issues/7771))
58-
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.227.0a0 to 2.231.0a0 ([#7767](https://github.com/aws-powertools/powertools-lambda-python/issues/7767))
59-
* **deps-dev:** bump ruff from 0.14.6 to 0.14.7 ([#7770](https://github.com/aws-powertools/powertools-lambda-python/issues/7770))
60-
* **deps-dev:** bump ruff from 0.14.4 to 0.14.5 ([#7682](https://github.com/aws-powertools/powertools-lambda-python/issues/7682))
6167
* **deps-dev:** bump boto3-stubs from 1.42.4 to 1.42.6 ([#7791](https://github.com/aws-powertools/powertools-lambda-python/issues/7791))
62-
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.223.0a0 to 2.224.0a0 ([#7680](https://github.com/aws-powertools/powertools-lambda-python/issues/7680))
6368
* **deps-dev:** bump boto3-stubs from 1.42.6 to 1.42.7 ([#7796](https://github.com/aws-powertools/powertools-lambda-python/issues/7796))
69+
* **deps-dev:** bump types-protobuf from 6.32.1.20251105 to 6.32.1.20251210 ([#7793](https://github.com/aws-powertools/powertools-lambda-python/issues/7793))
70+
* **deps-dev:** bump aws-cdk from 2.1033.0 to 2.1034.0 ([#7795](https://github.com/aws-powertools/powertools-lambda-python/issues/7795))
71+
* **deps-dev:** bump ruff from 0.14.4 to 0.14.5 ([#7682](https://github.com/aws-powertools/powertools-lambda-python/issues/7682))
72+
* **deps-dev:** bump sentry-sdk from 2.45.0 to 2.47.0 ([#7790](https://github.com/aws-powertools/powertools-lambda-python/issues/7790))
73+
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.223.0a0 to 2.224.0a0 ([#7680](https://github.com/aws-powertools/powertools-lambda-python/issues/7680))
74+
* **deps-dev:** bump cfn-lint from 1.41.0 to 1.42.0 ([#7784](https://github.com/aws-powertools/powertools-lambda-python/issues/7784))
6475
* **deps-dev:** bump mypy-boto3-appconfigdata from 1.40.55 to 1.41.0 in the boto-typing group ([#7721](https://github.com/aws-powertools/powertools-lambda-python/issues/7721))
6576

6677

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ The following companies, among others, use Powertools:
6464
* [CPQi (Exadel Financial Services)](https://cpqi.com/)
6565
* [CloudZero](https://www.cloudzero.com/)
6666
* [CyberArk](https://www.cyberark.com/)
67+
* [EF Education First](https://www.ef.com/)
6768
* [Flyweight](https://flyweight.io/)
6869
* [globaldatanet](https://globaldatanet.com/)
6970
* [Guild](https://guild.com/)

aws_lambda_powertools/event_handler/bedrock_agent_function.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ def lambda_handler(event, context):
133133
context: dict
134134

135135
def __init__(self, serializer: Callable | None = None) -> None:
136+
"""
137+
Parameters
138+
----------
139+
serializer: Callable, optional
140+
function to serialize `obj` to a JSON formatted `str`, by default json.dumps
141+
"""
136142
self._tools: dict[str, dict[str, Any]] = {}
137143
self.current_event: BedrockAgentFunctionEvent | None = None
138144
self.context = {}

aws_lambda_powertools/utilities/parser/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
)
6767
from .dynamodb import (
6868
DynamoDBStreamChangedRecordModel,
69+
DynamoDBStreamLambdaOnFailureDestinationModel,
6970
DynamoDBStreamModel,
7071
DynamoDBStreamRecordModel,
7172
)
@@ -173,6 +174,7 @@
173174
"DynamoDBStreamModel",
174175
"EventBridgeModel",
175176
"DynamoDBStreamChangedRecordModel",
177+
"DynamoDBStreamLambdaOnFailureDestinationModel",
176178
"DynamoDBStreamRecordModel",
177179
"DynamoDBStreamChangedRecordModel",
178180
"KinesisDataStreamModel",

aws_lambda_powertools/utilities/parser/models/dynamodb.py

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from datetime import datetime
33
from typing import Any, Dict, List, Literal, Optional, Type, Union
44

5-
from pydantic import BaseModel, Field, field_validator
5+
from pydantic import BaseModel, ConfigDict, Field, field_validator
6+
from pydantic.alias_generators import to_camel
67

78
from aws_lambda_powertools.shared.dynamodb_deserializer import TypeDeserializer
89

@@ -110,3 +111,91 @@ class DynamoDBStreamModel(BaseModel):
110111
},
111112
],
112113
)
114+
115+
116+
class DDBStreamBatchInfo(BaseModel):
117+
model_config = ConfigDict(alias_generator=to_camel)
118+
119+
approximate_arrival_of_first_record: datetime = Field(
120+
description="The approximate date and time when the first stream record from the batch was created"
121+
", in ISO-8601 format.",
122+
examples=["1970-01-01T00:00:00.000Z"],
123+
)
124+
approximate_arrival_of_last_record: datetime = Field(
125+
description="The approximate date and time when the last stream record from the batch was created"
126+
", in ISO-8601 format.",
127+
examples=["1970-01-01T00:00:00.000Z"],
128+
)
129+
batch_size: int = Field(
130+
description="The size of the batch.",
131+
examples=[1],
132+
)
133+
end_sequence_number: str = Field(
134+
description="The unique identifier of the last stream record from the batch.",
135+
examples=["222"],
136+
)
137+
shard_id: str = Field(
138+
description="The unique identifier of the DynamoDB Stream shard that contains the records from the batch.",
139+
examples=["shardId-00000000000000000000-00000000"],
140+
)
141+
start_sequence_number: str = Field(
142+
description="The unique identifier of the first stream record from the batch.",
143+
examples=["222"],
144+
)
145+
stream_arn: str = Field(
146+
description="The Amazon Resource Name (ARN) of the DynamoDB stream.",
147+
examples=["arn:aws:dynamodb:us-west-2:123456789012:table/ExampleTable/stream/2021-01-01T00:00:00.000"],
148+
)
149+
150+
151+
class RequestContext(BaseModel):
152+
model_config = ConfigDict(alias_generator=to_camel)
153+
154+
approximate_invoke_count: int = Field(
155+
description="The number of Lambda invocations for the record.",
156+
examples=[1],
157+
)
158+
condition: str = Field(
159+
description="The condition that caused the record to be discarded.",
160+
examples=["RetryAttemptsExhausted"],
161+
)
162+
function_arn: str = Field(
163+
description="The Amazon Resource Name (ARN) of the Lambda.",
164+
examples=["arn:aws:lambda:eu-west-1:809313241:function:test"],
165+
)
166+
request_id: str = Field(
167+
description="The unique identifier of the request.",
168+
)
169+
170+
171+
class ResponseContext(BaseModel):
172+
model_config = ConfigDict(alias_generator=to_camel)
173+
174+
executed_version: str = Field(
175+
description="The version of the Lambda executed",
176+
examples=["$LATEST"],
177+
)
178+
function_error: str = Field(
179+
description="",
180+
examples=["Unhandled"],
181+
)
182+
status_code: int = Field(
183+
description="The status code returned by the Lambda",
184+
)
185+
186+
187+
# https://docs.aws.amazon.com/lambda/latest/dg/services-dynamodb-errors.html
188+
class DynamoDBStreamLambdaOnFailureDestinationModel(BaseModel):
189+
model_config = ConfigDict(alias_generator=to_camel)
190+
191+
ddb_stream_batch_info: DDBStreamBatchInfo = Field(alias="DDBStreamBatchInfo")
192+
request_context: RequestContext
193+
response_context: ResponseContext
194+
timestamp: datetime = Field(
195+
description="The record time, in ISO-8601 format.",
196+
examples=["1970-01-01T00:00:00.000Z"],
197+
)
198+
version: str = Field(
199+
description="The version of the record format.",
200+
examples=["1.0"],
201+
)

0 commit comments

Comments
 (0)