Created
November 30, 2019 16:51
-
-
Save sudheerchamarthi/3dc5beacfc436cd8dc590748f1e07459 to your computer and use it in GitHub Desktop.
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
| from __future__ import print_function | |
| import base64 | |
| print('Loading function') | |
| def lambda_handler(event, context): | |
| output = [] | |
| print(event) | |
| for record in event['records']: | |
| print(record['recordId']) | |
| payload = (base64.b64decode(record['data'])).split("|") | |
| if payload[0] == '1': | |
| payload[0] = 'True' | |
| else: | |
| payload[0] = 'False' | |
| final_payload = '|'.join(payload) | |
| # Do custom processing on the payload here | |
| output_record = { | |
| 'recordId': record['recordId'], | |
| 'result': 'Ok', | |
| 'data': base64.b64encode(final_payload) | |
| } | |
| output.append(output_record) | |
| print(output_record) | |
| print('Successfully processed {} records.'.format(len(event['records']))) | |
| return {'records': output} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment