GeezerVison is showing github.com — fix(parser): add IoT Core registry models to parser.models exports (#… · exg/powertools-lambda-python@914923c
File treeExpand file treeCollapse file tree Open diff view settings aws_lambda_powertools/utilities/parser/models
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: aws_lambda_powertools/utilities/parser/models/__init__.py +20Lines changed: 20 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 78 | 78 | ) | 79 | 79 | from .event_bridge import EventBridgeModel | 80 | 80 | from .event_bridge_v2 import EventBridgeV2Model, EventBridgeV2RecordModel, EventBridgeV2SystemMetadataModel | | 81 | + from .iot_registry_events import ( | | 82 | + IoTCoreAddOrDeleteFromThingGroupEvent, | | 83 | + IoTCoreAddOrRemoveFromThingGroupEvent, | | 84 | + IoTCoreThingEvent, | | 85 | + IoTCoreThingGroupEvent, | | 86 | + IoTCoreThingTypeAssociationEvent, | | 87 | + IoTCoreThingTypeEvent, | | 88 | + ) | 81 | 89 | from .kafka import ( | 82 | 90 | KafkaBaseEventModel, | 83 | 91 | KafkaMskEventModel, | | 203 | 211 | "EventBridgeV2Model": "event_bridge_v2", | 204 | 212 | "EventBridgeV2RecordModel": "event_bridge_v2", | 205 | 213 | "EventBridgeV2SystemMetadataModel": "event_bridge_v2", | | 214 | + "IoTCoreAddOrDeleteFromThingGroupEvent": "iot_registry_events", | | 215 | + "IoTCoreAddOrRemoveFromThingGroupEvent": "iot_registry_events", | | 216 | + "IoTCoreThingEvent": "iot_registry_events", | | 217 | + "IoTCoreThingGroupEvent": "iot_registry_events", | | 218 | + "IoTCoreThingTypeAssociationEvent": "iot_registry_events", | | 219 | + "IoTCoreThingTypeEvent": "iot_registry_events", | 206 | 220 | "KafkaBaseEventModel": "kafka", | 207 | 221 | "KafkaMskEventModel": "kafka", | 208 | 222 | "KafkaRecordModel": "kafka", | @@ -370,6 +384,12 @@ def __dir__() -> list[str]: | 370 | 384 | "KafkaSelfManagedEventModel", | 371 | 385 | "KafkaRecordModel", | 372 | 386 | "KafkaMskEventModel", | | 387 | + "IoTCoreAddOrDeleteFromThingGroupEvent", | | 388 | + "IoTCoreAddOrRemoveFromThingGroupEvent", | | 389 | + "IoTCoreThingEvent", | | 390 | + "IoTCoreThingGroupEvent", | | 391 | + "IoTCoreThingTypeAssociationEvent", | | 392 | + "IoTCoreThingTypeEvent", | 373 | 393 | "KafkaBaseEventModel", | 374 | 394 | "KinesisFirehoseSqsModel", | 375 | 395 | "KinesisFirehoseSqsRecord", | |
Collapse file Copy file name to clipboardExpand all lines: docs/utilities/parser.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -118,7 +118,7 @@ The example above uses `SqsModel`. Other built-in models can be found below. | 118 | 118 | | **CloudFormationCustomResourceCreateModel** | Lambda Event Source payload for AWS CloudFormation `CREATE` operation | | 119 | 119 | | **CloudFormationCustomResourceUpdateModel** | Lambda Event Source payload for AWS CloudFormation `UPDATE` operation | | 120 | 120 | | **CloudFormationCustomResourceDeleteModel** | Lambda Event Source payload for AWS CloudFormation `DELETE` operation | | 121 | | -| **CloudwatchLogsModel** | Lambda Event Source payload for Amazon CloudWatch Logs | | | 121 | +| **CloudWatchLogsModel** | Lambda Event Source payload for Amazon CloudWatch Logs | | 122 | 122 | | **CognitoPreSignupTriggerModel** | Lambda User Pool Pre-Sign-Up trigger event | | 123 | 123 | | **CognitoPostConfirmationTriggerModel** | Lambda User Pool Post Confirmation trigger event | | 124 | 124 | | **CognitoPreAuthenticationTriggerModel** | Lambda User Pool Pre Authentication trigger event | | @@ -212,7 +212,7 @@ You can use pre-built envelopes provided by the Parser to extract and parse spec | 212 | 212 | | **EventBridgeEnvelope** | 1. Parses data using `EventBridgeModel`. ``2. Parses `detail` key using your model`` and returns it. | `Model` | | 213 | 213 | | **EventBridgeV2Envelope** | 1. Parses data using `EventBridgeV2Model`. ``2. Parses `Data` (or `Data.detail` for PutEvents) of each record using your model`` and returns them in a list. Also accepts RAW deliveries. | `List[Model]` | | 214 | 214 | | **SqsEnvelope** | 1. Parses data using `SqsModel`. ``2. Parses records in `body` key using your model`` and return them in a list. | `List[Model]` | | 215 | | -| **CloudWatchLogsEnvelope** | 1. Parses data using `CloudwatchLogsModel` which will base64 decode and decompress it. ``2. Parses records in `message` key using your model`` and return them in a list. | `List[Model]` | | | 215 | +| **CloudWatchLogsEnvelope** | 1. Parses data using `CloudWatchLogsModel` which will base64 decode and decompress it. ``2. Parses records in `message` key using your model`` and return them in a list. | `List[Model]` | | 216 | 216 | | **KinesisDataStreamEnvelope** | 1. Parses data using `KinesisDataStreamModel` which will base64 decode it. ``2. Parses records in the `Records` key using your model`` and returns them in a list. | `List[Model]` | | 217 | 217 | | **KinesisFirehoseEnvelope** | 1. Parses data using `KinesisFirehoseModel` which will base64 decode it. ``2. Parses records in the `Records` key using your model`` and returns them in a list. | `List[Model]` | | 218 | 218 | | **SnsEnvelope** | 1. Parses data using `SnsModel`. ``2. Parses records in `body` key using your model`` and return them in a list. | `List[Model]` | | |
Collapse file Copy file name to clipboardExpand all lines: tests/functional/parser/test_model_imports.py +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 |
| 8 | 8 | MODEL_IMPORT_CASES = [ | 9 | 9 | ("SqsModel", "sqs", ["sqs"]), | | 10 | + ("IoTCoreThingEvent", "iot_registry_events", ["iot_registry_events"]), | | 11 | + ("IoTCoreThingTypeEvent", "iot_registry_events", ["iot_registry_events"]), | | 12 | + ("IoTCoreThingTypeAssociationEvent", "iot_registry_events", ["iot_registry_events"]), | | 13 | + ("IoTCoreThingGroupEvent", "iot_registry_events", ["iot_registry_events"]), | | 14 | + ("IoTCoreAddOrRemoveFromThingGroupEvent", "iot_registry_events", ["iot_registry_events"]), | | 15 | + ("IoTCoreAddOrDeleteFromThingGroupEvent", "iot_registry_events", ["iot_registry_events"]), | 10 | 16 | ("S3Model", "s3", ["s3", "event_bridge"]), | 11 | 17 | ("AppSyncEventsModel", "appsync_events", ["appsync_events", "appsync"]), | 12 | 18 | ("LambdaFunctionUrlModel", "lambda_function_url", ["lambda_function_url", "apigwv2"]), | |
|