def handler()

in SubTemplates/IoT/Lambdas/cert_rotation_monitor/app.py [0:0]


def handler(event, context):
  
  overdue_things = get_overdue_things(target_date)
 
  for thing in overdue_things['things']:
    print(thing)
    endpoint.publish(
      topic='{}/{}/alerts'.format(ALERT_TOPIC,thing['thingName']),
      payload='{"msg":"rotate_cert"}'
      )
    
    if thing['attributes']["cert_issuance"] >= trigger_date:
      deactivate_cert(thing['thingName'])
  
  return {
    'notified_things': overdue_things['things']
    
  }