-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[request]: Serialize/Deserialize of models for Lambda events #269
Comments
Thanks for submitting this, I'll ask the rest of the team what they think about it. |
You might want to take a look at this project: https://github.com/LegNeato/aws-lambda-events |
I wanted to piggy-back off this as I'm not sure the best place to put generic requests for serde serialize/deserialize support. I'm currently looking for ways to deserialize the items (aka HashMap<String, AttributeValue>) from DynamoDB after exporting the table to s3 and downloading the files locally. I don't currently see an easy way to deserialize these items from S3 into items/structs using the existing serde_json or serde_dynamo crates today. Maybe there is something I'm missing here, but this would be extremely valuable to be able to deserialize the DynamoDB table exports for scripts in Rust while learning the language and experimenting with the SDK. |
I have same problems. My situation is that I want to parse cloudwatch event detail field into aws config ConfigurationItemChangeNotification, ConfigurationItem is really complicated struct, serde remote type is not a good way to do it |
The biggest issue is what this will do to crate sizes and compile times. I wrote about this in an FAQ entry.
It's possibly that in a future version of Rust that supports "poll-based dependency resolution" we could add support for serde without affecting compile times for those that don't use it. We're not compiler experts and are definitely open to suggestions, but it's important that any proposed solution weighs the needs of all users. related topics: |
It would be nice to have a crate feature to enable deserialization for those of us who need it. It's a fairly common way to do that in the Rust community. We are currently impacted by its absence, and are resorting to using types from the |
I have a similar need for serializing transcripts received using the transcribestreaming API. If I'm not mistaken those events are received as JSON in the first place, so my ideal solution would be a hook for direct access to the received messages. |
You should be able to get access directly to the not-yet-deserialized JSON with an Interceptor using the |
Oh interesting thanks :) |
@landonxjames this was promising but unfortunately I can't get anything useful out of it, I filed #1212 with what I tried :) |
In my understanding the interceptor code can only be used to inspect the initial response, not follow up messages |
@landonxjames I ended up using |
Community Note
Tell us about your request
Add support for deserialization of structs for use with Lambda events. This is similar to #211, but for event sources that integrate with Lambda.
Alternatively, we could provide a official set of Lambda events, but this would be hard to do without an authoritative repository of event schemas for Lambda.
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
I am currently writing a Lambda function in Rust for a GitHub sample that's invoked from a DynamoDB streams to showcase how to do parallel processing within a Lambda function.
Lambda's Event Source Mapping takes care of polling events from the DynamoDB stream and invoking the Lambda function with a batch. Lambda sends a JSON objects resembling
aws_sdk_dynamodbstreams::output::GetRecordsOutput
withoutNextShardIterator
.Are you currently working around this issue?
Right now, I've recreated most of it by making my own
struct
s copying the Go Lambda SDK'sDynamoDBEvent
structure.Additional context
N/A
Attachments
The text was updated successfully, but these errors were encountered: