From 71ce8a31438613b2924ab32bf2dd8561e8e56400 Mon Sep 17 00:00:00 2001 From: Manish Ram Date: Mon, 2 Nov 2026 09:40:14 -0800 Subject: [PATCH] fix(parser): add IoT Core registry models to parser.models exports The six IoT Core registry models were listed as built-in models in the docs but missing from parser/models/__init__.py, so importing them from parser.models failed. Also fix the CloudWatchLogsModel spelling in the parser docs. --- .../utilities/parser/models/__init__.py | 20 +++++++++++++++++++ docs/utilities/parser.md | 4 ++-- tests/functional/parser/test_model_imports.py | 6 ++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/aws_lambda_powertools/utilities/parser/models/__init__.py b/aws_lambda_powertools/utilities/parser/models/__init__.py index c164e67ae16..7fb1cabbac5 100644 --- a/aws_lambda_powertools/utilities/parser/models/__init__.py +++ b/aws_lambda_powertools/utilities/parser/models/__init__.py @@ -78,6 +78,14 @@ ) from .event_bridge import EventBridgeModel from .event_bridge_v2 import EventBridgeV2Model, EventBridgeV2RecordModel, EventBridgeV2SystemMetadataModel + from .iot_registry_events import ( + IoTCoreAddOrDeleteFromThingGroupEvent, + IoTCoreAddOrRemoveFromThingGroupEvent, + IoTCoreThingEvent, + IoTCoreThingGroupEvent, + IoTCoreThingTypeAssociationEvent, + IoTCoreThingTypeEvent, + ) from .kafka import ( KafkaBaseEventModel, KafkaMskEventModel, @@ -203,6 +211,12 @@ "EventBridgeV2Model": "event_bridge_v2", "EventBridgeV2RecordModel": "event_bridge_v2", "EventBridgeV2SystemMetadataModel": "event_bridge_v2", + "IoTCoreAddOrDeleteFromThingGroupEvent": "iot_registry_events", + "IoTCoreAddOrRemoveFromThingGroupEvent": "iot_registry_events", + "IoTCoreThingEvent": "iot_registry_events", + "IoTCoreThingGroupEvent": "iot_registry_events", + "IoTCoreThingTypeAssociationEvent": "iot_registry_events", + "IoTCoreThingTypeEvent": "iot_registry_events", "KafkaBaseEventModel": "kafka", "KafkaMskEventModel": "kafka", "KafkaRecordModel": "kafka", @@ -370,6 +384,12 @@ def __dir__() -> list[str]: "KafkaSelfManagedEventModel", "KafkaRecordModel", "KafkaMskEventModel", + "IoTCoreAddOrDeleteFromThingGroupEvent", + "IoTCoreAddOrRemoveFromThingGroupEvent", + "IoTCoreThingEvent", + "IoTCoreThingGroupEvent", + "IoTCoreThingTypeAssociationEvent", + "IoTCoreThingTypeEvent", "KafkaBaseEventModel", "KinesisFirehoseSqsModel", "KinesisFirehoseSqsRecord", diff --git a/docs/utilities/parser.md b/docs/utilities/parser.md index ecb8ede5f9f..199477c3af9 100644 --- a/docs/utilities/parser.md +++ b/docs/utilities/parser.md @@ -118,7 +118,7 @@ The example above uses `SqsModel`. Other built-in models can be found below. | **CloudFormationCustomResourceCreateModel** | Lambda Event Source payload for AWS CloudFormation `CREATE` operation | | **CloudFormationCustomResourceUpdateModel** | Lambda Event Source payload for AWS CloudFormation `UPDATE` operation | | **CloudFormationCustomResourceDeleteModel** | Lambda Event Source payload for AWS CloudFormation `DELETE` operation | -| **CloudwatchLogsModel** | Lambda Event Source payload for Amazon CloudWatch Logs | +| **CloudWatchLogsModel** | Lambda Event Source payload for Amazon CloudWatch Logs | | **CognitoPreSignupTriggerModel** | Lambda User Pool Pre-Sign-Up trigger event | | **CognitoPostConfirmationTriggerModel** | Lambda User Pool Post Confirmation trigger event | | **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 | **EventBridgeEnvelope** | 1. Parses data using `EventBridgeModel`. ``2. Parses `detail` key using your model`` and returns it. | `Model` | | **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]` | | **SqsEnvelope** | 1. Parses data using `SqsModel`. ``2. Parses records in `body` key using your model`` and return them in a list. | `List[Model]` | -| **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]` | +| **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]` | | **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]` | | **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]` | | **SnsEnvelope** | 1. Parses data using `SnsModel`. ``2. Parses records in `body` key using your model`` and return them in a list. | `List[Model]` | diff --git a/tests/functional/parser/test_model_imports.py b/tests/functional/parser/test_model_imports.py index c8a8a45006d..b75f6649a29 100644 --- a/tests/functional/parser/test_model_imports.py +++ b/tests/functional/parser/test_model_imports.py @@ -7,6 +7,12 @@ MODEL_IMPORT_CASES = [ ("SqsModel", "sqs", ["sqs"]), + ("IoTCoreThingEvent", "iot_registry_events", ["iot_registry_events"]), + ("IoTCoreThingTypeEvent", "iot_registry_events", ["iot_registry_events"]), + ("IoTCoreThingTypeAssociationEvent", "iot_registry_events", ["iot_registry_events"]), + ("IoTCoreThingGroupEvent", "iot_registry_events", ["iot_registry_events"]), + ("IoTCoreAddOrRemoveFromThingGroupEvent", "iot_registry_events", ["iot_registry_events"]), + ("IoTCoreAddOrDeleteFromThingGroupEvent", "iot_registry_events", ["iot_registry_events"]), ("S3Model", "s3", ["s3", "event_bridge"]), ("AppSyncEventsModel", "appsync_events", ["appsync_events", "appsync"]), ("LambdaFunctionUrlModel", "lambda_function_url", ["lambda_function_url", "apigwv2"]),