aws / aws-lambda-go

Libraries, samples and tools to help Go developers develop AWS Lambda functions.
Apache License 2.0
3.65k stars 555 forks source link

Add S3 Batch Operations 2.0 Schema Fields to S3BatchJob/S3BatchJobTask #550

Closed lyoung-confluent closed 10 months ago

lyoung-confluent commented 10 months ago

This PR adds support for the new S3 Batch Job 2.0 Invocation Schema by adding the userArguments field and the s3Bucket key (instead of s3BucketArn) to the existing S3BatchJob and S3BatchJobTask structs. For more details see this blog post: https://aws.amazon.com/blogs/storage/automate-object-processing-in-amazon-s3-directory-buckets-with-s3-batch-operations-and-aws-lambda/

~I'm unsure if this should be a new struct specifically for 2.0 or just a small modification to the existing struct as implemented in this PR. Lambda Powertools for Python has implemented it as the same object/class for both schema versions but also has the benefit of Python's looser typing: https://github.com/aws-powertools/powertools-lambda-python/pull/3572~

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

codecov-commenter commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (58da2cc) 73.30% compared to head (51690ab) 73.30%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #550 +/- ## ======================================= Coverage 73.30% 73.30% ======================================= Files 26 26 Lines 1487 1487 ======================================= Hits 1090 1090 Misses 324 324 Partials 73 73 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

bmoffatt commented 10 months ago

I'm unsure if this should be a new struct specifically for 2.0 or just a small modification to the existing struct as implemented in this PR.

Since the new schema version removes a field, rather than being purely additive, let's do new structs with a V2 suffix.

lyoung-confluent commented 10 months ago

@bmoffatt I've split it into a new struct S3BatchJobV2, however the response struct has not changed with 2.0, should I duplicate it anyway?

bmoffatt commented 10 months ago

@bmoffatt I've split it into a new struct S3BatchJobV2, however the response struct has not changed with 2.0, should I duplicate it anyway?

I'd say leave the response struct as-is