in codes/lambda/custom_iot_event_msg/src/handler.py [0:0]
def handle(event, context):
print('event-->', json.dumps(event))
request_type = event['RequestType']
physical_id = None
if request_type == 'Create':
physical_id = update_thing_event(event['ResourceProperties'])
elif request_type == 'Delete':
physical_id = event['PhysicalResourceId']
elif request_type == 'Update':
physical_id = update_thing_event(event['ResourceProperties'])
if physical_id != None:
return { 'PhysicalResourceId': physical_id }
else:
raise Exception('Fail to handl iot-event-message')