diff --git a/watchtower-plugin/tower_info.py b/watchtower-plugin/tower_info.py index ce50d96..4ae5587 100644 --- a/watchtower-plugin/tower_info.py +++ b/watchtower-plugin/tower_info.py @@ -1,6 +1,6 @@ class TowerInfo: - def __init__(self, endpoint, available_slots, appointments=None): - self.endpoint = endpoint + def __init__(self, netaddr, available_slots, appointments=None): + self.netaddr = netaddr self.available_slots = available_slots if not appointments: @@ -10,14 +10,17 @@ class TowerInfo: @classmethod def from_dict(cls, tower_data): - endpoint = tower_data.get("endpoint") + netaddr = tower_data.get("netaddr") available_slots = tower_data.get("available_slots") appointments = tower_data.get("appointments") - if any(v is None for v in [endpoint, available_slots, appointments]): + if any(v is None for v in [netaddr, available_slots, appointments]): raise ValueError("Wrong appointment data, some fields are missing") - return cls(endpoint, available_slots, appointments) + return cls(netaddr, available_slots, appointments) def to_dict(self): return self.__dict__ + + def get_summary(self): + return {"netaddr": self.netaddr, "available_slots": self.available_slots}