def update_thing_event()

in codes/lambda/custom_iot_event_msg/src/handler.py [0:0]


def update_thing_event(props):
    type = str(props['Type'])
    enable = True if str(props['Enable']).lower() == 'true' else False

    print('update thing event: requested', type, enable)

    try:
        client = boto3.client('iot')
        response = client.update_event_configurations(
            eventConfigurations={
                type: {
                    'Enabled': enable
                }
            }
        )
        print('update thing event: success', response)
        return type + '-' + str(enable)
    except Exception as e:
        print("update thing event: fail", e)
        return None