def lambda_handler()

in shd-notifier/Health-Event-Iterator-LambdaFn.py [0:0]


def lambda_handler(event, context): 
  # read in the count, if missing default to COUNT
  try:
    count= event['count']
  except Exception as e:
    eMessage="WARN: Missing count defaulting to %i" % COUNT
    print(eMessage)
    count=COUNT

  # read in the maxCount, if missing default to 15 
  try:
    maxCount= event['maxCount']
  except Exception as e:
    eMessage="WARN: Missing maxCount defaulting to %i" % MAXCOUNT
    print(eMessage)
    maxCount=MAXCOUNT

  count=count+1 # increment the counter
  if (count==maxCount): count=0 # set the count back to 0 when maxCount is reached
  return count # return the count as the output