in functions/source/association-updater/handler.py [0:0]
def get_cache_ids(event, integration_points):
if not event['type'] == 'lifecycle':
return
if event['reading']['et'] == 'operator_updated':
return {
'child': f"operator-{event['reading']['id']}",
'parent': 'root-urban.io'
}
elif event['reading']['et'] == 'customer_updated':
parent_operators = [integration for integration in integration_points if integration['Id'] in event['metadata']['ref']['o']]
if len(parent_operators) > 0 :
return {
'child': f"customer-{event['reading']['id']}",
'parent': f"operator-{parent_operators[0]['Id']}"
}
elif event['reading']['et'] == 'location_updated':
return {
'child': f"location-{event['reading']['id']}",
'parent': f"customer-{event['metadata']['ref']['c']}"
}
elif event['reading']['et'] == 'category_updated':
return {
'child': f"category-{event['reading']['id']}",
'parent': f"location-{event['metadata']['ref']['l']}"
}
elif event['reading']['et'] == 'device_updated':
return {
'child': f"device-{event['reading']['id']}",
'parent': f"category-{event['reading']['device_category']}-{event['metadata']['ref']['l']}"
}