Skip to content

Commit 9f14092

Browse files
author
Ana Falcao
committed
changed the example from built in env to models
1 parent 19694b6 commit 9f14092

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

docs/utilities/parser.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ The `@event_parser` decorator is ideal for:
8989

9090
Parser provides built-in models for parsing events from AWS services. You don't need to worry about creating these models yourself - we've already done that for you, making it easier to process AWS events in your Lambda functions.
9191

92+
=== "sqs_model_event.py"
93+
94+
```python hl_lines="2 7"
95+
--8<-- "examples/parser/src/sqs_model_event.py"
96+
```
97+
98+
=== "Sample event"
99+
100+
```json
101+
--8<-- "examples/parser/src/sqs_model_event.json"
102+
```
103+
104+
The example above uses `SqsModel`. Other built-in envelopes can be found below.
105+
92106
| Model name | Description |
93107
| ------------------------------------------- | ------------------------------------------------------------------------------------- |
94108
| **AlbModel** | Lambda Event Source payload for Amazon Application Load Balancer |
@@ -179,21 +193,6 @@ Using `@event_parser` decorator to automatically parse the EventBridge event and
179193

180194
Parsers provides built-in envelopes to extract and parse specific parts of complex event structures. These envelopes simplify handling nested data in events from various AWS services, allowing you to focus on the relevant information for your Lambda function.
181195

182-
183-
=== "sqs_model_event.py"
184-
185-
```python hl_lines="2 7"
186-
--8<-- "examples/parser/src/sqs_model_event.py"
187-
```
188-
189-
=== "Sample event"
190-
191-
```json
192-
--8<-- "examples/parser/src/sqs_model_event.json"
193-
```
194-
195-
The example above uses `SqsEnvelope` by importing `SqsModel`. Other built-in envelopes can be found below.
196-
197196
| Envelope name | Behaviour | Return |
198197
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
199198
| **DynamoDBStreamEnvelope** | 1. Parses data using `DynamoDBStreamModel`. `` 2. Parses records in `NewImage` and `OldImage` keys using your model. `` 3. Returns a list with a dictionary containing `NewImage` and `OldImage` keys | `List[Dict[str, Optional[Model]]]` |

0 commit comments

Comments
 (0)