[sty] logic:conf

This commit is contained in:
Christian Fraß 2022-12-05 08:16:41 +01:00
parent e7be85f61a
commit 020846ebc8

View file

@ -1,7 +1,8 @@
def conf_schema_active():
return {
"description": "whether the check shall be executed",
"type": "boolean",
"default": True
"default": True,
}
@ -10,7 +11,7 @@ def conf_schema_threshold():
"description": "how often a condition has to occur in order to be reported",
"type": "integer",
"minimum": 1,
"default": 3
"default": 3,
}
@ -18,19 +19,20 @@ def conf_schema_annoy():
return {
"description": "whether notifications shall be kept sending after the threshold has been surpassed",
"type": "boolean",
"default": False
"default": False,
}
def conf_schema_interval(default):
return {
"description": "in seconds or as text",
"anyOf": [
{
"description": "in seconds",
"type": "integer",
"exclusiveMinimum": 0
"exclusiveMinimum": 0,
},
{
"description": "as text",
"type": "string",
"enum": [
"minute",
@ -53,7 +55,7 @@ def conf_schema_schedule():
"attentive_interval": conf_schema_interval(60 * 2),
},
"required": [
]
],
}
@ -77,7 +79,7 @@ def conf_schema_notifications(notification_channel_implementations):
"required": [
"kind",
"parameters"
]
],
},
notification_channel_implementations.items()
)
@ -88,8 +90,8 @@ def conf_schema_notifications(notification_channel_implementations):
"kind": "console",
"parameters": {
}
}
]
},
],
}
@ -110,7 +112,7 @@ def conf_schema_root(check_kind_implementations, notification_channel_implementa
"notifications": conf_schema_notifications(notification_channel_implementations),
},
"required": [
]
],
},
"checks": {
"type": "array",
@ -135,7 +137,7 @@ def conf_schema_root(check_kind_implementations, notification_channel_implementa
},
"required": [
"name",
]
],
},
{
"anyOf": list(
@ -153,7 +155,7 @@ def conf_schema_root(check_kind_implementations, notification_channel_implementa
},
"required": [
"kind",
"parameters"
"parameters",
]
},
check_kind_implementations.items()