File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 22from __future__ import annotations
33
44from dataclasses import dataclass
5- from enum import Enum
5+ from enum import StrEnum
66from typing import Any
77
88from prometheus_client .parser import text_string_to_metric_families as parser
99
1010
11- class MonitorType (str , Enum ):
11+ class MonitorType (StrEnum ):
1212 """Monitors type."""
1313
1414 HTTP = "http"
@@ -20,7 +20,19 @@ class MonitorType(str, Enum):
2020 STEAM = "steam"
2121 MQTT = "mqtt"
2222 SQL = "sqlserver"
23-
23+ JSON_QUERY = "json-query"
24+ GROUP = "group"
25+ DOCKER = "docker"
26+ GRPC_KEYWORD = "grpc-keyword"
27+ REAL_BROWSER = "real-browser"
28+ GAMEDIG = "gamedig"
29+ KAFKA_PRODUCER = "kafka-producer"
30+ POSTGRES = "postgres"
31+ MYSQL = "mysql"
32+ MONGODB = "mongodb"
33+ RADIUS = "radius"
34+ REDIS = "redis"
35+ TAILSCALE_PING = "tailscale-ping"
2436
2537class UptimeKumaBaseModel :
2638 """UptimeKumaBaseModel."""
@@ -46,10 +58,7 @@ def from_dict(data: dict[str, Any]) -> UptimeKumaMonitor:
4658 obj : dict [str , Any ] = {}
4759 for key , value in data .items ():
4860 if hasattr (UptimeKumaMonitor , key ):
49- obj [key ] = value
50-
51- if obj .get ("type" ):
52- obj ["type" ] = MonitorType (obj ["type" ])
61+ obj [key ] = MonitorType (value ) if key == "monitor_type" else value
5362
5463 return UptimeKumaMonitor (** obj )
5564
You can’t perform that action at this time.
0 commit comments