feat(envelopes): add CloudWatch Logs envelope support#195
Merged
Conversation
- Added a new CloudWatch Logs envelope project under `src/Envelopes`. - Updated the solution file to include the new project. - Configured project metadata including multi-targeting `.NET 8.0`, `.NET 9.0`, and `.NET 10.0`. - Added dependencies on `Amazon.Lambda.Core` and related abstractions. - Included `README.md` with package metadata.
…yload extraction - Added `CloudWatchLogsEnvelopeBase<T>` as an abstract base for processing CloudWatch Logs events. - Added `CloudWatchLogsEnvelope<T>` for payload extraction using `System.Text.Json`. - Introduced `Amazon.Lambda.CloudWatchLogsEvents` v2.2.0 dependency in the project. - Updated project file with the required package reference.
- Added detailed XML documentation to `CloudWatchLogsEnvelopeBase<T>` and `CloudWatchLogsEnvelope<T>`. - Documented methods, properties, and classes to improve code clarity and maintainability. - Included remarks and examples for better understanding of CloudWatch Logs deserialization.
- Introduced `CloudWatchLogsEnvelopeTests` for validating envelope payload extraction and deserialization. - Covered scenarios including valid data, camel case deserialization, null data, and invalid JSON handling. - Verified the `JsonIgnore` attribute on `DataContent` property to prevent unintended serialization. - Enhanced test coverage for `CloudWatchLogsEnvelope` and its derived functionality. - Updated test project to reference `AwsLambda.Host.Envelopes.CloudWatchLogs` project.
…s events - Introduced `CloudWatchLogsEnvelope<T>` for deserializing and managing CloudWatch Logs events payloads. - Added `AwsLambda.Host.Envelopes.CloudWatchLogs` project to the solution file with required dependencies. - Provided documentation and examples in `README.md` and `SAMPLE_EVENTS.md`. - Updated example project to reference the new CloudWatch Logs envelope project. - Included support for custom deserialization through inheritance and extensibility.
- Renamed the launch profile from "Lambda.Host.Example.HelloWorld" to "Local" in `launchSettings.json`. - Updated the project to align with a consistent naming convention for local debugging.
- Introduced `LambdaDefaultJsonOptions` providing AWS Lambda-specific JSON settings. - Included default ignore condition, case insensitivity, and AWS-compliant naming policy. - Added specialized converters for `DateTime`, `MemoryStream`, `ConstantClass`, and byte arrays. - Enhanced extensibility for handling AWS Lambda event serialization.
…xtraction - Introduced `CloudWatchLogsEnvelope<T>` for structured log message deserialization. - Refactored `CloudWatchLogsEnvelopeBase<T>` to support decoded and decompressed payload handling. - Added `AwsLogsEnvelope` and `LogEventEnvelope` classes for structured data representation. - Enhanced `ExtractPayload` to handle both plain text and JSON-based log messages efficiently.
…uidance - Clarified the usage of `CloudWatchLogsEnvelope` and `CloudWatchLogsEnvelope<T>` for log processing. - Highlighted differences in handling plain string vs. JSON log messages. - Improved code examples to align with new envelope functionality and corrected placeholders. - Refined table descriptions to reflect updated class structures and use cases. - Updated custom deserialization section with clearer explanations and examples.
…udWatchLogsEnvelope<T>` - Expanded test coverage for both generic and non-generic `ExtractPayload` scenarios. - Added tests for multiple log events, camel case deserialization, and metadata population. - Verified proper handling of null message content and invalid JSON scenarios. - Added inheritance tests to confirm envelopes derive from `CloudWatchLogsEvent`. - Validated `JsonIgnore` attributes for preventing unintended serialization.
- Standardized the format of "Related Packages" tables across multiple README files. - Added missing CloudWatch Logs package entry to the tables. - Improved consistency in package ordering within the tables.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🚀 Pull Request
📋 Summary
This PR adds comprehensive support for CloudWatch Logs events in AWS Lambda functions through new envelope classes. The implementation provides both a base envelope for raw log data access and a strongly-typed generic envelope for automatic payload deserialization.
Key Features:
CloudWatchLogsEnvelope- Base envelope providing access to raw CloudWatch Logs data (gzip-compressed, base64-encoded)CloudWatchLogsEnvelope<T>- Generic envelope with automatic JSON deserialization of log messages to strongly-typed payloadsRelated Packages Updated:
EnvelopeOptions✅ Checklist
🧪 Related Issues or PRs
Closes #135
💬 Notes for Reviewers
Focus Areas:
CloudWatchLogsEnvelopeBase- it handles base64 decoding and gzip decompressionCloudWatchLogsEnvelope<T>for consistency with other envelope implementationsImplementation Details:
AwsLogsproperty for the raw CloudWatch Logs data structureEnvelopeOptions.DefaultJsonSerializerOptionsTest Coverage:
SAMPLE_EVENTS.mdfor reference