Skip to content
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

Add S3Event #354

Merged
merged 1 commit into from
Jun 6, 2023
Merged

Add S3Event #354

merged 1 commit into from
Jun 6, 2023

Conversation

shagoon
Copy link
Contributor

@shagoon shagoon commented Jun 2, 2023

This PR adds case classes and json-decoders for S3Event. This allows S3 to trigger the lambda function as described here.

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


object S3EventRecord {

implicit private val instantDecoder: Decoder[Instant] = Decoder[String].map(Instant.parse(_))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, looks quite similar. I'll try, the test covers that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that works. Though, I had to keep the implicit val to prevent feral.lambda.events.instantDecoder from being used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, there was a conflict with this one 🤔

implicit lazy val instantDecoder: Decoder[Instant] =
Decoder.decodeBigDecimal.emapTry { millis =>

Maybe we should make that one not implicit 🤔 anyway, that can be a follow-up PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#356 could be that follow-up (or preparation) PR for this one.

}

final case class S3EventRecordGlacierRestoreEventData(
lifecycleRestorationExpiryTime: String,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also be an Instant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, according to Event message structure it's a time in ISO-8601 format as well.

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I will release this shortly.

@armanbilge armanbilge merged commit ba6df30 into typelevel:main Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants