Skip to content

Commit efd429c

Browse files
author
Ran Isenberg
committed
fix renamed model
1 parent 462a0be commit efd429c

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

aws_lambda_powertools/utilities/parser/envelopes/apigw.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
from typing import Any, Dict, Optional, Type, Union
33

4-
from ..models import APIGatewayProxyEvent
4+
from ..models import APIGatewayProxyEventModel
55
from ..types import Model
66
from .base import BaseEnvelope
77

@@ -26,7 +26,7 @@ def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model])
2626
Any
2727
Parsed detail payload with model provided
2828
"""
29-
logger.debug(f"Parsing incoming data with Api Gateway model {APIGatewayProxyEvent}")
30-
parsed_envelope = APIGatewayProxyEvent.parse_obj(data)
29+
logger.debug(f"Parsing incoming data with Api Gateway model {APIGatewayProxyEventModel}")
30+
parsed_envelope = APIGatewayProxyEventModel.parse_obj(data)
3131
logger.debug(f"Parsing event payload in `detail` with {model}")
3232
return self._parse(data=parsed_envelope.body, model=model)

docs/utilities/parser.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,16 @@ Here's an example of parsing a model found in an event coming from EventBridge,
295295

296296
Parser comes with the following built-in envelopes, where `Model` in the return section is your given model.
297297

298-
| Envelope name | Behaviour | Return |
299-
| --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
300-
| **DynamoDBStreamEnvelope** | 1. Parses data using `DynamoDBStreamModel`. <br/> 2. Parses records in `NewImage` and `OldImage` keys using your model. <br/> 3. Returns a list with a dictionary containing `NewImage` and `OldImage` keys | `List[Dict[str, Optional[Model]]]` |
301-
| **EventBridgeEnvelope** | 1. Parses data using `EventBridgeModel`. <br/> 2. Parses `detail` key using your model and returns it. | `Model` |
302-
| **SqsEnvelope** | 1. Parses data using `SqsModel`. <br/> 2. Parses records in `body` key using your model and return them in a list. | `List[Model]` |
303-
| **CloudWatchLogsEnvelope** | 1. Parses data using `CloudwatchLogsModel` which will base64 decode and decompress it. <br/> 2. Parses records in `message` key using your model and return them in a list. | `List[Model]` |
304-
| **KinesisDataStreamEnvelope** | 1. Parses data using `KinesisDataStreamModel` which will base64 decode it. <br/> 2. Parses records in in `Records` key using your model and returns them in a list. | `List[Model]` |
305-
| **SnsEnvelope** | 1. Parses data using `SnsModel`. <br/> 2. Parses records in `body` key using your model and return them in a list. | `List[Model]` |
306-
| **SnsSqsEnvelope** | 1. Parses data using `SqsModel`. <br/> 2. Parses SNS records in `body` key using `SnsNotificationModel`. <br/> 3. Parses data in `Message` key using your model and return them in a list. | `List[Model]` |
307-
| **ApiGatewayEnvelope** 1. Parses data using `APIGatewayProxyEvent`. <br/> 2. Parses `body` key using your model and returns it. | `Model` |
298+
| Envelope name | Behaviour | Return |
299+
| -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
300+
| **DynamoDBStreamEnvelope** | 1. Parses data using `DynamoDBStreamModel`. <br/> 2. Parses records in `NewImage` and `OldImage` keys using your model. <br/> 3. Returns a list with a dictionary containing `NewImage` and `OldImage` keys | `List[Dict[str, Optional[Model]]]` |
301+
| **EventBridgeEnvelope** | 1. Parses data using `EventBridgeModel`. <br/> 2. Parses `detail` key using your model and returns it. | `Model` |
302+
| **SqsEnvelope** | 1. Parses data using `SqsModel`. <br/> 2. Parses records in `body` key using your model and return them in a list. | `List[Model]` |
303+
| **CloudWatchLogsEnvelope** | 1. Parses data using `CloudwatchLogsModel` which will base64 decode and decompress it. <br/> 2. Parses records in `message` key using your model and return them in a list. | `List[Model]` |
304+
| **KinesisDataStreamEnvelope** | 1. Parses data using `KinesisDataStreamModel` which will base64 decode it. <br/> 2. Parses records in in `Records` key using your model and returns them in a list. | `List[Model]` |
305+
| **SnsEnvelope** | 1. Parses data using `SnsModel`. <br/> 2. Parses records in `body` key using your model and return them in a list. | `List[Model]` |
306+
| **SnsSqsEnvelope** | 1. Parses data using `SqsModel`. <br/> 2. Parses SNS records in `body` key using `SnsNotificationModel`. <br/> 3. Parses data in `Message` key using your model and return them in a list. | `List[Model]` |
307+
| **ApiGatewayEnvelope** 1. Parses data using `APIGatewayProxyEventModel`. <br/> 2. Parses `body` key using your model and returns it. | `Model` |
308308
### bringing your own envelope
309309

310310
You can create your own Envelope model and logic by inheriting from `BaseEnvelope`, and implementing the `parse` method.

0 commit comments

Comments
 (0)