Add serverless lambda proxy event type#239
Conversation
Closes iopipe#236 Signed-off-by: Michael Lavers <kolanos@gmail.com>
| event_info = {} | ||
| for key in self.keys: | ||
| value = get_value(self.event, key) | ||
| if isinstance(key, tuple): |
There was a problem hiding this comment.
What's changing that we need to check that these are tuples?
There was a problem hiding this comment.
We map one key to another, so keys can now be a list of strings or a list of tuples. If it's a list of tuples, it's a map from old_key to new_key.
There was a problem hiding this comment.
Why can keys now be of two different types? (List of strings or list of tuples)
There was a problem hiding this comment.
Because we map serveless lambda proxy events into api gateway events. See the equivalent JS implementation here:
iopipe/iopipe-js-event-info@2033c3e
Signed-off-by: Michael Lavers <kolanos@gmail.com>
| event_info = event.collect() | ||
| assert event_info != {} | ||
|
|
||
| expected_keys = ['@iopipe/event-info.eventType' |
There was a problem hiding this comment.
Coverage for eventType.source? iopipe/iopipe-js-event-info@2033c3e#diff-ee6f6f22184012610d36277ea8371b4bR87 That is, can we add a test asserting that key/val, for consistency?
There was a problem hiding this comment.
I don't understand the question. The test asserts that the event type produces the expected result (new_key), which is the api gateway keys. This is effectively testing the mapping.
There was a problem hiding this comment.
I added an assertion to do what I think you're describing.
There was a problem hiding this comment.
Thanks, I'll hold on reviewing this until after the weekend, as I'm having a hardtime seeing how, programatically, this will result in the slsIntegrationLambda value under eventType.source
Signed-off-by: Michael Lavers <kolanos@gmail.com>
Signed-off-by: Michael Lavers <kolanos@gmail.com>
Closes #236
Signed-off-by: Michael Lavers kolanos@gmail.com