in wallboard-import.py [0:0]
def GetThresholds(ThresholdConfig):
Thresholds = []
for Threshold in ThresholdConfig:
if "Reference" not in Threshold:
print("Missing reference in threshold "+Threshold["ReferenceName"])
sys.exit(1)
if "WarnBelow" not in Threshold and "AlertBelow" not in Threshold and \
"WarnAbove" not in Threshold and "AlertAbove" not in Threshold:
print("No actual threshold set in threshold "+Threshold["ReferenceName"])
sys.exit(1)
Item = {}
Item["Name"] = {"S":str(Threshold["Threshold"])} # Stringify just in case this is a numeric
Item["Reference"] = {"S":Threshold["Reference"]}
if "WarnBelow" in Threshold: Item["WarnBelow"] = {"S":str(Threshold["WarnBelow"])}
if "AlertBelow" in Threshold: Item["AlertBelow"] = {"S":str(Threshold["AlertBelow"])}
if "WarnAbove" in Threshold: Item["WarnAbove"] = {"S":str(Threshold["WarnAbove"])}
if "AlertAbove" in Threshold: Item["AlertAbove"] = {"S":str(Threshold["AlertAbove"])}
Thresholds.append(Item)
return(Thresholds)