Add debuging repr to print more nicely

Otherwise you just see <CloudClusterResponse object> when you try to print this.

Contributes to issue CURA-8671.
This commit is contained in:
Ghostkeeper 2021-12-03 13:26:29 +01:00
parent 0477ba44b2
commit 6d9142579a
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -45,3 +45,10 @@ class CloudClusterResponse(BaseModel):
super().validate()
if not self.cluster_id:
raise ValueError("cluster_id is required on CloudCluster")
def __repr__(self) -> str:
"""
Convenience function for printing when debugging.
:return: A human-readable representation of the data in this object.
"""
return str({k: v for k, v in self.__dict__.items() if k in {"cluster_id", "host_guid", "host_name", "status", "is_online", "host_version", "host_internal_ip", "friendly_name", "printer_type", "printer_count", "capabilities"}})